Skip to content

Commit 7ff516f

Browse files
asbjornstdavem330
authored andcommitted
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: Asbjoern Sloth Toennesen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3f11ec0 commit 7ff516f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/l2tp/l2tp_netlink.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,14 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
379379

380380
switch (tunnel->encap) {
381381
case L2TP_ENCAPTYPE_UDP:
382+
switch (sk->sk_family) {
383+
case AF_INET:
384+
if (nla_put_u8(skb, L2TP_ATTR_UDP_CSUM, !sk->sk_no_check_tx))
385+
goto nla_put_failure;
386+
break;
387+
}
382388
if (nla_put_u16(skb, L2TP_ATTR_UDP_SPORT, ntohs(inet->inet_sport)) ||
383-
nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)) ||
384-
nla_put_u8(skb, L2TP_ATTR_UDP_CSUM, !sk->sk_no_check_tx))
389+
nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)))
385390
goto nla_put_failure;
386391
/* NOBREAK */
387392
case L2TP_ENCAPTYPE_IP:

0 commit comments

Comments
 (0)