Skip to contentSkip to conversation

l2tp: fix missing print session offset info

PATCH Superseded Hangbin Liu 3 participants 5 messages Dec 21, 2017 – Dec 22, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 l2tp: fix missing print session offset info

Fixes 309795f4bec ("l2tp: Add netlink control API for L2TP")
---
 net/l2tp/l2tp_netlink.c | 2 ++
 1 file changed, 2 insertions(+)
net/l2tp/l2tp_netlink.c +2 -0
index a1f24fb..36378b4 100644
@@ -761,6 +761,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
 
 	if ((session->ifname[0] &&
 	     nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) ||
+	    (session->offset &&
+	     nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset) ||
 	    (session->cookie_len &&
 	     nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len,
 		     &session->cookie[0])) ||
Signature · 1 line
2.5.5
maintainer
#1 lore raw

From: Hangbin Liu <[email protected]>
Date: Thu, 21 Dec 2017 14:45:30 +0800

net/l2tp/l2tp_netlink.c static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl · line 765

Quoted 2 lines
net/l2tp/l2tp_netlink.c +2 -0
+	    (session->offset &&
+	     nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset) ||

It really discourages people from reviewing your changes when they don't even compile.

net/l2tp/l2tp_netlink.c: In function ‘l2tp_nl_session_send’:
net/l2tp/l2tp_netlink.c:764:23: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

      (session->offset &&
       ~~~~~~~~~~~~~~~~^~
       nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset) ||
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

net/l2tp/l2tp_netlink.c:782:3: error: expected ‘)’ before ‘goto’
goto nla_put_failure;
^~~~
...

#2 lore raw
Quoted 8 lines · David Miller

From: Hangbin Liu <[email protected]>
Date: Thu, 21 Dec 2017 14:45:30 +0800

net/l2tp/l2tp_netlink.c static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl · line 765

Quoted 2 lines
net/l2tp/l2tp_netlink.c +2 -0
+	    (session->offset &&
+	     nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset) ||

It really discourages people from reviewing your changes when they don't even compile.

Sh*t, I did compile and test my patch on the compiler. But forgot to the fix the code on my laptop...Really sorry for this, I need to double check it before send.

#3 lore raw

PATCH v2 1/1 l2tp: fix missing print session offset info

In reply to Hangbin Liu
Fixes 309795f4bec ("l2tp: Add netlink control API for L2TP")
---
 net/l2tp/l2tp_netlink.c | 2 ++
 1 file changed, 2 insertions(+)
net/l2tp/l2tp_netlink.c +2 -0
index a1f24fb..36378b4 100644
@@ -761,6 +761,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
 
 	if ((session->ifname[0] &&
 	     nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) ||
+	    (session->offset &&
+	     nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset)) ||
 	    (session->cookie_len &&
 	     nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len,
 		     &session->cookie[0])) ||
Signature · 1 line
2.5.5
#4 lore raw
Quoted 21 lines
Fixes 309795f4bec ("l2tp: Add netlink control API for L2TP")
---
 net/l2tp/l2tp_netlink.c | 2 ++
 1 file changed, 2 insertions(+)
net/l2tp/l2tp_netlink.c +2 -1
index a1f24fb..36378b4 100644
@@ -761,6 +761,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
 
        if ((session->ifname[0] &&
             nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) ||
+           (session->offset &&
+            nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset)) ||
            (session->cookie_len &&
             nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len,
                     &session->cookie[0])) ||
--
Quoted 2 lines

2.5.5

Hi David,

please hold on a while with this patch, I will send it in a patchset that addresses some offset related stuff.
Regards,

Lorenzo