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

Implement shiftleft/shiftright by moving packet around #1032

Closed
wants to merge 6 commits into from

Commits on Oct 14, 2016

  1. Configuration menu
    Copy the full SHA
    938594d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5416f9c View commit details
    Browse the repository at this point in the history
  3. Implement shiftleft/shiftright by moving packet around

    Instead of memmoving a packet's data around this patch instead moves
    around the packet pointer itself.
    
    The only performance testing I did was "snabb lwaftr bench", where it
    appears to be neutral-to-slight-win.  I am hoping that the Hydra/R
    scientists can help me out on this one.
    
    This change to the packet structure does have a knock-on effect, in
    two significant ways.  One is that the shiftleft, shiftright, and
    prepend functions now return a new packet pointer and silently corrupt
    the old one (because probably they shifted around the data but still
    had to update the new "length" pointer).  That's somewhat OK though.
    
    The problem comes in the datagram library, which sometimes wants to
    work on a user-supplied packet.  The sequence was:
    
      local dgram = datagram:new(pkt)
      dgram:push(....)
      dgram:free()
      ...
      foo(pkt)
    
    This pattern is no longer valid :(  The reason is that the datagram
    methods that mutate a packet often do so by packet.prepend().  The
    datagram library updates its internal packet pointer, but the external
    one that was initially passed in is no longer valid.  So much of this
    patch is visiting (hopefully) all of the uses/users and updating them.
    wingo committed Oct 14, 2016
    Configuration menu
    Copy the full SHA
    71679a5 View commit details
    Browse the repository at this point in the history
  4. Add minimum packet alignment.

    wingo committed Oct 14, 2016
    Configuration menu
    Copy the full SHA
    c2097d2 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2016

  1. Add tests.

    wingo committed Oct 17, 2016
    Configuration menu
    Copy the full SHA
    93629e0 View commit details
    Browse the repository at this point in the history
  2. Fix allocate/new_packet mixup.

    wingo committed Oct 17, 2016
    Configuration menu
    Copy the full SHA
    12f77a3 View commit details
    Browse the repository at this point in the history