Date: Tue, 16 Feb 2021 22:47:03 +0100 From: Mateusz Guzik <mjguzik@gmail.com> To: "Alexander V. Chernikov" <melifaro@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org> Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. Message-ID: <CAGudoHHxz-=nvDEZReEi%2BkJntTVVaWR9wtNLYAwhwHA4F9xq6g@mail.gmail.com> In-Reply-To: <290641613510357@mail.yandex.ru> References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> <CAGudoHHc_z6m5vRhi57zqN8%2BMJzT65tGnddzC7k=1s83ncUa5g@mail.gmail.com> <290641613510357@mail.yandex.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
In this context I meant NOINET and NOINET6 Anyhow I see the following: sys/net/rtsock.c:1427:2: error: implicit declaration of function 'IN6_MASK_ADDR' is invalid in C99 [-Werror,-Wimplicit-function-declaration] IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); ^ On 2/16/21, Alexander V. Chernikov <melifaro@freebsd.org> wrote: > 16.02.2021, 20:43, "Mateusz Guzik" <mjguzik@gmail.com>: >> This breaks the built at least without INET6. > It would help if you could share the actual build error. > I see -Wunused for 2 function (which I will fix soon), but I'm not sure i= f > that's the error you're running into. >> >> can you please start testing your patches on NOINET kernels > Well, it actually builds for me: > -------------------------------------------------------------- >>>> Kernel build for LINT-NOINET completed on Tue Feb 16 21:21:39 UTC 2021 > -------------------------------------------------------------- >>>> Kernel(s) LINT-NOINET built in 28 seconds, ncpu: 2, make -j6 > -------------------------------------------------------------- > >> >> On 2/16/21, Alexander V. Chernikov <melifaro@freebsd.org> wrote: >>> =C2=A0The branch main has been updated by melifaro: >>> >>> =C2=A0URL: >>> =C2=A0https://cgit.FreeBSD.org/src/commit/?id=3D2fe5a79425c79f7b828acd9= 1da66d97230925fc8 >>> >>> =C2=A0commit 2fe5a79425c79f7b828acd91da66d97230925fc8 >>> =C2=A0Author: Alexander V. Chernikov <melifaro@FreeBSD.org> >>> =C2=A0AuthorDate: 2021-02-16 20:30:04 +0000 >>> =C2=A0Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> >>> =C2=A0CommitDate: 2021-02-16 20:30:04 +0000 >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Fix dst/netmask handling in routing socke= t code. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Traditionally routing socket code did alm= ost zero checks on >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0the input message except for the mo= st basic size checks. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0This resulted in the unclear KPI boundary= for the routing system >>> code >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(`rtrequest*` and now `rib_action()= `) w.r.t message validness. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Multiple potential problems and nuances e= xists: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Host bits in RTAX_DST sockaddr. Existin= g applications do send >>> =C2=A0prefixes >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0with hostbits uncleared. Even `rout= e(8)` does this, as they hope >>> the >>> =C2=A0kernel >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0would do the job of fixing it. Code= inside `rib_action()` needs to >>> =C2=A0handle >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0it on its own (see `rt_maskedcopy()= ` ugly hack). >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* There are multiple way of adding the ho= st route: it can be DST >>> =C2=A0without >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0netmask or DST with /32(/128) netma= sk. Also, RTF_HOST has to be >>> set >>> =C2=A0correspondingly. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Currently, these 2 options create 2= DIFFERENT routes in the >>> kernel. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* no sockaddr length/content checking for= the "secondary" fields >>> exists: >>> =C2=A0nothing >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0stops rtsock application to send so= ckaddr_in with length of 25 >>> (instead >>> =C2=A0of 16). >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Kernel will accept it, install to R= IB as is and propagate to all >>> rtsock >>> =C2=A0consumers, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0potentially triggering bugs in thei= r code. Same goes for sin_port, >>> =C2=A0sin_zero, etc. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0The goal of this change is to make rtsock= verify all sockaddr and >>> prefix >>> =C2=A0consistency. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Said differently, `rib_action()` or inter= nals should NOT require to >>> =C2=A0change any of the >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sockaddrs supplied by `rt_addrinfo`= structure due to >>> incorrectness. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0To be more specific, this change implemen= ts the following: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* sockaddr cleanup/validation check is ad= ded immediately after >>> getting >>> =C2=A0sockaddrs from rtm. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Per-family dst/netmask checks clears ho= st bits in dst and zeros >>> all >>> =C2=A0dst/netmask "secondary" fields. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* The same netmask checking code converts= /32(/128) netmasks to >>> "host" >>> =C2=A0route case >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(NULL netmask, RTF_HOST), removing = the dualism. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Instead of allowing ANY "known" sockadd= r families (0<..<AF_MAX), >>> allow >>> =C2=A0only actually >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0supported ones (inet, inet6, link). >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Automatically convert `sockaddr_sdl` (A= F_LINK) gateways to >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0`sockaddr_sdl_short`. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Reported by: Guy Yur <guyyur at gmail.com= > >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Reviewed By: donner >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Differential Revision: https://reviews.fr= eebsd.org/D28668 >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0MFC after: 3 days >>> =C2=A0--- >>> =C2=A0=C2=A0sys/net/rtsock.c | 201 >>> =C2=A0+++++++++++++++++++++++++++++++++- >>> =C2=A0=C2=A0tests/sys/net/routing/rtsock_common.h | 4 - >>> =C2=A0=C2=A02 files changed, 195 insertions(+), 10 deletions(-) >>> >>> =C2=A0diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c >>> =C2=A0index 3a98b366dfc3..40ce62c77c2a 100644 >>> =C2=A0--- a/sys/net/rtsock.c >>> =C2=A0+++ b/sys/net/rtsock.c >>> =C2=A0@@ -70,6 +70,7 @@ >>> =C2=A0=C2=A0#include <netinet/if_ether.h> >>> =C2=A0=C2=A0#include <netinet/ip_carp.h> >>> =C2=A0=C2=A0#ifdef INET6 >>> =C2=A0+#include <netinet6/in6_var.h> >>> =C2=A0=C2=A0#include <netinet6/ip6_var.h> >>> =C2=A0=C2=A0#include <netinet6/scope6_var.h> >>> =C2=A0=C2=A0#endif >>> =C2=A0@@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct >>> =C2=A0rt_addrinfo *rtinfo, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0struct walkarg *w, int *plen); >>> =C2=A0=C2=A0static int rt_xaddrs(caddr_t cp, caddr_t cplim, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0struct rt_addrinfo *rtinfo); >>> =C2=A0+static int cleanup_xaddrs(struct rt_addrinfo *info); >>> =C2=A0=C2=A0static int sysctl_dumpentry(struct rtentry *rt, void *vw); >>> =C2=A0=C2=A0static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_= object *nh, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0uint32_t weight, struct walkarg *w); >>> =C2=A0@@ -636,11 +638,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len= , >>> u_int >>> =C2=A0fibnum, struct rt_addrinfo * >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return (EINVAL); >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0info->rti_f= lags =3D rtm->rtm_flags; >>> =C2=A0- if (info->rti_info[RTAX_DST] =3D=3D NULL || >>> =C2=A0- info->rti_info[RTAX_DST]->sa_family >=3D AF_MAX || >>> =C2=A0- (info->rti_info[RTAX_GATEWAY] !=3D NULL && >>> =C2=A0- info->rti_info[RTAX_GATEWAY]->sa_family >=3D AF_MAX)) >>> =C2=A0- return (EINVAL); >>> =C2=A0+ error =3D cleanup_xaddrs(info); >>> =C2=A0+ if (error !=3D 0) >>> =C2=A0+ return (error); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0saf =3D inf= o->rti_info[RTAX_DST]->sa_family; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Ver= ify that the caller has the appropriate privilege; >>> RTM_GET >>> =C2=A0@@ -739,7 +739,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_i= nt >>> fibnum, >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0RIB_RLOCK(r= nh); >>> >>> =C2=A0- if (info->rti_info[RTAX_NETMASK] =3D=3D NULL) { >>> =C2=A0+ /* >>> =C2=A0+ * By (implicit) convention host route (one without netmask) >>> =C2=A0+ * means longest-prefix-match request and the route with netmask >>> =C2=A0+ * means exact-match lookup. >>> =C2=A0+ * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/1= 28 >>> =C2=A0+ * prefixes, use original data to check for the netmask presence= . >>> =C2=A0+ */ >>> =C2=A0+ if ((rtm->rtm_addrs & RTA_NETMASK) =3D=3D 0) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Provide longest prefix match= for >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* address lookup (no mask). >>> =C2=A0@@ -1286,6 +1293,188 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, stru= ct >>> =C2=A0rt_addrinfo *rtinfo) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return (0); >>> =C2=A0=C2=A0} >>> >>> =C2=A0+static inline void >>> =C2=A0+fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) >>> =C2=A0+{ >>> =C2=A0+ >>> =C2=A0+ const struct sockaddr_in nsin =3D { >>> =C2=A0+ .sin_family =3D AF_INET, >>> =C2=A0+ .sin_len =3D sizeof(struct sockaddr_in), >>> =C2=A0+ .sin_addr =3D addr, >>> =C2=A0+ }; >>> =C2=A0+ *sin =3D nsin; >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static inline void >>> =C2=A0+fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_= addr >>> =C2=A0*addr6, >>> =C2=A0+ uint32_t scopeid) >>> =C2=A0+{ >>> =C2=A0+ >>> =C2=A0+ const struct sockaddr_in6 nsin6 =3D { >>> =C2=A0+ .sin6_family =3D AF_INET6, >>> =C2=A0+ .sin6_len =3D sizeof(struct sockaddr_in6), >>> =C2=A0+ .sin6_addr =3D *addr6, >>> =C2=A0+ .sin6_scope_id =3D scopeid, >>> =C2=A0+ }; >>> =C2=A0+ *sin6 =3D nsin6; >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs_gateway(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ struct sockaddr *gw =3D info->rti_info[RTAX_GATEWAY]; >>> =C2=A0+ >>> =C2=A0+ switch (gw->sa_family) { >>> =C2=A0+#ifdef INET >>> =C2=A0+ case AF_INET: >>> =C2=A0+ { >>> =C2=A0+ struct sockaddr_in *gw_sin =3D (struct sockaddr_in *)gw; >>> =C2=A0+ if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { >>> =C2=A0+ printf("gw sin_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); >>> =C2=A0+ } >>> =C2=A0+ break; >>> =C2=A0+#endif >>> =C2=A0+#ifdef INET6 >>> =C2=A0+ case AF_INET6: >>> =C2=A0+ { >>> =C2=A0+ struct sockaddr_in6 *gw_sin6 =3D (struct sockaddr_in6 *)gw; >>> =C2=A0+ if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { >>> =C2=A0+ printf("gw sin6_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); >>> =C2=A0+ break; >>> =C2=A0+ } >>> =C2=A0+#endif >>> =C2=A0+ case AF_LINK: >>> =C2=A0+ { >>> =C2=A0+ struct sockaddr_dl_short *gw_sdl; >>> =C2=A0+ >>> =C2=A0+ gw_sdl =3D (struct sockaddr_dl_short *)gw; >>> =C2=A0+ if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { >>> =C2=A0+ printf("gw sdl_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ const struct sockaddr_dl_short sdl =3D { >>> =C2=A0+ .sdl_family =3D AF_LINK, >>> =C2=A0+ .sdl_len =3D sizeof(struct sockaddr_dl_short), >>> =C2=A0+ .sdl_index =3D gw_sdl->sdl_index, >>> =C2=A0+ }; >>> =C2=A0+ *gw_sdl =3D sdl; >>> =C2=A0+ break; >>> =C2=A0+ } >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ return (0); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs_inet(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ struct sockaddr_in *dst_sa, *mask_sa; >>> =C2=A0+ >>> =C2=A0+ /* Check & fixup dst/netmask combination first */ >>> =C2=A0+ dst_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_DST]; >>> =C2=A0+ mask_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; >>> =C2=A0+ >>> =C2=A0+ struct in_addr mask =3D { >>> =C2=A0+ .s_addr =3D mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCA= ST, >>> =C2=A0+ }; >>> =C2=A0+ struct in_addr dst =3D { >>> =C2=A0+ .s_addr =3D htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s= _addr)) >>> =C2=A0+ }; >>> =C2=A0+ >>> =C2=A0+ if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { >>> =C2=A0+ printf("dst sin_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { >>> =C2=A0+ printf("mask sin_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet(dst_sa, dst); >>> =C2=A0+ >>> =C2=A0+ if (mask.s_addr !=3D INADDR_BROADCAST) >>> =C2=A0+ fill_sockaddr_inet(mask_sa, mask); >>> =C2=A0+ else { >>> =C2=A0+ info->rti_info[RTAX_NETMASK] =3D NULL; >>> =C2=A0+ info->rti_flags |=3D RTF_HOST; >>> =C2=A0+ info->rti_addrs &=3D ~RTA_NETMASK; >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ /* Check gateway */ >>> =C2=A0+ if (info->rti_info[RTAX_GATEWAY] !=3D NULL) >>> =C2=A0+ return (cleanup_xaddrs_gateway(info)); >>> =C2=A0+ >>> =C2=A0+ return (0); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs_inet6(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ struct sockaddr_in6 *dst_sa, *mask_sa; >>> =C2=A0+ struct in6_addr mask; >>> =C2=A0+ >>> =C2=A0+ /* Check & fixup dst/netmask combination first */ >>> =C2=A0+ dst_sa =3D (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; >>> =C2=A0+ mask_sa =3D (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]= ; >>> =C2=A0+ >>> =C2=A0+ mask =3D mask_sa ? mask_sa->sin6_addr : in6mask128; >>> =C2=A0+ IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); >>> =C2=A0+ >>> =C2=A0+ if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { >>> =C2=A0+ printf("dst sin6_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6))= { >>> =C2=A0+ printf("mask sin6_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); >>> =C2=A0+ >>> =C2=A0+ if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) >>> =C2=A0+ fill_sockaddr_inet6(mask_sa, &mask, 0); >>> =C2=A0+ else { >>> =C2=A0+ info->rti_info[RTAX_NETMASK] =3D NULL; >>> =C2=A0+ info->rti_flags |=3D RTF_HOST; >>> =C2=A0+ info->rti_addrs &=3D ~RTA_NETMASK; >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ /* Check gateway */ >>> =C2=A0+ if (info->rti_info[RTAX_GATEWAY] !=3D NULL) >>> =C2=A0+ return (cleanup_xaddrs_gateway(info)); >>> =C2=A0+ >>> =C2=A0+ return (0); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ int error =3D EAFNOSUPPORT; >>> =C2=A0+ >>> =C2=A0+ if (info->rti_info[RTAX_DST] =3D=3D NULL) >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ >>> =C2=A0+ switch (info->rti_info[RTAX_DST]->sa_family) { >>> =C2=A0+#ifdef INET >>> =C2=A0+ case AF_INET: >>> =C2=A0+ error =3D cleanup_xaddrs_inet(info); >>> =C2=A0+ break; >>> =C2=A0+#endif >>> =C2=A0+#ifdef INET6 >>> =C2=A0+ case AF_INET6: >>> =C2=A0+ error =3D cleanup_xaddrs_inet6(info); >>> =C2=A0+ break; >>> =C2=A0+#endif >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ return (error); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0=C2=A0/* >>> =C2=A0=C2=A0=C2=A0* Fill in @dmask with valid netmask leaving original = @smask >>> =C2=A0=C2=A0=C2=A0* intact. Mostly used with radix netmasks. >>> =C2=A0diff --git a/tests/sys/net/routing/rtsock_common.h >>> =C2=A0b/tests/sys/net/routing/rtsock_common.h >>> =C2=A0index 7da88e0eb512..71476d2b5f3c 100644 >>> =C2=A0--- a/tests/sys/net/routing/rtsock_common.h >>> =C2=A0+++ b/tests/sys/net/routing/rtsock_common.h >>> =C2=A0@@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, in= t >>> rtm_len, >>> =C2=A0size_t offset, int rtm_ad >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sa =3D (struct sockaddr *)((char *)s= a + SA_SIZE(sa)); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} >>> =C2=A0- >>> =C2=A0- RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len = =3D=3D >>> rtm_len, >>> =C2=A0- "message len !=3D parsed len: expected %d parsed %d", >>> =C2=A0- rtm_len, (int)parsed_len); >>> =C2=A0=C2=A0} >>> >>> =C2=A0=C2=A0/* >>> =C2=A0_______________________________________________ >>> =C2=A0dev-commits-src-all@freebsd.org mailing list >>> =C2=A0https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all >>> =C2=A0To unsubscribe, send any mail to >>> =C2=A0"dev-commits-src-all-unsubscribe@freebsd.org" >> >> -- >> Mateusz Guzik <mjguzik gmail.com> > --=20 Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHHxz-=nvDEZReEi%2BkJntTVVaWR9wtNLYAwhwHA4F9xq6g>