70 lines
2.5 KiB
Diff
70 lines
2.5 KiB
Diff
From 65f75f485f428b0f22ff82c96ebd7d89e49ce7b2 Mon Sep 17 00:00:00 2001
|
|
From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
|
|
Date: Mon, 20 Oct 2008 14:50:37 +0900
|
|
Subject: [PATCH] Fix for IPv6 Interface Table
|
|
|
|
From net-snmp patch tracker:
|
|
[ 1669048 ] Support ipv6InterfaceIdentifier on Linux
|
|
http://sourceforge.net/tracker/index.php?func=detail&aid=1669048&group_id=12694&atid=312694
|
|
|
|
[ 1783423 ] correct ipv6InterfaceIdentifier of loopback device
|
|
http://sourceforge.net/tracker/index.php?func=detail&aid=1783423&group_id=12694&atid=312694
|
|
|
|
Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
|
|
---
|
|
.../mibgroup/if-mib/data_access/interface_linux.c | 31 ++++++++++++++++++++
|
|
1 files changed, 31 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c
|
|
index 245fa99..474a904 100644
|
|
--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
|
|
+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
|
|
@@ -36,6 +36,7 @@ typedef __u8 u8; /* ditto */
|
|
#include <unistd.h>
|
|
|
|
#include <linux/sockios.h>
|
|
+#include <linux/if_ether.h>
|
|
|
|
#ifndef IF_NAMESIZE
|
|
#define IF_NAMESIZE 16
|
|
@@ -635,6 +636,36 @@ netsnmp_arch_interface_container_load(netsnmp_container* container,
|
|
entry->type = IANAIFTYPE_OTHER;
|
|
}
|
|
|
|
+ /*
|
|
+ * interface identifier is specified based on physaddr and type
|
|
+ */
|
|
+ switch (entry->type) {
|
|
+ case IANAIFTYPE_ETHERNETCSMACD:
|
|
+ case IANAIFTYPE_ETHERNET3MBIT:
|
|
+ case IANAIFTYPE_FASTETHER:
|
|
+ case IANAIFTYPE_FASTETHERFX:
|
|
+ case IANAIFTYPE_GIGABITETHERNET:
|
|
+ case IANAIFTYPE_FDDI:
|
|
+ case IANAIFTYPE_ISO88025TOKENRING:
|
|
+ if (NULL != entry->paddr && ETH_ALEN != entry->paddr_len)
|
|
+ break;
|
|
+
|
|
+ entry->v6_if_id_len = entry->paddr_len + 2;
|
|
+ memcpy(entry->v6_if_id, entry->paddr, 3);
|
|
+ memcpy(entry->v6_if_id + 5, entry->paddr + 3, 3);
|
|
+ entry->v6_if_id[0] ^= 2;
|
|
+ entry->v6_if_id[3] = 0xFF;
|
|
+ entry->v6_if_id[4] = 0xFE;
|
|
+
|
|
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID;
|
|
+ break;
|
|
+
|
|
+ case IANAIFTYPE_SOFTWARELOOPBACK:
|
|
+ entry->v6_if_id_len = 0;
|
|
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID;
|
|
+ break;
|
|
+ }
|
|
+
|
|
if (IANAIFTYPE_ETHERNETCSMACD == entry->type)
|
|
entry->speed =
|
|
netsnmp_linux_interface_get_if_speed(fd, entry->name);
|
|
--
|
|
1.6.0.2
|
|
|