summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_bridge.c
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2004-06-22 18:56:47 +0000
committergreen <green@FreeBSD.org>2004-06-22 18:56:47 +0000
commit5301d01cbad25fe6d254719c611d291061d4c50c (patch)
tree1886440f39a91e61cb71c6a58576ec9e44312415 /sys/netgraph/ng_bridge.c
parente2e28b4745de4a1bbbc197ef1f7f2ea0549f9d80 (diff)
downloadFreeBSD-src-5301d01cbad25fe6d254719c611d291061d4c50c.zip
FreeBSD-src-5301d01cbad25fe6d254719c611d291061d4c50c.tar.gz
Fix a problem with multiple-delivery (i.e. broadcast) in ng_bridge.
Only the first link0..link$NLINKS hooks would be utilized, whereas the link hooks may be connected sparsely. Add a counter variable so that the link hook array is only traversed while there is still work to do, but that it continues up to the end if it has to.
Diffstat (limited to 'sys/netgraph/ng_bridge.c')
-rw-r--r--sys/netgraph/ng_bridge.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
index 9830354..e9a6340 100644
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -517,7 +517,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
struct ng_bridge_host *host;
struct ng_bridge_link *link;
struct ether_header *eh;
- int error = 0, linkNum;
+ int error = 0, linkNum, linksSeen;
int manycast;
struct mbuf *m;
meta_p meta;
@@ -668,7 +668,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
/* Distribute unknown, multicast, broadcast pkts to all other links */
meta = NGI_META(item); /* peek.. */
firstLink = NULL;
- for (linkNum = 0; linkNum <= priv->numLinks; linkNum++) {
+ for (linkNum = linksSeen = 0; linksSeen <= priv->numLinks; linkNum++) {
struct ng_bridge_link *destLink;
meta_p meta2 = NULL;
struct mbuf *m2 = NULL;
@@ -677,7 +677,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
* If we have checked all the links then now
* send the original on its reserved link
*/
- if (linkNum == priv->numLinks) {
+ if (linksSeen == priv->numLinks) {
/* If we never saw a good link, leave. */
if (firstLink == NULL) {
NG_FREE_ITEM(item);
@@ -687,6 +687,8 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
destLink = firstLink;
} else {
destLink = priv->links[linkNum];
+ if (destLink != NULL)
+ linksSeen++;
/* Skip incoming link and disconnected links */
if (destLink == NULL || destLink == link) {
continue;
OpenPOWER on IntegriCloud