Page MenuHomeFreeBSD

D30008.id88243.diff
No OneTemporary

D30008.id88243.diff

Index: sys/netgraph/ng_bridge.c
===================================================================
--- sys/netgraph/ng_bridge.c
+++ sys/netgraph/ng_bridge.c
@@ -652,6 +652,12 @@
counter_u64_add(dst->stats.xmitBroadcasts, 1);
break;
}
+ } else {
+ /* On error, the packet is still ours */
+ if (item != NULL)
+ NG_FREE_ITEM(item);
+ if (m != NULL)
+ NG_FREE_M(m);
}
return (error);
@@ -692,16 +698,16 @@
* It's usable link but not the reserved (first) one.
* Copy mbuf info for sending.
*/
- m2 = m_dup(ctx->m, M_NOWAIT); /* XXX m_copypacket() */
+ m2 = m_dup(ctx->m, M_NOWAIT);
if (m2 == NULL) {
counter_u64_add(ctx->incoming->stats.memoryFailures, 1);
ctx->error = ENOBUFS;
- return (0); /* abort loop */
+ return (0); /* abort loop, do not try again and again */
}
/* Send packet */
error = ng_bridge_send_data(destLink, ctx->manycast, m2, NULL);
- if(error)
+ if (error)
ctx->error = error;
return (1);
}
@@ -851,18 +857,14 @@
/* Distribute unknown, multicast, broadcast pkts to all other links */
NG_NODE_FOREACH_HOOK(node, ng_bridge_send_ctx, &ctx, ret);
- /* If we never saw a good link, leave. */
- if (ctx.foundFirst == NULL || ctx.error != 0) {
- NG_FREE_ITEM(item);
- NG_FREE_M(ctx.m);
- return (ctx.error);
+ /* Finally send out on the first link found */
+ if (ctx.foundFirst != NULL) {
+ int error = ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item);
+ if (error)
+ ctx.error = error;
}
- /*
- * If we've sent all the others, send the original
- * on the first link we found.
- */
- return (ng_bridge_send_data(ctx.foundFirst, ctx.manycast, ctx.m, item));
+ return (ctx.error);
}
/*

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 13, 11:21 AM (10 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25254762
Default Alt Text
D30008.id88243.diff (1 KB)

Event Timeline