Applied debian/patches/004_mac_address_range_fix.patch from
authorMichael Brown <mcb30@etherboot.org>
Tue, 11 Mar 2008 00:28:34 +0000 (00:28 +0000)
committerMichael Brown <mcb30@etherboot.org>
Tue, 11 Mar 2008 00:28:34 +0000 (00:28 +0000)
http://ftp.de.debian.org/debian/pool/main/r/rpld/rpld_1.8beta1-8.diff.gz

client.c
rpld_conf.lex

index 6b14b6f..788f9da 100644 (file)
--- a/client.c
+++ b/client.c
@@ -156,7 +156,7 @@ cache_locally (struct clfile *f)
 struct client *
 find_client_by_mac (unsigned char *mac)
 {
 struct client *
 find_client_by_mac (unsigned char *mac)
 {
-  struct client *pc = NULL, *c = clients;
+  struct client *pc = NULL, *nc = NULL, *c = clients;
 
 /* We need to match clients by a (possibly partial) MAC address; however
  * this struct client is also used to transmit to them, so we need to return
 
 /* We need to match clients by a (possibly partial) MAC address; however
  * this struct client is also used to transmit to them, so we need to return
@@ -170,14 +170,17 @@ find_client_by_mac (unsigned char *mac)
           /* if partial match, create new struct client */
           if (c->partial_mac_len != ETH_ALEN)
             {
           /* if partial match, create new struct client */
           if (c->partial_mac_len != ETH_ALEN)
             {
-              pc = (struct client *) malloc (sizeof (struct client));
-              memcpy (pc, c, sizeof (struct client));
-
-              pc->next = c->next;
-              c->next = clients;
-              clients = c;
-
-              return pc;
+              nc = (struct client *) malloc (sizeof (struct client));
+              memcpy (nc, c, sizeof (struct client));
+              memcpy (nc->mac, mac, ETH_ALEN);
+
+             if (pc) 
+                  pc->next = nc;
+              else 
+                  clients = nc;
+             nc->next = c;
+             
+              return nc;
             }
 
           /* else reorder the tree for speed, and return the found client */
             }
 
           /* else reorder the tree for speed, and return the found client */
index a05ebb3..522fcb5 100644 (file)
@@ -125,9 +125,9 @@ hb  [0-9A-Fa-f][0-9A-Fa-f]
                                return MACADDR;
                        }
 
                                return MACADDR;
                        }
 
-{hb}:{hb}:{hb}:{hb}:{hb}:{hb}/[1-6]    {
+{hb}:{hb}:{hb}:{hb}:{hb}:{hb}\/[1-6]   {
                                strtomac(yytext, (yylval.pm.mac_address));
                                strtomac(yytext, (yylval.pm.mac_address));
-                               yylval.pm.mac_len = yytext[13] - '0';
+                               yylval.pm.mac_len = 6 - (yytext[18] - '0');
                                return MACADDR_PARTIAL;
                        }
 
                                return MACADDR_PARTIAL;
                        }