ip_count++;\r
}\r
\r
-struct IP *lastIP6;\r
+struct IP *lastIP6range, *lastIP6uplink;\r
\r
/* == This function strips extra characters after IPv4 address and stores it = */\r
void parse_and_append_ip(char *str, struct IP *listhead)\r
{\r
- char *ptr, *ipaddr, *ip6range = NULL, *ipname = NULL, *lmsid = NULL;\r
+ char *ptr, *ipaddr, *nextip6, *ip6buf; \r
+ char *ip6uplink = NULL, *ip6range = NULL, *ipname = NULL, *lmsid = NULL;\r
\r
if(ip6prefix) /* Try this only if IPv6 subsystem is active... */\r
{\r
ptr = strstr(str, "::");\r
- if(ptr && ptr-str > 4)\r
+ while(ptr && ptr-str > 4)\r
{\r
- ptr -= 4; \r
- duplicate(ptr, ip6range);\r
- ptr = strstr(ip6range, "::");\r
+ nextip6 = strstr(ptr + 2, "::");\r
+ ptr -= 4;\r
+ duplicate(ptr, ip6buf);\r
+ ptr = strstr(ip6buf, "::");\r
if(ptr)\r
{\r
- *(ptr+2) = 0;\r
+ if(*(ptr+2) == '+')\r
+ {\r
+ *(ptr+3) = 0; /* ends with ::+ */\r
+ ip6uplink = ip6buf;\r
+ }\r
+ else\r
+ {\r
+ *(ptr+2) = 0; /* ends with :: */\r
+ ip6range = ip6buf;\r
+ } \r
}\r
+ ptr = nextip6;\r
}\r
}\r
\r
{\r
ptr++;\r
}\r
- ipname=ptr; \r
+ ipname = ptr; \r
while(*ptr and *ptr!=' ' and *ptr!=9)\r
{\r
ptr++;\r
{\r
ip->lmsid = atoi(lmsid);\r
}\r
- lastIP6 = ip;\r
+ lastIP6range = ip;\r
+ }\r
+ else\r
+ {\r
+ lastIP6range = NULL;\r
+ }\r
+\r
+ /* it is ugly to copy+paste and search+replace, but... */\r
+ if(ip6uplink)\r
+ {\r
+ concatenate(ip6prefix,ip6uplink,ptr);\r
+ ip6uplink=ptr;\r
+ if_exists(ip, ips, eq(ip->addr,ip6uplink));\r
+ else\r
+ {\r
+ TheIP(ip6uplink, FALSE);\r
+ }\r
+ ip->name = ip6uplink;\r
+ ip->keyword = defaultkeyword; /* settings for default keyword */\r
+ if(lmsid)\r
+ {\r
+ ip->lmsid = atoi(lmsid);\r
+ }\r
+ lastIP6uplink = ip;\r
}\r
else\r
{\r
- lastIP6 = NULL;\r
+ lastIP6uplink = NULL;\r
}\r
\r
if_exists(ip, listhead, eq(ip->addr,ipaddr));\r
parse_and_append_ip(str, ips);\r
ip->sharing = substring;\r
ip->keyword = defaultkeyword; /* settings for default keyword */\r
- if(lastIP6)\r
+ if(lastIP6range)\r
+ {\r
+ lastIP6range->sharing = substring;\r
+ lastIP6range = NULL;\r
+ }\r
+ if(lastIP6uplink)\r
{\r
- lastIP6->sharing = substring;\r
- lastIP6 = NULL;\r
+ lastIP6uplink->sharing = substring;\r
+ lastIP6uplink = NULL;\r
}\r
while(*substring and *substring != '\n')\r
{\r
else\r
{\r
substring = strstr(str, "#255.");\r
- if(substring and not strstr(str, "#255.255.255.255")) /* do not ping /32 ranges */\r
+ if(substring and not strstr(str, "#255.255.255.255")) /* do not ping /32 uplinks */\r
{\r
/* netmask detected - save network*/\r
unsigned bit;\r
if_exists(keyword,keywords,(substring=strstr(str,keyword->key)))\r
{\r
parse_and_append_ip(str, ips);\r
- if(lastIP6)\r
+ if(lastIP6range)\r
+ {\r
+ lastIP6range->sharing = ip->name;\r
+ lastIP6range = NULL;\r
+ }\r
+ if(lastIP6uplink)\r
{\r
- lastIP6->sharing = ip->name;\r
- lastIP6 = NULL;\r
+ lastIP6uplink->sharing = ip->name;\r
+ lastIP6uplink = NULL;\r
}\r
ip->keyword = keyword;\r
keyword->ip_count++;\r