Lines Matching full:link
42 * algorithm is included which disables a link for priv->conf.loopTimeout
43 * seconds when a host is seen to have jumped from one link to
48 * tell us on which link the host may be found. A host's entry will
89 counter_u64_t recvOctets; /* total octets rec'd on link */
90 counter_u64_t recvPackets; /* total pkts rec'd on link */
91 counter_u64_t recvMulticasts; /* multicast pkts rec'd on link */
92 counter_u64_t recvBroadcasts; /* broadcast pkts rec'd on link */
96 counter_u64_t xmitOctets; /* total octets xmit'd on link */
97 counter_u64_t xmitPackets; /* total pkts xmit'd on link */
98 counter_u64_t xmitMulticasts; /* multicast pkts xmit'd on link */
99 counter_u64_t xmitBroadcasts; /* broadcast pkts xmit'd on link */
105 /* Per-link private data */
111 struct ng_bridge_link_kernel_stats stats; /* link stats */
127 struct unrhdr *linkUnit; /* link unit number allocator */
136 link_p link; /* link where addr can be found */ member
145 /* [up]link prefix matching */
170 static void ng_bridge_free_link(link_p link);
172 static int ng_bridge_put(priv_p priv, const u_char *addr, link_p link);
174 static void ng_bridge_remove_hosts(priv_p priv, link_p link);
389 link_p link; in ng_bridge_newhook() local
428 link = malloc(sizeof(*link), M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO); in ng_bridge_newhook()
429 if (link == NULL) { in ng_bridge_newhook()
435 link->stats.f = counter_u64_alloc(M_NOWAIT); \ in ng_bridge_newhook()
436 if (link->stats.f == NULL) \ in ng_bridge_newhook()
454 link->hook = hook; in ng_bridge_newhook()
456 link->learnMac = 0; in ng_bridge_newhook()
457 link->sendUnknown = 1; in ng_bridge_newhook()
458 if (priv->numLinks == 0) /* if the first link is an uplink */ in ng_bridge_newhook()
461 link->learnMac = 1; in ng_bridge_newhook()
462 link->sendUnknown = priv->sendUnknown; in ng_bridge_newhook()
465 NG_HOOK_SET_PRIVATE(hook, link); in ng_bridge_newhook()
471 ng_bridge_free_link(link); in ng_bridge_newhook()
498 ng_bridge_free_link(link_p link) in ng_bridge_free_link() argument
500 counter_u64_free(link->stats.recvOctets); in ng_bridge_free_link()
501 counter_u64_free(link->stats.recvPackets); in ng_bridge_free_link()
502 counter_u64_free(link->stats.recvMulticasts); in ng_bridge_free_link()
503 counter_u64_free(link->stats.recvBroadcasts); in ng_bridge_free_link()
504 counter_u64_free(link->stats.recvUnknown); in ng_bridge_free_link()
505 counter_u64_free(link->stats.recvRunts); in ng_bridge_free_link()
506 counter_u64_free(link->stats.recvInvalid); in ng_bridge_free_link()
507 counter_u64_free(link->stats.xmitOctets); in ng_bridge_free_link()
508 counter_u64_free(link->stats.xmitPackets); in ng_bridge_free_link()
509 counter_u64_free(link->stats.xmitMulticasts); in ng_bridge_free_link()
510 counter_u64_free(link->stats.xmitBroadcasts); in ng_bridge_free_link()
511 counter_u64_free(link->stats.loopDrops); in ng_bridge_free_link()
512 counter_u64_free(link->stats.memoryFailures); in ng_bridge_free_link()
513 free(link, M_NETGRAPH_BRIDGE); in ng_bridge_free_link()
579 link_p link; in ng_bridge_rcvmsg() local
583 /* Get link number */ in ng_bridge_rcvmsg()
600 link = NG_HOOK_PRIVATE(hook); in ng_bridge_rcvmsg()
607 sizeof(link->stats), M_NOWAIT); in ng_bridge_rcvmsg()
613 #define FETCH(x) rs->x = counter_u64_fetch(link->stats.x) in ng_bridge_rcvmsg()
626 rs->loopDetects = link->stats.loopDetects; in ng_bridge_rcvmsg()
631 ng_bridge_clear_link_stats(&link->stats); in ng_bridge_rcvmsg()
656 NG_HOOK_NAME(host->link->hook), in ng_bridge_rcvmsg()
764 /* Skip incoming link */ in ng_bridge_send_ctx()
775 * This is the first usable link we have found. in ng_bridge_send_ctx()
784 * It's usable link but not the reserved (first) one. in ng_bridge_send_ctx()
833 /* Is link disabled due to a loopback condition? */ in ng_bridge_rcvdata()
862 (host != NULL && host->link != ctx.incoming)) { in ng_bridge_rcvdata()
885 if (host != NULL && host->link != ctx.incoming) { in ng_bridge_rcvdata()
896 * If unicast and destination host known, deliver to host's link, in ng_bridge_rcvdata()
897 * unless it is the same link as the packet came in on. in ng_bridge_rcvdata()
900 /* Determine packet destination link */ in ng_bridge_rcvdata()
902 link_p destLink = host->link; in ng_bridge_rcvdata()
904 /* If destination same as incoming link, do nothing */ in ng_bridge_rcvdata()
911 /* Deliver packet out the destination link */ in ng_bridge_rcvdata()
922 /* Finally send out on the first link found */ in ng_bridge_rcvdata()
971 link_p link = NG_HOOK_PRIVATE(hook); in ng_bridge_disconnect() local
975 /* Remove all hosts associated with this link */ in ng_bridge_disconnect()
976 ng_bridge_remove_hosts(priv, link); in ng_bridge_disconnect()
978 /* Free associated link information */ in ng_bridge_disconnect()
979 ng_bridge_free_link(link); in ng_bridge_disconnect()
1023 * to the new link. Returns 0 on success.
1026 ng_bridge_put(priv_p priv, const u_char *addr, link_p link) in ng_bridge_put() argument
1032 /* Host already on the correct link? */ in ng_bridge_put()
1033 if (host->link == link) in ng_bridge_put()
1036 /* Move old host over to new link */ in ng_bridge_put()
1038 host->link = link; in ng_bridge_put()
1043 * If the host was recently moved to the old link and in ng_bridge_put()
1044 * it's now jumping to a new link, declare a loopback in ng_bridge_put()
1051 NG_HOOK_NAME(link->hook)); in ng_bridge_put()
1053 /* Mark link as linka non grata */ in ng_bridge_put()
1054 link->loopCount = priv->conf.loopTimeout; in ng_bridge_put()
1055 link->stats.loopDetects++; in ng_bridge_put()
1057 /* Forget all hosts on this link */ in ng_bridge_put()
1058 ng_bridge_remove_hosts(priv, link); in ng_bridge_put()
1067 host->link = link; in ng_bridge_put()
1157 * Remove all hosts associated with a specific link from the hashtable.
1161 ng_bridge_remove_hosts(priv_p priv, link_p link) in ng_bridge_remove_hosts() argument
1171 if (link == NULL || host->link == link) { in ng_bridge_remove_hosts()
1183 * we decrement link->loopCount for those links being muted due to
1190 link_p link = NG_HOOK_PRIVATE(hook); in ng_bridge_unmute() local
1195 if (link->loopCount != 0) { in ng_bridge_unmute()
1196 link->loopCount--; in ng_bridge_unmute()
1197 if (link->loopCount == 0 && priv->conf.debugLevel >= 2) { in ng_bridge_unmute()