Re: [PATCH libnetfilter_queue 0/3] pktbuff API updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 30, 2020 at 05:10:47AM +1000, Duncan Roe wrote:
[...]
> Sorry, I should have explained a bit more how the system would work:
> 
> struct pkt_buff has 3 new members:
> 
>         bool    copy_done;
>         uint32_t extra;
>         uint8_t *copy_buf;
> 
> When extra > 0, pktb_alloc2 verifies that buflen is >= len + extra. It then
> stores extra and copy_buf in pktb, ready for use by pktb_mangle() (all the other
> manglers call this eventually).
> 
> So that's how pktb_mangle() doesn't need to allocate a buffer.

Thanks for the explaining. Given this is in userspace, it is easier if
the user allocates the maximum packet length that is possible:

        0xffff + (MNL_SOCKET_BUFFER_SIZE/2);

We can probably expose this to the header so they can pre-allocate a
buffer that is large enough and, hence, _mangle() is guaranteed to
have always enough room to add extra bytes.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux