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

Ips bpf #333

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/source-af-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1545,8 +1545,14 @@ TmEcode ReceiveAFPThreadInit(ThreadVars *tv, void *initdata, void **data) {
if (ptv->copy_mode != AFP_COPY_MODE_NONE) {
strlcpy(ptv->out_iface, afpconfig->out_iface, AFP_IFACE_NAME_LENGTH);
ptv->out_iface[AFP_IFACE_NAME_LENGTH - 1]= '\0';
/* Warn about BPF filter consequence */
if (ptv->bpf_filter) {
SCLogInfo("WARNING, enabling a BPF filter in IPS mode result"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think SCLogWarning is more appropriate for, well, warnings? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've got a serious argument here :) I've choose Info because it can be normal if the user really know what he does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 03/26/2013 05:42 PM, Eric Leblond wrote:

In src/source-af-packet.c:

@@ -1545,8 +1545,14 @@ TmEcode ReceiveAFPThreadInit(ThreadVars _tv, void *initdata, void *_data) {
if (ptv->copy_mode != AFP_COPY_MODE_NONE) {
strlcpy(ptv->out_iface, afpconfig->out_iface, AFP_IFACE_NAME_LENGTH);
ptv->out_iface[AFP_IFACE_NAME_LENGTH - 1]= '\0';

  •    /\* Warn about BPF filter consequence */
    
  •    if (ptv->bpf_filter) {
    
  •        SCLogInfo("WARNING, enabling a BPF filter in IPS mode result"
    

You've got a serious argument here :) I've choose Info because it can be
normal if the user really know what he does.

I'm sure a user like that can ignore a real warning then :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, you've got me ;)

" in dropping all non matching packets.");
}
}


if (AFPPeersListAdd(ptv) == TM_ECODE_FAILED) {
SCFree(ptv);
afpconfig->DerefFunc(afpconfig);
Expand Down
6 changes: 6 additions & 0 deletions src/suricata.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ static void SetBpfString(int optind, char *argv[]) {
if (bpf_len == 0)
return;

if (IS_ENGINE_MODE_IPS(engine_mode)) {
fprintf(stderr, "ERROR: BPF filter not available in IPS mode."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why fprintf here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in next error.

OK for an incremental patch fixing both at once ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 03/26/2013 05:40 PM, Eric Leblond wrote:

In src/suricata.c:

@@ -381,6 +381,12 @@ static void SetBpfString(int optind, char *argv[]) {
if (bpf_len == 0)
return;

  • if (IS_ENGINE_MODE_IPS(engine_mode)) {
  •    fprintf(stderr, "ERROR: BPF filter not available in IPS mode."
    

It is used in next error.

OK for an incremental patch fixing both at once ?

Did I hear you say amended patch in new pr? ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, then I add an other one fixing the second fprintf :)

" Use firewall filtering if possible.\n");
exit(EXIT_FAILURE);
}

bpf_filter = SCMalloc(bpf_len);
if (unlikely(bpf_filter == NULL))
return;
Expand Down