Skip to content

Insufficient condition in ff_rte_frm_extcl function #568

@freak82

Description

@freak82

Hi there,

I think the if-condition in the function ff_rte_frm_extcl needs to be changed from this
if ( bsd_mbuf->m_ext.ext_type==EXT_DISPOSABLE && bsd_mbuf->m_ext.ext_free==ff_mbuf_ext_free )
to this
if ( (bsd_mbuf->m_flags & M_EXT) && bsd_mbuf->m_ext.ext_type==EXT_DISPOSABLE && bsd_mbuf->m_ext.ext_free==ff_mbuf_ext_free ).

I just hit the following case:

  1. There was external storage attached to a BSD mbuf (input packet).
  2. Then this mbuf was freed and returned back to the BSD mbuf pools.
  3. The BSD stack needed mbuf for an output packet, allocated one and got the mbuf from point 2.
  4. Now if I give this packet to the ff_rte_frm_extcl it'll return wrong non NULL result because the BSD stack just leave the external storage as it is unless functions like m_extadd or m_extaddref are used.

Also in the freebsd/sys/mbuf.h you can see the comment above struct m_ext
Description of external storage mapped into mbuf; valid only if M_EXT is set and all BSD functions which read from the m_ext are guarded with checks or assertions if this flag is set.

I just use the F-stack not as a server but as a mixed L3-L4 proxy and noticed that this function returns wrong results for the output packets. I use it because it allows me to skip allocation of rte_pktmbuf for an output packet if this packet is being L3 forwarded because it already has rte_pktmbuf attached on input.

Regards,
Pavel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions