| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: config.c,v 1.31 2012/12/14 09:48:31 roy Exp $ */ | | 1 | /* $NetBSD: config.c,v 1.32 2013/01/24 17:44:59 christos Exp $ */ |
2 | /* $KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $ */ | | 2 | /* $KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (C) 1998 WIDE Project. | | 5 | * Copyright (C) 1998 WIDE Project. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -1298,27 +1298,27 @@ make_packet(struct rainfo *rainfo) | | | @@ -1298,27 +1298,27 @@ make_packet(struct rainfo *rainfo) |
1298 | len = buf - (char *)ndopt_dnssl; | | 1298 | len = buf - (char *)ndopt_dnssl; |
1299 | plen = len % 8 ? 8 - len % 8 : 0; | | 1299 | plen = len % 8 ? 8 - len % 8 : 0; |
1300 | CHECKLEN(plen); | | 1300 | CHECKLEN(plen); |
1301 | memset(buf, 0, plen); | | 1301 | memset(buf, 0, plen); |
1302 | buf += plen; | | 1302 | buf += plen; |
1303 | ndopt_dnssl->nd_opt_dnssl_len = (len + plen) / 8; | | 1303 | ndopt_dnssl->nd_opt_dnssl_len = (len + plen) / 8; |
1304 | } | | 1304 | } |
1305 | memset(buf, 0, packlen - (buf - rainfo->ra_data)); | | 1305 | memset(buf, 0, packlen - (buf - rainfo->ra_data)); |
1306 | } | | 1306 | } |
1307 | | | 1307 | |
1308 | static int | | 1308 | static int |
1309 | getinet6sysctl(int code) | | 1309 | getinet6sysctl(int code) |
1310 | { | | 1310 | { |
1311 | int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 }; | | 1311 | static const int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 }; |
1312 | int value; | | 1312 | int value; |
1313 | size_t size; | | 1313 | size_t size; |
1314 | | | 1314 | |
1315 | mib[3] = code; | | 1315 | mib[3] = code; |
1316 | size = sizeof(value); | | 1316 | size = sizeof(value); |
1317 | if (sysctl(mib, __arraycount(mib), &value, &size, NULL, 0) | | 1317 | if (sysctl(mib, __arraycount(mib), &value, &size, NULL, 0) |
1318 | < 0) { | | 1318 | < 0) { |
1319 | syslog(LOG_ERR, "<%s>: failed to get ip6 sysctl(%d): %m", | | 1319 | syslog(LOG_ERR, "<%s>: failed to get ip6 sysctl(%d): %m", |
1320 | __func__, code); | | 1320 | __func__, code); |
1321 | return -1; | | 1321 | return -1; |
1322 | } | | 1322 | } |
1323 | else | | 1323 | else |
1324 | return value; | | 1324 | return value; |