l2tp: fix missing print session offset info
authorHangbin Liu <liuhangbin@gmail.com>
Fri, 22 Dec 2017 14:10:17 +0000 (15:10 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 31 May 2018 23:30:05 +0000 (00:30 +0100)
commit 820da5357572715c6235ba3b3daa2d5b43a1198f upstream.

Report offset parameter in L2TP_CMD_SESSION_GET command if
it has been configured by userspace

Fixes: 309795f4bec ("l2tp: Add netlink control API for L2TP")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2:
 - Use NLA_PUT_U16, consistent with the rest of the function
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/l2tp/l2tp_netlink.c

index 12c0e8a..9f80edf 100644 (file)
@@ -589,6 +589,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 pid, u32 seq, int flags
 
        if (session->ifname && session->ifname[0])
                NLA_PUT_STRING(skb, L2TP_ATTR_IFNAME, session->ifname);
 
        if (session->ifname && session->ifname[0])
                NLA_PUT_STRING(skb, L2TP_ATTR_IFNAME, session->ifname);
+       if (session->offset)
+               NLA_PUT_U16(skb, L2TP_ATTR_OFFSET, session->offset);
        if (session->cookie_len)
                NLA_PUT(skb, L2TP_ATTR_COOKIE, session->cookie_len, &session->cookie[0]);
        if (session->peer_cookie_len)
        if (session->cookie_len)
                NLA_PUT(skb, L2TP_ATTR_COOKIE, session->cookie_len, &session->cookie[0]);
        if (session->peer_cookie_len)