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
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 30 Sep 2013 21:57:32 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	f.cachereul@...t-sys.com
Cc:	jchapman@...alix.com, netdev@...r.kernel.org
Subject: Re: [PATCH next] l2tp: add support for IPv4-mapped IPv6 addresses

From: François Cachereul <f.cachereul@...t-sys.com>
Date: Fri, 27 Sep 2013 13:17:33 +0200

> @@ -1620,6 +1621,10 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
>  	int err;
>  	struct socket *sock = NULL;
>  	struct sock *sk = NULL;
> +#if IS_ENABLED(CONFIG_IPV6)
> +	struct inet_sock *inet = NULL;
> +	struct ipv6_pinfo *np = NULL;
> +#endif
 ...
> +#if IS_ENABLED(CONFIG_IPV6)
> +	np = inet6_sk(sk);
> +	if (sk->sk_family == PF_INET6 &&
> +	    ipv6_addr_v4mapped(&np->saddr) &&
> +	    ipv6_addr_v4mapped(&np->daddr)) {
> +		tunnel->v4mapped = true;
> +		inet = inet_sk(sk);
> +		inet->inet_saddr = np->saddr.s6_addr32[3];
> +		inet->inet_rcv_saddr = np->rcv_saddr.s6_addr32[3];
> +		inet->inet_daddr = np->daddr.s6_addr32[3];
> +	} else {
> +		tunnel->v4mapped = false;
> +	}
> +#endif

You only need one ifdef here, get rid of the top level variable
declarations and then just go:

#if IS_ENABLED(CONFIG_IPV6)
	if (sk->sk_family == PF_INET6) {
		struct ipv6_pinfo *np = inet6_sk(sk);

		if (ipv6_addr_v4mapped(&np->saddr) &&
		    ipv6_addr_v4mapped(&np->daddr)) {
			struct inet_sock *inet = inet_sk(sk);

			tunnel->v4mapped = true;
			inet->inet_saddr = np->saddr.s6_addr32[3];
			inet->inet_rcv_saddr = np->rcv_saddr.s6_addr32[3];
			inet->inet_daddr = np->daddr.s6_addr32[3];
		} else {
			tunnel->v4mapped = false;
		}
	}
#endif
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ