Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ff516ff authored by Asbjørn Sloth Tønnesen's avatar Asbjørn Sloth Tønnesen Committed by David S. Miller
Browse files

net: l2tp: only set L2TP_ATTR_UDP_CSUM if AF_INET



Only set L2TP_ATTR_UDP_CSUM in l2tp_nl_tunnel_send()
when it's running over IPv4.

This prepares the code to also have IPv6 specific attributes.

Signed-off-by: default avatarAsbjoern Sloth Toennesen <asbjorn@asbjorn.st>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3f11ec04
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -379,9 +379,14 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla

	switch (tunnel->encap) {
	case L2TP_ENCAPTYPE_UDP:
		switch (sk->sk_family) {
		case AF_INET:
			if (nla_put_u8(skb, L2TP_ATTR_UDP_CSUM, !sk->sk_no_check_tx))
				goto nla_put_failure;
			break;
		}
		if (nla_put_u16(skb, L2TP_ATTR_UDP_SPORT, ntohs(inet->inet_sport)) ||
		    nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)) ||
		    nla_put_u8(skb, L2TP_ATTR_UDP_CSUM, !sk->sk_no_check_tx))
		    nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)))
			goto nla_put_failure;
		/* NOBREAK */
	case L2TP_ENCAPTYPE_IP: