|
Lines 115-124
Link Here
|
| 115 |
format_prefix(const u_char *prefix, unsigned char plen) |
115 |
format_prefix(const u_char *prefix, unsigned char plen) |
| 116 |
{ |
116 |
{ |
| 117 |
static char buf[50]; |
117 |
static char buf[50]; |
|
|
118 |
#ifdef INET6 |
| 118 |
if(plen >= 96 && memcmp(prefix, v4prefix, 12) == 0) |
119 |
if(plen >= 96 && memcmp(prefix, v4prefix, 12) == 0) |
|
|
120 |
#endif |
| 119 |
snprintf(buf, 50, "%s/%u", ipaddr_string(prefix + 12), plen - 96); |
121 |
snprintf(buf, 50, "%s/%u", ipaddr_string(prefix + 12), plen - 96); |
|
|
122 |
#ifdef INET6 |
| 120 |
else |
123 |
else |
| 121 |
snprintf(buf, 50, "%s/%u", ip6addr_string(prefix), plen); |
124 |
snprintf(buf, 50, "%s/%u", ip6addr_string(prefix), plen); |
|
|
125 |
#endif |
| 122 |
buf[49] = '\0'; |
126 |
buf[49] = '\0'; |
| 123 |
return buf; |
127 |
return buf; |
| 124 |
} |
128 |
} |
|
Lines 126-135
Link Here
|
| 126 |
static const char * |
130 |
static const char * |
| 127 |
format_address(const u_char *prefix) |
131 |
format_address(const u_char *prefix) |
| 128 |
{ |
132 |
{ |
|
|
133 |
#ifdef INET6 |
| 129 |
if(memcmp(prefix, v4prefix, 12) == 0) |
134 |
if(memcmp(prefix, v4prefix, 12) == 0) |
|
|
135 |
#endif |
| 130 |
return ipaddr_string(prefix + 12); |
136 |
return ipaddr_string(prefix + 12); |
|
|
137 |
#ifdef INET6 |
| 131 |
else |
138 |
else |
| 132 |
return ip6addr_string(prefix); |
139 |
return ip6addr_string(prefix); |
|
|
140 |
#endif |
| 133 |
} |
141 |
} |
| 134 |
|
142 |
|
| 135 |
static int |
143 |
static int |