| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rtsock.c,v 1.241 2018/04/25 03:49:57 ozaki-r Exp $ */ | | 1 | /* $NetBSD: rtsock.c,v 1.242 2018/08/31 15:15:23 maxv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
5 | * All rights reserved. | | 5 | * 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. |
| @@ -51,27 +51,27 @@ | | | @@ -51,27 +51,27 @@ |
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
58 | * SUCH DAMAGE. | | 58 | * SUCH DAMAGE. |
59 | * | | 59 | * |
60 | * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 | | 60 | * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | #include <sys/cdefs.h> | | 63 | #include <sys/cdefs.h> |
64 | __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.241 2018/04/25 03:49:57 ozaki-r Exp $"); | | 64 | __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.242 2018/08/31 15:15:23 maxv Exp $"); |
65 | | | 65 | |
66 | #ifdef _KERNEL_OPT | | 66 | #ifdef _KERNEL_OPT |
67 | #include "opt_inet.h" | | 67 | #include "opt_inet.h" |
68 | #include "opt_mpls.h" | | 68 | #include "opt_mpls.h" |
69 | #include "opt_compat_netbsd.h" | | 69 | #include "opt_compat_netbsd.h" |
70 | #include "opt_sctp.h" | | 70 | #include "opt_sctp.h" |
71 | #include "opt_net_mpsafe.h" | | 71 | #include "opt_net_mpsafe.h" |
72 | #endif | | 72 | #endif |
73 | | | 73 | |
74 | #include <sys/param.h> | | 74 | #include <sys/param.h> |
75 | #include <sys/systm.h> | | 75 | #include <sys/systm.h> |
76 | #include <sys/proc.h> | | 76 | #include <sys/proc.h> |
77 | #include <sys/socket.h> | | 77 | #include <sys/socket.h> |
| @@ -1211,31 +1211,31 @@ COMPATNAME(rt_msg1)(int type, struct rt_ | | | @@ -1211,31 +1211,31 @@ COMPATNAME(rt_msg1)(int type, struct rt_ |
1211 | m_reset_rcvif(m); | | 1211 | m_reset_rcvif(m); |
1212 | m_copyback(m, 0, datalen, data); | | 1212 | m_copyback(m, 0, datalen, data); |
1213 | if (len > datalen) | | 1213 | if (len > datalen) |
1214 | (void)memset(mtod(m, char *) + datalen, 0, len - datalen); | | 1214 | (void)memset(mtod(m, char *) + datalen, 0, len - datalen); |
1215 | rtm = mtod(m, struct rt_xmsghdr *); | | 1215 | rtm = mtod(m, struct rt_xmsghdr *); |
1216 | for (i = 0; i < RTAX_MAX; i++) { | | 1216 | for (i = 0; i < RTAX_MAX; i++) { |
1217 | if ((sa = rtinfo->rti_info[i]) == NULL) | | 1217 | if ((sa = rtinfo->rti_info[i]) == NULL) |
1218 | continue; | | 1218 | continue; |
1219 | rtinfo->rti_addrs |= (1 << i); | | 1219 | rtinfo->rti_addrs |= (1 << i); |
1220 | dlen = RT_XROUNDUP(sa->sa_len); | | 1220 | dlen = RT_XROUNDUP(sa->sa_len); |
1221 | m_copyback(m, len, sa->sa_len, sa); | | 1221 | m_copyback(m, len, sa->sa_len, sa); |
1222 | if (dlen != sa->sa_len) { | | 1222 | if (dlen != sa->sa_len) { |
1223 | /* | | 1223 | /* |
1224 | * Up to 6 + 1 nul's since roundup is to | | 1224 | * Up to 7 + 1 nul's since roundup is to |
1225 | * sizeof(uint64_t) (8 bytes) | | 1225 | * sizeof(uint64_t) (8 bytes) |
1226 | */ | | 1226 | */ |
1227 | m_copyback(m, len + sa->sa_len, | | 1227 | m_copyback(m, len + sa->sa_len, |
1228 | dlen - sa->sa_len, "\0\0\0\0\0\0"); | | 1228 | dlen - sa->sa_len, "\0\0\0\0\0\0\0"); |
1229 | } | | 1229 | } |
1230 | len += dlen; | | 1230 | len += dlen; |
1231 | } | | 1231 | } |
1232 | if (m->m_pkthdr.len != len) | | 1232 | if (m->m_pkthdr.len != len) |
1233 | goto out; | | 1233 | goto out; |
1234 | rtm->rtm_msglen = len; | | 1234 | rtm->rtm_msglen = len; |
1235 | rtm->rtm_version = RTM_XVERSION; | | 1235 | rtm->rtm_version = RTM_XVERSION; |
1236 | rtm->rtm_type = type; | | 1236 | rtm->rtm_type = type; |
1237 | return m; | | 1237 | return m; |
1238 | out: | | 1238 | out: |
1239 | m_freem(m); | | 1239 | m_freem(m); |
1240 | return NULL; | | 1240 | return NULL; |
1241 | } | | 1241 | } |