svn commit: r252157 - stable/9/contrib/bsnmp/snmp_mibII
Gleb Smirnoff
glebius at FreeBSD.org
Mon Jun 24 09:53:43 UTC 2013
Author: glebius
Date: Mon Jun 24 09:53:43 2013
New Revision: 252157
URL: http://svnweb.freebsd.org/changeset/base/252157
Log:
Merge r249896:
Restore the ipNetToMedia MIB, that was broken with new ARP commit
in the r186119.
Submitted by: Konstantin Kukushkin <dark rambler-co.ru>
Modified:
stable/9/contrib/bsnmp/snmp_mibII/mibII.c
Directory Properties:
stable/9/contrib/bsnmp/snmp_mibII/ (props changed)
Modified: stable/9/contrib/bsnmp/snmp_mibII/mibII.c
==============================================================================
--- stable/9/contrib/bsnmp/snmp_mibII/mibII.c Mon Jun 24 09:39:06 2013 (r252156)
+++ stable/9/contrib/bsnmp/snmp_mibII/mibII.c Mon Jun 24 09:53:43 2013 (r252157)
@@ -934,6 +934,34 @@ mib_find_ifa(struct in_addr addr)
}
/*
+ * Process a new ARP entry
+ */
+static void
+process_arp(const struct rt_msghdr *rtm, const struct sockaddr_dl *sdl,
+ const struct sockaddr_in *sa)
+{
+ struct mibif *ifp;
+ struct mibarp *at;
+
+ /* IP arp table entry */
+ if (sdl->sdl_alen == 0)
+ return;
+ if ((ifp = mib_find_if_sys(sdl->sdl_index)) == NULL)
+ return;
+ /* have a valid entry */
+ if ((at = mib_find_arp(ifp, sa->sin_addr)) == NULL &&
+ (at = mib_arp_create(ifp, sa->sin_addr,
+ sdl->sdl_data + sdl->sdl_nlen, sdl->sdl_alen)) == NULL)
+ return;
+
+ if (rtm->rtm_rmx.rmx_expire == 0)
+ at->flags |= MIBARP_PERM;
+ else
+ at->flags &= ~MIBARP_PERM;
+ at->flags |= MIBARP_FOUND;
+}
+
+/*
* Handle a routing socket message.
*/
static void
@@ -1075,6 +1103,23 @@ handle_rtmsg(struct rt_msghdr *rtm)
#endif
case RTM_GET:
case RTM_ADD:
+ mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
+ if (rtm->rtm_flags & RTF_LLINFO) {
+ if (addrs[RTAX_DST] == NULL ||
+ addrs[RTAX_GATEWAY] == NULL ||
+ addrs[RTAX_DST]->sa_family != AF_INET ||
+ addrs[RTAX_GATEWAY]->sa_family != AF_LINK)
+ break;
+ process_arp(rtm,
+ (struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY],
+ (struct sockaddr_in *)(void *)addrs[RTAX_DST]);
+ } else {
+ if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP))
+ mib_sroute_process(rtm, addrs[RTAX_GATEWAY],
+ addrs[RTAX_DST], addrs[RTAX_NETMASK]);
+ }
+ break;
+
case RTM_DELETE:
mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
More information about the svn-src-stable-9
mailing list