Re: [PATCH iproute2] ip/l2tp: remove offset and peer-offset options

2018-04-05 Thread Guillaume Nault
On Wed, Apr 04, 2018 at 04:43:10PM -0700, Stephen Hemminger wrote:
> On Tue, 3 Apr 2018 17:39:54 +0200
> Guillaume Nault  wrote:
> 
> > Ignore options "peer-offset" and "offset" when creating sessions. Keep
> > them when dumping sessions in order to avoid breaking external scripts.
> > 
> > "peer-offset" has always been a noop in iproute2. "offset" is now
> > ignored in Linux 4.16 (and was broken before that).
> > 
> > Signed-off-by: Guillaume Nault 
> 
> Sure, this makes sense applied.
> In theory, you could have just dropped them from the JSON output.

Indeed, I'll followup on this.


Re: [PATCH iproute2] ip/l2tp: remove offset and peer-offset options

2018-04-04 Thread Stephen Hemminger
On Tue, 3 Apr 2018 17:39:54 +0200
Guillaume Nault  wrote:

> Ignore options "peer-offset" and "offset" when creating sessions. Keep
> them when dumping sessions in order to avoid breaking external scripts.
> 
> "peer-offset" has always been a noop in iproute2. "offset" is now
> ignored in Linux 4.16 (and was broken before that).
> 
> Signed-off-by: Guillaume Nault 

Sure, this makes sense applied.
In theory, you could have just dropped them from the JSON output.


[PATCH iproute2] ip/l2tp: remove offset and peer-offset options

2018-04-03 Thread Guillaume Nault
Ignore options "peer-offset" and "offset" when creating sessions. Keep
them when dumping sessions in order to avoid breaking external scripts.

"peer-offset" has always been a noop in iproute2. "offset" is now
ignored in Linux 4.16 (and was broken before that).

Signed-off-by: Guillaume Nault 
---
 ip/ipl2tp.c| 23 ---
 man/man8/ip-l2tp.8 | 16 
 2 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index 750f912a..427e0249 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -42,8 +42,6 @@ struct l2tp_parm {
uint32_t peer_tunnel_id;
uint32_t session_id;
uint32_t peer_session_id;
-   uint32_t offset;
-   uint32_t peer_offset;
enum l2tp_encap_type encap;
uint16_t local_udp_port;
uint16_t peer_udp_port;
@@ -174,8 +172,6 @@ static int create_session(struct l2tp_parm *p)
if (p->reorder_timeout)
addattr64(, 1024, L2TP_ATTR_RECV_TIMEOUT,
  p->reorder_timeout);
-   if (p->offset)
-   addattr16(, 1024, L2TP_ATTR_OFFSET, p->offset);
if (p->cookie_len)
addattr_l(, 1024, L2TP_ATTR_COOKIE,
  p->cookie, p->cookie_len);
@@ -310,8 +306,8 @@ static void print_session(struct l2tp_data *data)
print_string(PRINT_FP, NULL, "%s", _SL_);
}
 
-   print_uint(PRINT_ANY, "offset", "  offset %u,", p->offset);
-   print_uint(PRINT_ANY, "peer_offset", " peer offset %u\n", 
p->peer_offset);
+   print_uint(PRINT_ANY, "offset", "  offset %u,", 0);
+   print_uint(PRINT_ANY, "peer_offset", " peer offset %u\n", 0);
 
if (p->cookie_len > 0)
print_cookie("cookie", "cookie",
@@ -362,8 +358,6 @@ static int get_response(struct nlmsghdr *n, void *arg)
p->pw_type = rta_getattr_u16(attrs[L2TP_ATTR_PW_TYPE]);
if (attrs[L2TP_ATTR_ENCAP_TYPE])
p->encap = rta_getattr_u16(attrs[L2TP_ATTR_ENCAP_TYPE]);
-   if (attrs[L2TP_ATTR_OFFSET])
-   p->offset = rta_getattr_u16(attrs[L2TP_ATTR_OFFSET]);
if (attrs[L2TP_ATTR_DATA_SEQ])
p->data_seq = rta_getattr_u16(attrs[L2TP_ATTR_DATA_SEQ]);
if (attrs[L2TP_ATTR_CONN_ID])
@@ -550,7 +544,6 @@ static void usage(void)
"  tunnel_id ID\n"
"  session_id ID peer_session_id ID\n"
"  [ cookie HEXSTR ] [ peer_cookie HEXSTR ]\n"
-   "  [ offset OFFSET ] [ peer_offset OFFSET ]\n"
"  [ seq { none | send | recv | both } ]\n"
"  [ l2spec_type L2SPEC ]\n"
"   ip l2tp del tunnel tunnel_id ID\n"
@@ -678,19 +671,11 @@ static int parse_args(int argc, char **argv, int cmd, 
struct l2tp_parm *p)
invarg("invalid option for udp6_csum_tx\n"
, *argv);
} else if (strcmp(*argv, "offset") == 0) {
-   __u8 uval;
-
+   fprintf(stderr, "Ignoring option \"offset\"\n");
NEXT_ARG();
-   if (get_u8(, *argv, 0))
-   invarg("invalid offset\n", *argv);
-   p->offset = uval;
} else if (strcmp(*argv, "peer_offset") == 0) {
-   __u8 uval;
-
+   fprintf(stderr, "Ignoring option \"peer_offset\"\n");
NEXT_ARG();
-   if (get_u8(, *argv, 0))
-   invarg("invalid offset\n", *argv);
-   p->peer_offset = uval;
} else if (strcmp(*argv, "cookie") == 0) {
int slen;
 
diff --git a/man/man8/ip-l2tp.8 b/man/man8/ip-l2tp.8
index 8ce630a6..9aba6bec 100644
--- a/man/man8/ip-l2tp.8
+++ b/man/man8/ip-l2tp.8
@@ -59,12 +59,6 @@ ip-l2tp - L2TPv3 static unmanaged tunnel configuration
 .br
 .RB "[ " seq " { " none " | " send " | " recv " | " both " } ]"
 .br
-.RB "[ " offset
-.IR OFFSET
-.RB " ] [ " peer_offset
-.IR OFFSET
-.RB " ]"
-.br
 .ti -8
 .BR "ip l2tp del tunnel"
 .B tunnel_id
@@ -285,16 +279,6 @@ Default is
 .br
 Valid values are:
 .BR none ", " send ", " recv ", " both "."
-.TP
-.BI offset " OFFSET"
-sets the byte offset from the L2TP header where user data starts in
-transmitted L2TP data packets. This is hardly ever used. If set, the
-value must match the peer_offset value used at the peer. Default is 0.
-.TP
-.BI peer_offset " OFFSET"
-sets the byte offset from the L2TP header where user data starts in
-received L2TP data packets. This is hardly ever used. If set, the
-value must match the offset value used at the peer. Default is 0.
 .SS ip l2tp del session - destroy a session
 .TP
 .BI tunnel_id " ID"
-- 
2.16.3