| OLD | NEW |
| 1 #include <sys/socket.h> | 1 #include <sys/socket.h> |
| 2 #include <netinet/in.h> | 2 #include <netinet/in.h> |
| 3 #include <netdb.h> | 3 #include <netdb.h> |
| 4 #include <net/if.h> | 4 #include <net/if.h> |
| 5 #include <arpa/inet.h> | 5 #include <arpa/inet.h> |
| 6 #include <ctype.h> | 6 #include <ctype.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 unsigned char addr[16]; | 263 unsigned char addr[16]; |
| 264 unsigned char len, mask; | 264 unsigned char len, mask; |
| 265 unsigned char prec, label; | 265 unsigned char prec, label; |
| 266 } defpolicy[] = { | 266 } defpolicy[] = { |
| 267 {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1", 15, 0xff, 50, 0}, | 267 {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1", 15, 0xff, 50, 0}, |
| 268 {"\0\0\0\0\0\0\0\0\0\0\xff\xff", 11, 0xff, 35, 4}, | 268 {"\0\0\0\0\0\0\0\0\0\0\xff\xff", 11, 0xff, 35, 4}, |
| 269 {"\x20\2", 1, 0xff, 30, 2}, | 269 {"\x20\2", 1, 0xff, 30, 2}, |
| 270 {"\x20\1", 3, 0xff, 5, 5}, | 270 {"\x20\1", 3, 0xff, 5, 5}, |
| 271 {"\xfc", 0, 0xfe, 3, 13}, | 271 {"\xfc", 0, 0xfe, 3, 13}, |
| 272 #if 0 | 272 #if 0 |
| 273 » /* These are deprecated and/or returned to the address | 273 /* These are deprecated and/or returned to the address |
| 274 » * pool, so despite the RFC, treating them as special | 274 * pool, so despite the RFC, treating them as special |
| 275 » * is probably wrong. */ | 275 * is probably wrong. */ |
| 276 » { "", 11, 0xff, 1, 3 }, | 276 {"", 11, 0xff, 1, 3}, |
| 277 » { "\xfe\xc0", 1, 0xc0, 1, 11 }, | 277 {"\xfe\xc0", 1, 0xc0, 1, 11}, |
| 278 » { "\x3f\xfe", 1, 0xff, 1, 12 }, | 278 {"\x3f\xfe", 1, 0xff, 1, 12}, |
| 279 #endif | 279 #endif |
| 280 /* Last rule must match all addresses to stop loop. */ | 280 /* Last rule must match all addresses to stop loop. */ |
| 281 {"", 0, 0, 40, 1}, | 281 {"", 0, 0, 40, 1}, |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 static const struct policy* policyof(const struct in6_addr* a) { | 284 static const struct policy* policyof(const struct in6_addr* a) { |
| 285 int i; | 285 int i; |
| 286 for (i = 0;; i++) { | 286 for (i = 0;; i++) { |
| 287 if (memcmp(a->s6_addr, defpolicy[i].addr, defpolicy[i].len)) | 287 if (memcmp(a->s6_addr, defpolicy[i].addr, defpolicy[i].len)) |
| 288 continue; | 288 continue; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 key |= prefixlen << DAS_PREFIX_SHIFT; | 448 key |= prefixlen << DAS_PREFIX_SHIFT; |
| 449 key |= (MAXADDRS - i) << DAS_ORDER_SHIFT; | 449 key |= (MAXADDRS - i) << DAS_ORDER_SHIFT; |
| 450 buf[i].sortkey = key; | 450 buf[i].sortkey = key; |
| 451 } | 451 } |
| 452 qsort(buf, cnt, sizeof *buf, addrcmp); | 452 qsort(buf, cnt, sizeof *buf, addrcmp); |
| 453 | 453 |
| 454 pthread_setcancelstate(cs, 0); | 454 pthread_setcancelstate(cs, 0); |
| 455 | 455 |
| 456 return cnt; | 456 return cnt; |
| 457 } | 457 } |
| OLD | NEW |