if the manuf address could not be resolved, strip off special bits (multicast, locall...
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 14 Aug 2007 23:52:51 +0000 (23:52 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 14 Aug 2007 23:52:51 +0000 (23:52 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22503 f5534014-38df-0310-8fa8-9805f1628bb7

epan/addr_resolv.c

index e97e84ed68b1155a0165039ccce6039c4c97b472..ee315a9ba9d259f770517e8d80b960b254ee7125 100644 (file)
@@ -1110,11 +1110,12 @@ static hashmanuf_t *manuf_name_lookup(const guint8 *addr)
 {
   int hash_idx;
   hashmanuf_t *tp;
+  guint8 stripped_addr[3];
 
   hash_idx = HASH_ETH_MANUF(addr);
 
+  /* first try to find a "perfect match" */
   tp = manuf_table[hash_idx];
-
   while(tp != NULL) {
     if (memcmp(tp->addr, addr, sizeof(tp->addr)) == 0) {
       return tp;
@@ -1122,6 +1123,21 @@ static hashmanuf_t *manuf_name_lookup(const guint8 *addr)
     tp = tp->next;
   }
 
+  /* strip off special bits and try again to find the name */
+  /* the first address byte contains two special bits: */
+  /* 0x01 multicast / broadcast bit */
+  /* 0x02 locally administered bit */
+  memcpy(stripped_addr, addr, 3);
+  stripped_addr[0] &= 0xFC;
+
+  tp = manuf_table[hash_idx];
+  while(tp != NULL) {
+    if (memcmp(tp->addr, stripped_addr, sizeof(tp->addr)) == 0) {
+      return tp;
+    }
+    tp = tp->next;
+  }
+
   return NULL;
 
 } /* manuf_name_lookup */