bugThe GNU Hurd - Bugs: bug #27698, BPF, NPF, pfinet vs. package_header

 
 

bug #27698: BPF, NPF, pfinet vs. package_header

Submitted by:  Zheng Da <zhengda>
Submitted on:  Wed 14 Oct 2009 08:07:33 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: NonePrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: OpenReproducibility: None
Size (loc): NonePlanned Release: None
Effort: 0.00
Wiki-like text discussion box: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 14 Oct 2009 08:07:33 AM UTC, comment #5:

This item has been reassigned from the project The GNU Hurd patch tracker to your tracker.

The original report is still available at patch #6851

Following are the information included in the original report:

[field #0] Item ID: 6851
[field #1] Group ID: 30
[field #2] Open/Closed: Open
[field #3] Severity: 3 - Normal
[field #4] Privacy: Public
[field #9] Category: GNU Mach
[field #10] Submitted by: zhengda
[field #11] Assigned to: zhengda
[field #12] Submitted on: Sun 21 Jun 2009 03:36:19 AM CEST
[field #13] Summary: fix a bug in BPF
[field #14] Original Submission: The packet data passed to BPF should exclude the packet_header.
The amount of a packet that returns to the user space should include packet_header.
[field #16] Item Group: None
[field #17] Status: Done
[field #18] Component Version: None
[field #19] Operating System: None
[field #20] Reproducibility: None
[field #21] Size (loc): None
[field #22] Fixed Release: None
[field #23] Planned Release: None
[field #24] Effort: 0.00
[field #28] Priority: 5 - Normal
[field #31] Percent Complete: 0%
[field #33] Release: None
[field #58] Custom Select Box #1: None
[field #59] Custom Select Box #2: None
[field #60] Custom Select Box #3: None
[field #61] Custom Select Box #4: None
[field #62] Custom Select Box #5: None
[field #63] Custom Select Box #6: None
[field #64] Custom Select Box #7: None
[field #65] Custom Select Box #8: None
[field #66] Custom Select Box #9: None
[field #67] Custom Select Box #10: None

Thomas Schwinge <tschwinge>
Project Administrator
Thu 30 Jul 2009 03:25:21 AM UTC, comment #4:

The only user of packet_header that I can see is NPF. It requires more data copy in order to remove the packet_header before delivering the packet to the user space, I guess. but I don't understand the implementation of NPF.

Zheng Da <zhengda>
Project Member
Wed 29 Jul 2009 09:04:49 AM UTC, comment #3:

> The packet delivered from gnumach should have the packet header. NPF returns the packet_header and pfinet always assumes that the packet from gnumach has the packet_header.


OK, I understand that, and it is fine, but is there a specific reason to send package_header to user-space? (That is, if it's not required, then we should perhaps change pfinet and net_filter to not handle it?) If I understand the code correctly, packets that go from pfinet to the kernel to be sent out, do not contain the packet_header, but packets that go from the kernel to pfinet do contain the packet_header. Why this asymmetry? Perhaps I fail to understand what this packet_header is actually good for. (All that is unrelated to this bug report, of course, but while we're at it...)

> For your first question, the return value of net_do_filter is boolean, i.e., it can only be passed or not passed, but bpf_do_filter returns the size of the data that passes the filter.


OK, I see. The code could be written in a way that this is more obvious... (15 years old code, I know.)

My question also was whether net_do_filter should be changed to not handle the packet_header-part of the packet, as that is not related to the actual packet data (as I understand it), and thus should not be involved in deciding whether to allow or deny a given packet. (That's also unrelated to this bug report.)

Given the same instructions as in bug #20612, please install this patch. (And then we can think about the other issues I'm talking above.)

Thomas Schwinge <tschwinge>
Project Administrator
Wed 29 Jul 2009 08:15:10 AM UTC, comment #2:

The packet delivered from gnumach should have the packet header. NPF returns the packet_header and pfinet always assumes that the packet from gnumach has the packet_header.

For your first question, the return value of net_do_filter is boolean, i.e., it can only be passed or not passed, but bpf_do_filter returns the size of the data that passes the filter.

bpf_do_filter(infp, net_kmsg(kmsg)->packet + sizeof(struct packet_header), count, net_kmsg(kmsg)->header, ifp->if_header_size, &hash_headp, &entp) is simply wrong because the length of the packet data passed to bpf_do_filter isn't 'count' any more.

Zheng Da <zhengda>
Project Member
Tue 28 Jul 2009 12:53:10 PM UTC, comment #1:

I had a look at this. In general, the patch seems to be correct. Two questions: Why isn't the same adjustment being done for net_do_filter, or why doesn't it have to be done? Why do we (have to) return the packet_header to user-space?

Thomas Schwinge <tschwinge>
Project Administrator
Wed 14 Oct 2009 08:07:33 AM UTC, original submission:

The packet data passed to BPF should exclude the packet_header.
The amount of a packet that returns to the user space should include packet_header.

Zheng Da <zhengda>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #18298:  bpf.patch added by zhengda (1kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by tschwinge (Posted a comment)
  • -unavailable- added by zhengda (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 14 Oct 2009 08:09:38 AM UTCtschwingeSummaryfix a bug in BPF=>BPF, NPF, pfinet vs. package_header
    Wed 14 Oct 2009 08:07:33 AM UTCtschwingeReassign itemThe GNU Hurd, patch #6851=>The GNU Hurd, bug #27698

    Back to the top


    Powered by Savane 3.1-cleanup