Set the node configuration. This command takes a "struct ng_bridge_config" as an argument:
/* Node configuration structure */
struct ng_bridge_config {
u_char ipfw[NG_BRIDGE_MAX_LINKS]; /* enable ipfw */
u_char debugLevel; /* debug level */
u_int32_t loopTimeout;/* link loopback mute time */
u_int32_t maxStaleness; /* max host age before nuking */
u_int32_t minStableAge; /* min time for a stable host */
};
The ipfw array enables ipfirewall(4) processing of IP packets received on the corresponding links. The debugLevel field sets the debug level on the node. At level of 2 or greater, detected loops are logged. The default level is 1.
The loopTimeout determines how long (in seconds) a looped link is muted. The default is 60 seconds. The maxStaleness parameter determines how long a period of inactivity before a hosts entry is forgotten. The default is 15 minutes. The minStableAge determines how quickly a host must jump from one link to another before we declare a loopback condition. The default is one second.
NGM_BRIDGE_GET_CONFIG
Returns the current configuration as a "struct ng_bridge_config".
NGM_BRIDGE_RESET
Causes the node to forget all hosts and unmute all links. The node configuration is not changed.
NGM_BRIDGE_GET_STATS
This command takes a four byte link number as an argument and returns a "struct ng_bridge_link_stats" containing statistics for the corresponding link, which must be currently connected:
/* Statistics structure (one for each link) */
struct ng_bridge_link_stats {
u_int64_t recvOctets;/* total octets recd on link */
u_int64_t recvPackets; /* total pkts recd on link */
u_int64_t recvMulticasts; /* multicast pkts recd on link */
u_int64_t recvBroadcasts; /* broadcast pkts recd on link */
u_int64_t recvUnknown; /* pkts recd with unknown dest addr */
u_int64_t recvRunts; /* pkts recd less than 14 bytes */
u_int64_t recvInvalid; /* pkts recd with bogus source addr */
u_int64_t xmitOctets;/* total octets xmitd on link */
u_int64_t xmitPackets; /* total pkts xmitd on link */
u_int64_t xmitMulticasts; /* multicast pkts xmitd on link */
u_int64_t xmitBroadcasts; /* broadcast pkts xmitd on link */
u_int64_t loopDrops; /* pkts dropped due to loopback */
u_int64_t loopDetects; /* number of loop detections */
u_int64_t memoryFailures; /* times couldnt get mem or mbuf */
};
NGM_BRIDGE_CLR_STATS
This command takes a four byte link number as an argument and clears the statistics for that link.
NGM_BRIDGE_GETCLR_STATS
Same as NGM_BRIDGE_GET_STATS, but also atomically clears the statistics as well.
NGM_BRIDGE_GET_TABLE
Returns the current host mapping table used to direct packets, in a "struct ng_bridge_host_ary".