Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal client accounting #1115

Closed
krizhanovsky opened this issue Nov 24, 2018 · 0 comments
Closed

Temporal client accounting #1115

krizhanovsky opened this issue Nov 24, 2018 · 0 comments

Comments

@krizhanovsky
Copy link
Contributor

krizhanovsky commented Nov 24, 2018

The task is from #488 (comment):

From #100: the most urgent thing is to keep security accounting data for a client for some time after the last client connection is closed. This is very important to track client security limits properly for Connection: closed connections. See https://github.com/tempesta-tech/tempesta/blob/master/tempesta_fw/client.c#L89

Since we have to evict client accounting data after 'some time', it has sense to store them in a TDB table. At this time TDB has issues with eviction - just let's leave with them untill they are fixed in Beta.

Next, the hash key for searching a client must be calculated by User-Agent plus IP address, otherwise, if no User-Agent, only IP address.

Currently, we use netowork IP address as the address of a client, however if a client work through a forward proxy, then a proxy can pass it's IP address by the first item in X-Forwarded-For, so if the header is present, then we shall reinsert the TfwClient in TDB with different key.

The reinsert operation must be implemented on TDB layer as a new routine tdb_entry_reinsert() accepting current and new keys. The function must call tdb_htrie_insert(), copying the data from the previous location, and a new empty tdb_htrie_delete() left as TODO for #515.

Traversal all the clients on shutdown must be done by a new TDB routine tdb_walk() which is just a walk on the radix tree plus tdb_rec_next() call. The routine must expect that there is no tree writers (the operation must be done after closing the listener socket and sycnrhonization barrier on all softirqs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants