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)
Oct 29 2024, 3:43 PM
Unknown Object (File)
Oct 28 2024, 9:13 PM
Unknown Object (File)
Sep 16 2024, 3:39 AM
Unknown Object (File)
Sep 5 2024, 8:22 AM
Unknown Object (File)
Sep 4 2024, 7:49 AM
Unknown Object (File)
Sep 4 2024, 7:49 AM
Unknown Object (File)
Sep 4 2024, 7:49 AM
Unknown Object (File)
Sep 4 2024, 7:45 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.