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

Insufficient condition in ff_rte_frm_extcl function #568

Closed
freak82 opened this issue Dec 18, 2020 · 1 comment
Closed

Insufficient condition in ff_rte_frm_extcl function #568

freak82 opened this issue Dec 18, 2020 · 1 comment

Comments

@freak82
Copy link

freak82 commented Dec 18, 2020

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.

@jfb8856606
Copy link
Contributor

You are right, i had modify it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants