| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: table.c,v 1.27 2016/12/20 03:35:12 ozaki-r Exp $ */ | | 1 | /* $NetBSD: table.c,v 1.28 2018/02/06 09:33:07 mrg Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1983, 1988, 1993 | | 4 | * Copyright (c) 1983, 1988, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
33 | * SUCH DAMAGE. | | 33 | * SUCH DAMAGE. |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include "defs.h" | | 36 | #include "defs.h" |
37 | | | 37 | |
38 | #ifdef __NetBSD__ | | 38 | #ifdef __NetBSD__ |
39 | __RCSID("$NetBSD: table.c,v 1.27 2016/12/20 03:35:12 ozaki-r Exp $"); | | 39 | __RCSID("$NetBSD: table.c,v 1.28 2018/02/06 09:33:07 mrg Exp $"); |
40 | #elif defined(__FreeBSD__) | | 40 | #elif defined(__FreeBSD__) |
41 | __RCSID("$FreeBSD$"); | | 41 | __RCSID("$FreeBSD$"); |
42 | #else | | 42 | #else |
43 | __RCSID("Revision: 2.27 "); | | 43 | __RCSID("Revision: 2.27 "); |
44 | #ident "Revision: 2.27 " | | 44 | #ident "Revision: 2.27 " |
45 | #endif | | 45 | #endif |
46 | | | 46 | |
47 | static struct rt_spare *rts_better(struct rt_entry *); | | 47 | static struct rt_spare *rts_better(struct rt_entry *); |
48 | static struct rt_spare rts_empty = {0,0,0,HOPCNT_INFINITY,0,0,0}; | | 48 | static struct rt_spare rts_empty = {0,0,0,HOPCNT_INFINITY,0,0,0}; |
49 | static void set_need_flash(void); | | 49 | static void set_need_flash(void); |
50 | #ifdef _HAVE_SIN_LEN | | 50 | #ifdef _HAVE_SIN_LEN |
51 | static void masktrim(struct sockaddr_in *ap); | | 51 | static void masktrim(struct sockaddr_in *ap); |
52 | #else | | 52 | #else |
| @@ -1282,31 +1282,32 @@ read_rt(void) | | | @@ -1282,31 +1282,32 @@ read_rt(void) |
1282 | continue; | | 1282 | continue; |
1283 | } | | 1283 | } |
1284 | #endif | | 1284 | #endif |
1285 | | | 1285 | |
1286 | if (get_info_gate(&INFO_GATE(&info), &gate_sin)) { | | 1286 | if (get_info_gate(&INFO_GATE(&info), &gate_sin)) { |
1287 | gate = S_ADDR(INFO_GATE(&info)); | | 1287 | gate = S_ADDR(INFO_GATE(&info)); |
1288 | snprintf(strp, str + sizeof(str) - strp, | | 1288 | snprintf(strp, str + sizeof(str) - strp, |
1289 | " --> %s", naddr_ntoa(gate)); | | 1289 | " --> %s", naddr_ntoa(gate)); |
1290 | strp += strlen(strp); | | 1290 | strp += strlen(strp); |
1291 | } else { | | 1291 | } else { |
1292 | gate = 0; | | 1292 | gate = 0; |
1293 | } | | 1293 | } |
1294 | | | 1294 | |
1295 | if (INFO_AUTHOR(&info) != 0) | | 1295 | if (INFO_AUTHOR(&info) != 0) { |
1296 | snprintf(strp, str + sizeof(str) - strp, | | 1296 | snprintf(strp, str + sizeof(str) - strp, |
1297 | " by authority of %s", | | 1297 | " by authority of %s", |
1298 | saddr_ntoa(INFO_AUTHOR(&info))); | | 1298 | saddr_ntoa(INFO_AUTHOR(&info))); |
1299 | strp += strlen(strp); | | 1299 | strp += strlen(strp); |
| | | 1300 | } |
1300 | | | 1301 | |
1301 | switch (m.r.rtm.rtm_type) { | | 1302 | switch (m.r.rtm.rtm_type) { |
1302 | case RTM_ADD: | | 1303 | case RTM_ADD: |
1303 | case RTM_CHANGE: | | 1304 | case RTM_CHANGE: |
1304 | case RTM_REDIRECT: | | 1305 | case RTM_REDIRECT: |
1305 | if (m.r.rtm.rtm_errno != 0) { | | 1306 | if (m.r.rtm.rtm_errno != 0) { |
1306 | trace_act("ignore %s with \"%s\" error", | | 1307 | trace_act("ignore %s with \"%s\" error", |
1307 | str, strerror(m.r.rtm.rtm_errno)); | | 1308 | str, strerror(m.r.rtm.rtm_errno)); |
1308 | } else { | | 1309 | } else { |
1309 | trace_act("%s", str); | | 1310 | trace_act("%s", str); |
1310 | rtm_add(&m.r.rtm,&info,0); | | 1311 | rtm_add(&m.r.rtm,&info,0); |
1311 | } | | 1312 | } |
1312 | break; | | 1313 | break; |