]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: drop heuristic IPv6 address recognition
authorRoman Hoog Antink <rha@open.ch>
Wed, 9 May 2012 06:35:34 +0000 (06:35 +0000)
committerDavid Lamparter <equinox@diac24.net>
Mon, 21 May 2012 13:41:14 +0000 (15:41 +0200)
* command.c: (cmd_ipv6_match) Drop IPv6 address recognition
  heuristics and solely rely on inet_pton, because strings
  like "abcd" were mistaken for IPv6 addresses.
  This affects e.g. the command "neighbour WORD peer-group",
  which won't work with words consisting of up to 4 characters
  between 'a' and 'f' and digits.

From: Roman Hoog Antink <rha@open.ch>
[full delete instead of #if 0]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/command.c

index e62a7a7e6ec8f30594af07aa73a2be3f8fb98e0d..4d95e924d73f4685555cb5d25e0e48b3e1e2acf0 100644 (file)
@@ -868,86 +868,7 @@ cmd_ipv6_match (const char *str)
   if (ret == 1)
     return exact_match;
 
-  while (*str != '\0')
-    {
-      switch (state)
-       {
-       case STATE_START:
-         if (*str == ':')
-           {
-             if (*(str + 1) != ':' && *(str + 1) != '\0')
-               return no_match;
-             colons--;
-             state = STATE_COLON;
-           }
-         else
-           {
-             sp = str;
-             state = STATE_ADDR;
-           }
-
-         continue;
-       case STATE_COLON:
-         colons++;
-         if (*(str + 1) == ':')
-           state = STATE_DOUBLE;
-         else
-           {
-             sp = str + 1;
-             state = STATE_ADDR;
-           }
-         break;
-       case STATE_DOUBLE:
-         if (double_colon)
-           return no_match;
-
-         if (*(str + 1) == ':')
-           return no_match;
-         else
-           {
-             if (*(str + 1) != '\0')
-               colons++;
-             sp = str + 1;
-             state = STATE_ADDR;
-           }
-
-         double_colon++;
-         nums++;
-         break;
-       case STATE_ADDR:
-         if (*(str + 1) == ':' || *(str + 1) == '\0')
-           {
-             if (str - sp > 3)
-               return no_match;
-
-             nums++;
-             state = STATE_COLON;
-           }
-         if (*(str + 1) == '.')
-           state = STATE_DOT;
-         break;
-       case STATE_DOT:
-         state = STATE_ADDR;
-         break;
-       default:
-         break;
-       }
-
-      if (nums > 8)
-       return no_match;
-
-      if (colons > 7)
-       return no_match;
-
-      str++;
-    }
-
-#if 0
-  if (nums < 11)
-    return partly_match;
-#endif /* 0 */
-
-  return exact_match;
+  return no_match;
 }
 
 static enum match_type