-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Use shared memory objects for data #429
Conversation
…ng buffer Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…tially Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
… assume char* pointer type (use void* and cast at the right places if needed) Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…ftruncate), and only then mmap() it again Signed-off-by: DL6ER <dl6er@dl6er.de>
…th "/" for portability Signed-off-by: DL6ER <dl6er@dl6er.de>
…(). shm_open() automatically sets FD_CLOEXEC which closes the file handler automatically whenever something is calling system() to avoid leaking the file descriptors to random programs. The file descriptor becomes invalid and later mmap operations fail. We always use shm_open() (without the O_CREAT attribute) every time before we run mmap to ensure we always have a valid file descriptor. Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
# Conflicts: # api.c # dnsmasq_interface.c
The merged in code tried to use normal strings instead of shared memory strings. Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
unsigned int is smaller than long long, which all of the string position data was using. This generated a lot of warnings. Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Previously two NULL bytes were used between strings, which was not intended. Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
The new size was not remembered after resizing, causing it to never resize larger than two 4k blocks of items. Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This requires that it be accessed through a pointer, so most of the changes are just changing `counters.` to `counters->` Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
# Conflicts: # dnsmasq_interface.c # resolve.c
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This is checked by accessors of shared memory to defer to FTL so they do not starve FTL of access to shared memory (starving DNS resolution). Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
It is no longer needed. Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Store database ID in queries struct
Signed-off-by: DL6ER <dl6er@dl6er.de>
# Conflicts: # database.c # request.c
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Add shared memory lock
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
Note that this change does not affect any parts of the API, yet. The goal is to eventually replace FTL's internal telnet API by the future RESTful HTTP API. This will, however, not happen overnight but we plan to keep the existing telnet API for some additional time after releasing the HTTP API. However, no additional features will be added to the telnet API as soon as the HTTP API will be available. |
Closing and reopening to try and get Codacy working... |
Flipping status for CodeFactor check. |
Use shared memory objects for data Signed-off-by: spb-admin <spb@poligon.ru> Signed-off-by: r00t0vi4 <r00t0vi4@gmail.com>
Use shared memory objects for data Signed-off-by: r00t0vi4 <r00t0vi4@gmail.com>
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: |
By submitting this pull request, I confirm the following:
How familiar are you with the codebase?:
10
This PR is a combined effort of @Mcat12 and @DL6ER. It changes the way FTL stores its data internally. Previously, everything was held in private memory. However, after merging this PR, the data will instead be held in POSIX Shared Memory objects, allowing a straightforward sharing with the future API we are currently working on (see here).
Although shared memory objects could be understood as being slightly less secure compared to private memory, however this is not the case. The data is still protected as it is protected with permissions
600
, i.e., only the owner (the userpihole
) can read and write on the data. This serves the same level of privacy as we do already now.This template was created based on the work of
udemy-dl
.