diff options
author | harti <harti@FreeBSD.org> | 2006-02-10 16:49:49 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2006-02-10 16:49:49 +0000 |
commit | af0ed09791e779050efb210d9304ae1e7100c129 (patch) | |
tree | 4fe9e3d15aac8c790ccdb33e7552bcedc8ffbbf1 /contrib | |
parent | d548c36029e34bef752ca1dee9ebf934815ff4c7 (diff) | |
download | FreeBSD-src-af0ed09791e779050efb210d9304ae1e7100c129.zip FreeBSD-src-af0ed09791e779050efb210d9304ae1e7100c129.tar.gz |
Vendor patch: Make the link traps more RFC-conform.
Submitted by: glebius
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/bsnmp/snmp_mibII/mibII.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/contrib/bsnmp/snmp_mibII/mibII.c b/contrib/bsnmp/snmp_mibII/mibII.c index aa5cb83..98a16d4 100644 --- a/contrib/bsnmp/snmp_mibII/mibII.c +++ b/contrib/bsnmp/snmp_mibII/mibII.c @@ -306,15 +306,17 @@ mib_fetch_ifmib(struct mibif *ifp) return (-1); } - if (ifp->trap_enable) { - if (!(oldmib.ifmd_flags & IFF_UP)) { - if (ifp->mib.ifmd_flags & IFF_UP) - link_trap(ifp, 1); - } else { - if (!(ifp->mib.ifmd_flags & IFF_UP)) - link_trap(ifp, 0); - } - } + /* + * Quoting RFC2863, 3.1.15: "... LinkUp and linkDown traps are + * generated just after ifOperStatus leaves, or just before it + * enters, the down state, respectively;" + */ + if (ifp->trap_enable && ifp->mib.ifmd_data.ifi_link_state != + oldmib.ifmd_data.ifi_link_state && + (ifp->mib.ifmd_data.ifi_link_state == LINK_STATE_DOWN || + oldmib.ifmd_data.ifi_link_state == LINK_STATE_DOWN)) + link_trap(ifp, ifp->mib.ifmd_data.ifi_link_state == + LINK_STATE_UP ? 1 : 0); ifp->flags &= ~(MIBIF_HIGHSPEED | MIBIF_VERYHIGHSPEED); if (ifp->mib.ifmd_data.ifi_baudrate > 20000000) { @@ -625,6 +627,7 @@ mibif_create(u_int sysindex, const char *name) ifp->counter_disc = get_ticks(); } ifp->index = map->ifindex; + ifp->mib.ifmd_data.ifi_link_state = LINK_STATE_UNKNOWN; INSERT_OBJECT_INT(ifp, &mibif_list); mib_if_number++; |