Bug 255430 - ng_bridge don't sends broadcast packet to first found link in case of error in other links
Summary: ng_bridge don't sends broadcast packet to first found link in case of error i...
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Lutz Donnerhacke
URL: https://reviews.freebsd.org/D30008
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-26 19:28 UTC by Dancho Penev
Modified: 2021-05-14 00:21 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments
ng_bridge.c patch (1.01 KB, text/plain)
2021-04-26 19:28 UTC, Dancho Penev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dancho Penev 2021-04-26 19:28:01 UTC
Created attachment 224454 [details]
ng_bridge.c patch

When for some reason (including legitimate) sending manycast (in my case DHCP reply broadcast) packet to one of multiple links of ng_bridge fails (for example eiface is administratively brought down) the original packet isn't send via first found link. This makes no sense for me as other links are tolerated for errors. Attached patch changes this behavior as send the packet to all links and keeps the logic to return the last seen error.
Comment 1 Lutz Donnerhacke freebsd_committer 2021-04-27 08:01:31 UTC
Thank you for pointing out this issue.

I chosed a different and more general solution.
May you please check this patch?
https://reviews.freebsd.org/D30008
Comment 2 Dancho Penev 2021-04-27 17:45:41 UTC
I don't see any change in patch semantics, it's just rephrasing so it should works. Will provide feedback when have time to test your patch.
Comment 3 Dancho Penev 2021-04-29 13:11:46 UTC
Made some basic testing with the new patch, no issues were observed so far.
Comment 4 Lutz Donnerhacke freebsd_committer 2021-04-30 16:16:42 UTC
I'll wait for reviews from others before commiting it.
Comment 5 commit-hook freebsd_committer 2021-05-13 19:51:59 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=a56e5ad6903037861457da754574b4903dcb0e7e

commit a56e5ad6903037861457da754574b4903dcb0e7e
Author:     Lutz Donnerhacke <donner@FreeBSD.org>
AuthorDate: 2021-04-27 07:49:50 +0000
Commit:     Lutz Donnerhacke <donner@FreeBSD.org>
CommitDate: 2021-05-13 19:49:20 +0000

    netgraph/ng_bridge: Handle send errors during loop handling

    If sending out a packet fails during the loop over all links, the
    allocated memory is leaked and not all links receive a copy.  This
    patch fixes those problems, clarifies a premature abort of the loop,
    and fixes a minory style(9) bug.

    PR:             255430
    Submitted by:   Dancho Penev
    Tested by:      Dancho Penev
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D30008

 sys/netgraph/ng_bridge.c | 55 ++++++++++++++++++++++++++----------------------
 1 file changed, 30 insertions(+), 25 deletions(-)
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2021-05-14 00:21:21 UTC
^Triage: Re-open pending MFC