Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109311223
D28144.id82236.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
D28144.id82236.diff
View Options
Index: sys/netgraph/ng_bridge.c
===================================================================
--- sys/netgraph/ng_bridge.c
+++ sys/netgraph/ng_bridge.c
@@ -110,7 +110,7 @@
/* Per-link private data */
struct ng_bridge_link {
hook_p hook; /* netgraph hook */
- u_int16_t loopCount; /* loop ignore timer */
+ counter_u64_t loopCount; /* loop ignore timer */
struct ng_bridge_link_kernel_stats stats; /* link stats */
};
@@ -385,6 +385,7 @@
if (link == NULL)
return (ENOMEM);
+ link->loopCount = counter_u64_alloc(M_WAITOK);
link->stats.recvOctets = counter_u64_alloc(M_WAITOK);
link->stats.recvPackets = counter_u64_alloc(M_WAITOK);
link->stats.recvMulticasts = counter_u64_alloc(M_WAITOK);
@@ -436,7 +437,7 @@
{
link_p priv = NG_HOOK_PRIVATE(hook);
- priv->loopCount = 0;
+ counter_u64_zero(priv->loopCount);
ng_bridge_clear_link_stats(&priv->stats);
return (1);
}
@@ -761,7 +762,7 @@
}
/* Is link disabled due to a loopback condition? */
- if (ctx.incoming->loopCount != 0) {
+ if (counter_u64_fetch(ctx.incoming->loopCount) != 0) {
counter_u64_add(ctx.incoming->stats.loopDrops, 1);
NG_FREE_ITEM(item);
NG_FREE_M(ctx.m);
@@ -809,7 +810,8 @@
}
/* Mark link as linka non grata */
- ctx.incoming->loopCount = priv->conf.loopTimeout;
+ counter_u64_add(ctx.incoming->loopCount,
+ priv->conf.loopTimeout);
counter_u64_add(ctx.incoming->stats.loopDetects, 1);
/* Forget all hosts on this link */
@@ -926,6 +928,7 @@
ng_bridge_remove_hosts(priv, link);
/* Free associated link information */
+ counter_u64_free(link->loopCount);
counter_u64_free(link->stats.recvOctets);
counter_u64_free(link->stats.recvPackets);
counter_u64_free(link->stats.recvMulticasts);
@@ -1117,13 +1120,22 @@
node_p node = NG_HOOK_NODE(hook);
priv_p priv = NG_NODE_PRIVATE(node);
int *counter = arg;
-
- if (link->loopCount != 0) {
- link->loopCount--;
- if (link->loopCount == 0 && priv->conf.debugLevel >= 2) {
- log(LOG_INFO, "ng_bridge: %s:"
- " restoring looped back %s\n",
- ng_bridge_nodename(node), NG_HOOK_NAME(hook));
+ uint64_t loopCount = counter_u64_fetch(link->loopCount);
+
+ if (loopCount != 0) {
+ if (loopCount > priv->conf.loopTimeout) {
+ counter_u64_zero(link->loopCount);
+ counter_u64_add(link->loopCount,
+ priv->conf.loopTimeout);
+ } else if (loopCount > 2)
+ counter_u64_add(link->loopCount, -1);
+ else {
+ counter_u64_zero(link->loopCount);
+ if (priv->conf.debugLevel >= 2)
+ log(LOG_INFO, "ng_bridge: %s:"
+ " restoring looped back %s\n",
+ ng_bridge_nodename(node),
+ NG_HOOK_NAME(hook));
}
}
(*counter)++;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 4, 10:10 AM (18 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16451842
Default Alt Text
D28144.id82236.diff (2 KB)
Attached To
Mode
D28144: netgraph/ng_bridge: switch loopCount to counter framework
Attached
Detach File
Event Timeline
Log In to Comment