lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 8 Aug 2017 09:53:34 +0200 From: Christian Langrock <christian.langrock@...unet.com> To: Stephen Hemminger <stephen@...workplumber.org> CC: <netdev@...r.kernel.org> Subject: Re: [PATCH] ip/link_vti6.c: Fix local/remote any handling This seems to be the better solution, at least because i missed the case where the function is called to alter a VTI. BR, Christian Am 07.08.2017 um 17:12 schrieb Stephen Hemminger: > On Mon, 7 Aug 2017 08:41:23 +0200 > Christian Langrock <christian.langrock@...unet.com> wrote: > >> According to the IPv4 behavior of 'ip' it should be possible to omit the >> arguments for local and remote address. >> Without this patch omitting these parameters would lead to >> uninitialized memory being interpreted as IPv6 addresses. >> >> Signed-off-by: Christian Langrock <christian.langrock@...unet.com> > I don't like extra flag values. Why not just: > > diff --git a/ip/link_vti6.c b/ip/link_vti6.c > index be4e33cee606..6ea1fc2306ce 100644 > --- a/ip/link_vti6.c > +++ b/ip/link_vti6.c > @@ -59,8 +59,8 @@ static int vti6_parse_opt(struct link_util *lu, int argc, char **argv, > struct rtattr *tb[IFLA_MAX + 1]; > struct rtattr *linkinfo[IFLA_INFO_MAX+1]; > struct rtattr *vtiinfo[IFLA_VTI_MAX + 1]; > - struct in6_addr saddr; > - struct in6_addr daddr; > + struct in6_addr saddr = IN6ADDR_ANY_INIT; > + struct in6_addr daddr = IN6ADDR_ANY_INIT; > unsigned int ikey = 0; > unsigned int okey = 0; > unsigned int link = 0; > @@ -195,8 +195,11 @@ get_failed: > > addattr32(n, 1024, IFLA_VTI_IKEY, ikey); > addattr32(n, 1024, IFLA_VTI_OKEY, okey); > - addattr_l(n, 1024, IFLA_VTI_LOCAL, &saddr, sizeof(saddr)); > - addattr_l(n, 1024, IFLA_VTI_REMOTE, &daddr, sizeof(daddr)); > + > + if (memcmp(&saddr, &in6addr_any, sizeof(in6addr_any))) > + addattr_l(n, 1024, IFLA_VTI_LOCAL, &saddr, sizeof(saddr)); > + if (memcmp(&daddr, &in6addr_any, sizeof(in6addr_any))) > + addattr_l(n, 1024, IFLA_VTI_REMOTE, &daddr, sizeof(daddr)); > addattr32(n, 1024, IFLA_VTI_FWMARK, fwmark); > if (link) > addattr32(n, 1024, IFLA_VTI_LINK, link); Download attachment "0x82EB6B5E.asc" of type "application/pgp-keys" (1728 bytes) Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists