Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107066676
D30008.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D30008.diff
View Options
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -663,22 +663,28 @@
else
NG_SEND_DATA_ONLY(error, dst->hook, m);
- if (error == 0) {
- counter_u64_add(dst->stats.xmitPackets, 1);
- counter_u64_add(dst->stats.xmitOctets, len);
- switch (manycast) {
- default: /* unknown unicast */
- break;
- case 1: /* multicast */
- counter_u64_add(dst->stats.xmitMulticasts, 1);
- break;
- case 2: /* broadcast */
- counter_u64_add(dst->stats.xmitBroadcasts, 1);
- break;
- }
+ if (error) {
+ /* The packet is still ours */
+ if (item != NULL)
+ NG_FREE_ITEM(item);
+ if (m != NULL)
+ NG_FREE_M(m);
+ return (error);
}
- return (error);
+ counter_u64_add(dst->stats.xmitPackets, 1);
+ counter_u64_add(dst->stats.xmitOctets, len);
+ switch (manycast) {
+ default: /* unknown unicast */
+ break;
+ case 1: /* multicast */
+ counter_u64_add(dst->stats.xmitMulticasts, 1);
+ break;
+ case 2: /* broadcast */
+ counter_u64_add(dst->stats.xmitBroadcasts, 1);
+ break;
+ }
+ return (0);
}
/*
@@ -716,16 +722,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);
}
@@ -859,18 +865,17 @@
/* 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) {
+ /* 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;
+ } else { /* nothing to send at all */
NG_FREE_ITEM(item);
NG_FREE_M(ctx.m);
- return (ctx.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
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 10, 2:22 PM (14 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15743307
Default Alt Text
D30008.diff (2 KB)
Attached To
Mode
D30008: netgraph/ng_bridge: Handle send errors during loop processing
Attached
Detach File
Event Timeline
Log In to Comment