Page MenuHomeFreeBSD

Enabling Dummynet AQM for layer2 bridged traffic
ClosedPublic

Authored by ralsaadi_swin.edu.au on Sep 26 2017, 1:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 20 2024, 9:27 AM
Unknown Object (File)
Jan 26 2024, 10:15 PM
Unknown Object (File)
Jan 11 2024, 9:45 PM
Unknown Object (File)
Dec 23 2023, 10:57 AM
Unknown Object (File)
Dec 5 2023, 4:25 PM
Unknown Object (File)
Dec 4 2023, 5:47 PM
Unknown Object (File)
Oct 10 2023, 8:15 PM
Unknown Object (File)
Oct 5 2023, 11:50 AM
Subscribers

Details

Summary

Dummynet AQM packet marking function ecn_mark() and fq_codel/fq_pie schedulers packet classification functions (fq_codel_classify_flow() and fq_pie_classify_flow()) assume mbuf is pointing at L3 (IP) packet. However, this assumption is incorrect if ipfw/dummynet is used to manage layer2 traffic (bridge mode) since mbuf will point at L2 frame.
This patch solves this problem by identifying the source of the frame/packet (L2 or L3) and adding ETHER_HDR_LEN offset when converting an mbuf pointer to ip pointer if the traffic is from layer2.
More specifically, in dummynet packet tagging function, tag_mbuf(), iphdr_off is set to ETHER_HDR_LEN if the traffic is from layer2 and set to zero otherwise. Whenever an access to IP header is required, mtodo(m, dn_tag_get(m)->iphdr_off) is used instead of mtod(m, struct ip *) to correctly convert mbuf pointer to ip pointer in both L2 and L3 traffic.

The bug was identified by Grenville Armitage
The problem was identified and the patch was written by lstewart (Lawrence Stewart)

Test Plan

The patch has been tested in both gateway (L3) and bridge (L2) modes without problems.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

There us a similar problem when doing tunneling. For instance, I have to use a gif tunnel that encapsulates IPv6 packets inside IPv4 packets that are sent to a remote 6rd gateway in order to get IPv6 connectivity to the outside world. It would be nice to have the option of peering into these encapsulated packets to see the individual flows. Care would have to be taken to make sure that we don't walk off the end of the mbuf when doing this.

I'm currently doing a "make universe" run to test this patch as-is.

The changes looks good.

No fallout from "make universe".

This revision is now accepted and ready to land.Oct 26 2017, 9:33 AM
This revision was automatically updated to reflect the committed changes.