• Phil Sutter's avatar
    tc: pedit: Fix for big-endian systems · 77bed404
    Phil Sutter authored
    This was tricky to get right:
    - The 'stride' value used for 8 and 16 bit values must behave inverse to
      the value's intra word offset to work correctly with big-endian data
      act_pedit is editing.
    - The 'm' array's values are in host byte order, so they have to be
      converted as well (and the ordering was just inverse, for some
      reason).
    - The only sane way of getting this right is to manipulate value/mask in
      host byte order and convert the output.
    - TIPV4 (i.e. 'munge ip src/dst') had it's own pitfall: the address
      parser converts to network byte order automatically. This patch fixes
      this by converting it back before calling pack_key32, which is a hack
      but at least does not require to implement a completely separate code
      flow.
    Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
    Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
    77bed404
m_pedit.c 11.6 KB