-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
af-packet: terminate on same iface and copyiface #9308
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,6 +271,36 @@ const char *LiveGetShortName(const char *dev) | |
return live_dev->dev_short; | ||
} | ||
|
||
int CheckAFPacketIPSDevs(void) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this in util-device? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought that since we're looping for ifaces and that kinda logic seemed to already be here in this file so this might be the right place. |
||
{ | ||
ConfNode *base = ConfGetNode("af-packet"); | ||
ConfNode *child; | ||
|
||
if (base == NULL) | ||
return 0; | ||
|
||
TAILQ_FOREACH (child, &base->head, next) { | ||
ConfNode *subchild; | ||
const char *iface = NULL, *copyiface = NULL; | ||
TAILQ_FOREACH (subchild, &child->head, next) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really understand what we're looping here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I understand, each of the entries in a list item like
|
||
if (!strcmp(subchild->name, "interface")) | ||
iface = subchild->val; | ||
if (!strcmp(subchild->name, "copy-iface")) | ||
copyiface = subchild->val; | ||
if (iface && copyiface && !strcmp(iface, copyiface)) { | ||
SCLogError("af-packet interface and copy-iface cannot be the same"); | ||
return -1; | ||
} | ||
if (iface && copyiface) { | ||
iface = NULL; | ||
copyiface = NULL; | ||
} | ||
} | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
int LiveBuildDeviceList(const char *runmode) | ||
{ | ||
return LiveBuildDeviceListCustom(runmode, "interface"); | ||
|
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.
can this be checked in the af-packet files instead?
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.
Yes. As per your main suggestion since all of the other things done are invalid, it should all probably be there.