-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add non capsicum build option #3
base: master
Are you sure you want to change the base?
Conversation
This is a stepping stone to a linux port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks like a good start. My comments are mostly about reducing code duplication.
|
||
// Starting with linux unfriendly code (pdfork) | ||
// ?? errno? | ||
if ((pid = pdfork(&pd, PD_CLOEXEC)) < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pdfork() is roughly equivalent to fork()+pidfd_open() on Linux, I believe.
if (firstdot) | ||
*firstdot = '\0'; | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to do something like
#define cap_getnameinfo(channel, ...) getnameinfo(__VA_ARGS__)
in the non-capsicum case, and then everything ought to work without any code duplication.
|
||
// Loop here until service is stopped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use C-style comments, just to keep things consistent.
@@ -33,11 +33,19 @@ | |||
struct cap_channel; | |||
struct sockaddr_in; | |||
|
|||
#ifdef WITH_CAPSICUM | |||
int netdump_cap_handler(struct cap_channel *, const char *, const char *, | |||
const char *, const char *, const char *); | |||
int netdump_cap_herald(struct cap_channel *, int *, struct sockaddr_in *, | |||
uint32_t *, char **); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra newline here.
if (error != 0 && *nsd >= 0) | ||
(void)close(*nsd); | ||
return (error); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to avoid duplication with cap_herald.c by refactoring the code a bit:
- change netdump_cap_herald() to call herald_command() directly when capsicum is not configured,
- refactor herald_command() to avoid using nvlists directly, instead just using C out-parameters or a structure or something.
I believe you could also use libnv on Linux: https://github.com/fudosecurity/nvlist
This is a stepping stone to a linux port
I have tested dumping from a OneFS node and reading the core from an internal kgdb container. Please let me know what testing you would like to see performed.