All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation
@ 2016-11-04 23:11 Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 2/7] man: ip-l2tp.8: remove non-existent tunnel parameter name Asbjørn Sloth Tønnesen
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2016-11-04 23:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: James Chapman, netdev

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 man/man8/ip-l2tp.8 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man/man8/ip-l2tp.8 b/man/man8/ip-l2tp.8
index 5b7041f..4a3bb20 100644
--- a/man/man8/ip-l2tp.8
+++ b/man/man8/ip-l2tp.8
@@ -239,7 +239,7 @@ find in received L2TP packets. Default is to use no cookie.
 set the layer2specific header type of the session.
 .br
 Valid values are:
-.BR none ", " udp "."
+.BR none ", " default "."
 .TP
 .BI offset " OFFSET"
 sets the byte offset from the L2TP header where user data starts in
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH iproute2 2/7] man: ip-l2tp.8: remove non-existent tunnel parameter name
  2016-11-04 23:11 [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
@ 2016-11-04 23:11 ` Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 3/7] l2tp: fix integers with too few significant bits Asbjørn Sloth Tønnesen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2016-11-04 23:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: James Chapman, netdev

The name parameter is only valid for sessions, not tunnels.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 man/man8/ip-l2tp.8 | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/man/man8/ip-l2tp.8 b/man/man8/ip-l2tp.8
index 4a3bb20..991d097 100644
--- a/man/man8/ip-l2tp.8
+++ b/man/man8/ip-l2tp.8
@@ -154,9 +154,6 @@ tunnels and sessions to be established and provides for detecting and
 acting upon network failures.
 .SS ip l2tp add tunnel - add a new tunnel
 .TP
-.BI name " NAME "
-sets the session network interface name. Default is l2tpethN.
-.TP
 .BI tunnel_id " ID"
 set the tunnel id, which is a 32-bit integer value. Uniquely
 identifies the tunnel. The value used must match the peer_tunnel_id
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH iproute2 3/7] l2tp: fix integers with too few significant bits
  2016-11-04 23:11 [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 2/7] man: ip-l2tp.8: remove non-existent tunnel parameter name Asbjørn Sloth Tønnesen
@ 2016-11-04 23:11 ` Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 4/7] l2tp: fix L2TP_ATTR_{RECV,SEND}_SEQ handling Asbjørn Sloth Tønnesen
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2016-11-04 23:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: James Chapman, netdev

udp6_csum{,_tx,_rx}, tunnel and session are the only ones
currently used.

recv_seq, send_seq, lns_mode and data_seq are partially
implemented in a useless way.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 ip/ipl2tp.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index d3338ac..2e0e9c7 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -56,15 +56,15 @@ struct l2tp_parm {
 
 	uint16_t pw_type;
 	uint16_t mtu;
-	int udp6_csum_tx:1;
-	int udp6_csum_rx:1;
-	int udp_csum:1;
-	int recv_seq:1;
-	int send_seq:1;
-	int lns_mode:1;
-	int data_seq:2;
-	int tunnel:1;
-	int session:1;
+	unsigned int udp6_csum_tx:1;
+	unsigned int udp6_csum_rx:1;
+	unsigned int udp_csum:1;
+	unsigned int recv_seq:1;
+	unsigned int send_seq:1;
+	unsigned int lns_mode:1;
+	unsigned int data_seq:2;
+	unsigned int tunnel:1;
+	unsigned int session:1;
 	int reorder_timeout;
 	const char *ifname;
 	uint8_t l2spec_type;
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH iproute2 4/7] l2tp: fix L2TP_ATTR_{RECV,SEND}_SEQ handling
  2016-11-04 23:11 [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 2/7] man: ip-l2tp.8: remove non-existent tunnel parameter name Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 3/7] l2tp: fix integers with too few significant bits Asbjørn Sloth Tønnesen
@ 2016-11-04 23:11 ` Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 5/7] l2tp: support sequence numbering Asbjørn Sloth Tønnesen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2016-11-04 23:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: James Chapman, netdev

L2TP_ATTR_RECV_SEQ and L2TP_ATTR_SEND_SEQ are declared as NLA_U8
attributes in the kernel, so let's threat them accordingly.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 ip/ipl2tp.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index 2e0e9c7..af89e2f 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -160,8 +160,8 @@ static int create_session(struct l2tp_parm *p)
 	addattr8(&req.n, 1024, L2TP_ATTR_L2SPEC_LEN, p->l2spec_len);
 
 	if (p->mtu)		addattr16(&req.n, 1024, L2TP_ATTR_MTU, p->mtu);
-	if (p->recv_seq)	addattr(&req.n, 1024, L2TP_ATTR_RECV_SEQ);
-	if (p->send_seq)	addattr(&req.n, 1024, L2TP_ATTR_SEND_SEQ);
+	if (p->recv_seq)	addattr8(&req.n, 1024, L2TP_ATTR_RECV_SEQ, 1);
+	if (p->send_seq)	addattr8(&req.n, 1024, L2TP_ATTR_SEND_SEQ, 1);
 	if (p->lns_mode)	addattr(&req.n, 1024, L2TP_ATTR_LNS_MODE);
 	if (p->data_seq)	addattr8(&req.n, 1024, L2TP_ATTR_DATA_SEQ, p->data_seq);
 	if (p->reorder_timeout) addattr64(&req.n, 1024, L2TP_ATTR_RECV_TIMEOUT,
@@ -304,8 +304,10 @@ static int get_response(struct nlmsghdr *n, void *arg)
 		memcpy(p->peer_cookie, RTA_DATA(attrs[L2TP_ATTR_PEER_COOKIE]),
 		       p->peer_cookie_len = RTA_PAYLOAD(attrs[L2TP_ATTR_PEER_COOKIE]));
 
-	p->recv_seq = !!attrs[L2TP_ATTR_RECV_SEQ];
-	p->send_seq = !!attrs[L2TP_ATTR_SEND_SEQ];
+	if (attrs[L2TP_ATTR_RECV_SEQ])
+		p->recv_seq = rta_getattr_u8(attrs[L2TP_ATTR_RECV_SEQ]);
+	if (attrs[L2TP_ATTR_SEND_SEQ])
+		p->send_seq = rta_getattr_u8(attrs[L2TP_ATTR_SEND_SEQ]);
 
 	if (attrs[L2TP_ATTR_RECV_TIMEOUT])
 		p->reorder_timeout = rta_getattr_u64(attrs[L2TP_ATTR_RECV_TIMEOUT]);
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH iproute2 5/7] l2tp: support sequence numbering
  2016-11-04 23:11 [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
                   ` (2 preceding siblings ...)
  2016-11-04 23:11 ` [PATCH iproute2 4/7] l2tp: fix L2TP_ATTR_{RECV,SEND}_SEQ handling Asbjørn Sloth Tønnesen
@ 2016-11-04 23:11 ` Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 6/7] l2tp: read IPv6 UDP checksum attributes from kernel Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 7/7] l2tp: show tunnel: expose UDP checksum state Asbjørn Sloth Tønnesen
  5 siblings, 0 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2016-11-04 23:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: James Chapman, netdev

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 ip/ipl2tp.c        | 23 +++++++++++++++++++++++
 man/man8/ip-l2tp.8 | 15 +++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index af89e2f..6d00d09 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -246,6 +246,12 @@ static void print_session(struct l2tp_data *data)
 		printf("  reorder timeout: %u\n", p->reorder_timeout);
 	else
 		printf("\n");
+	if (p->send_seq || p->recv_seq) {
+		printf("  sequence numbering:");
+		if (p->send_seq) printf(" send");
+		if (p->recv_seq) printf(" recv");
+		printf("\n");
+	}
 }
 
 static int get_response(struct nlmsghdr *n, void *arg)
@@ -483,6 +489,7 @@ static void usage(void)
 	fprintf(stderr, "          session_id ID peer_session_id ID\n");
 	fprintf(stderr, "          [ cookie HEXSTR ] [ peer_cookie HEXSTR ]\n");
 	fprintf(stderr, "          [ offset OFFSET ] [ peer_offset OFFSET ]\n");
+	fprintf(stderr, "          [ seq { none | send | recv | both } ]\n");
 	fprintf(stderr, "          [ l2spec_type L2SPEC ]\n");
 	fprintf(stderr, "       ip l2tp del tunnel tunnel_id ID\n");
 	fprintf(stderr, "       ip l2tp del session tunnel_id ID session_id ID\n");
@@ -653,6 +660,22 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
 				fprintf(stderr, "Unknown layer2specific header type \"%s\"\n", *argv);
 				exit(-1);
 			}
+		} else if (strcmp(*argv, "seq") == 0) {
+			NEXT_ARG();
+			if (strcasecmp(*argv, "both") == 0) {
+				p->recv_seq = 1;
+				p->send_seq = 1;
+			} else if (strcasecmp(*argv, "recv") == 0) {
+				p->recv_seq = 1;
+			} else if (strcasecmp(*argv, "send") == 0) {
+				p->send_seq = 1;
+			} else if (strcasecmp(*argv, "none") == 0) {
+				p->recv_seq = 0;
+				p->send_seq = 0;
+			} else {
+				fprintf(stderr, "Unknown seq value \"%s\"\n", *argv);
+				exit(-1);
+			}
 		} else if (strcmp(*argv, "tunnel") == 0) {
 			p->tunnel = 1;
 		} else if (strcmp(*argv, "session") == 0) {
diff --git a/man/man8/ip-l2tp.8 b/man/man8/ip-l2tp.8
index 991d097..d4e7270 100644
--- a/man/man8/ip-l2tp.8
+++ b/man/man8/ip-l2tp.8
@@ -51,6 +51,8 @@ ip-l2tp - L2TPv3 static unmanaged tunnel configuration
 .br
 .RB "[ " l2spec_type " { " none " | " default " } ]"
 .br
+.RB "[ " seq " { " none " | " send " | " recv " | " both " } ]"
+.br
 .RB "[ " offset
 .IR OFFSET
 .RB " ] [ " peer_offset
@@ -238,6 +240,19 @@ set the layer2specific header type of the session.
 Valid values are:
 .BR none ", " default "."
 .TP
+.BI seq " SEQ"
+controls sequence numbering to prevent or detect out of order packets.
+.B send
+puts a sequence number in the default layer2specific header of each
+outgoing packet.
+.B recv
+reorder packets if they are received out of order.
+Default is
+.BR none "."
+.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
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH iproute2 6/7] l2tp: read IPv6 UDP checksum attributes from kernel
  2016-11-04 23:11 [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
                   ` (3 preceding siblings ...)
  2016-11-04 23:11 ` [PATCH iproute2 5/7] l2tp: support sequence numbering Asbjørn Sloth Tønnesen
@ 2016-11-04 23:11 ` Asbjørn Sloth Tønnesen
  2016-11-04 23:11 ` [PATCH iproute2 7/7] l2tp: show tunnel: expose UDP checksum state Asbjørn Sloth Tønnesen
  5 siblings, 0 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2016-11-04 23:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: James Chapman, netdev

In case of an older kernel that doesn't set L2TP_ATTR_UDP_ZERO_CSUM6_{R,T}X
the old hard-coded value is being preserved, since the attribute flag will be
missing.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 ip/ipl2tp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index 6d00d09..8f3268d 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -296,12 +296,9 @@ static int get_response(struct nlmsghdr *n, void *arg)
 		p->l2spec_len = rta_getattr_u8(attrs[L2TP_ATTR_L2SPEC_LEN]);
 
 	p->udp_csum = !!attrs[L2TP_ATTR_UDP_CSUM];
-	/*
-	 * Not fetching from L2TP_ATTR_UDP_ZERO_CSUM6_{T,R}X because the
-	 * kernel doesn't send it so just leave it as default value.
-	 */
-	p->udp6_csum_tx = 1;
-	p->udp6_csum_rx = 1;
+	p->udp6_csum_tx = !attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX];
+	p->udp6_csum_rx = !attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX];
+
 	if (attrs[L2TP_ATTR_COOKIE])
 		memcpy(p->cookie, RTA_DATA(attrs[L2TP_ATTR_COOKIE]),
 		       p->cookie_len = RTA_PAYLOAD(attrs[L2TP_ATTR_COOKIE]));
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH iproute2 7/7] l2tp: show tunnel: expose UDP checksum state
  2016-11-04 23:11 [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
                   ` (4 preceding siblings ...)
  2016-11-04 23:11 ` [PATCH iproute2 6/7] l2tp: read IPv6 UDP checksum attributes from kernel Asbjørn Sloth Tønnesen
@ 2016-11-04 23:11 ` Asbjørn Sloth Tønnesen
  5 siblings, 0 replies; 7+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2016-11-04 23:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: James Chapman, netdev

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 ip/ipl2tp.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index 8f3268d..27dc184 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -218,9 +218,24 @@ static void print_tunnel(const struct l2tp_data *data)
 	printf("  Peer tunnel %u\n",
 	       p->peer_tunnel_id);
 
-	if (p->encap == L2TP_ENCAPTYPE_UDP)
+	if (p->encap == L2TP_ENCAPTYPE_UDP) {
 		printf("  UDP source / dest ports: %hu/%hu\n",
 		       p->local_udp_port, p->peer_udp_port);
+
+		switch (p->local_ip.family) {
+		case AF_INET:
+			printf("  UDP checksum: %s\n",
+			       p->udp_csum ? "enabled" : "disabled");
+			break;
+		case AF_INET6:
+			printf("  UDP checksum: %s%s%s%s\n",
+			       p->udp6_csum_tx && p->udp6_csum_rx ? "enabled" : "",
+			       p->udp6_csum_tx && !p->udp6_csum_rx ? "tx" : "",
+			       !p->udp6_csum_tx && p->udp6_csum_rx ? "rx" : "",
+			       !p->udp6_csum_tx && !p->udp6_csum_rx ? "disabled" : "");
+			break;
+		}
+	}
 }
 
 static void print_session(struct l2tp_data *data)
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-04 23:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04 23:11 [PATCH iproute2 1/7] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
2016-11-04 23:11 ` [PATCH iproute2 2/7] man: ip-l2tp.8: remove non-existent tunnel parameter name Asbjørn Sloth Tønnesen
2016-11-04 23:11 ` [PATCH iproute2 3/7] l2tp: fix integers with too few significant bits Asbjørn Sloth Tønnesen
2016-11-04 23:11 ` [PATCH iproute2 4/7] l2tp: fix L2TP_ATTR_{RECV,SEND}_SEQ handling Asbjørn Sloth Tønnesen
2016-11-04 23:11 ` [PATCH iproute2 5/7] l2tp: support sequence numbering Asbjørn Sloth Tønnesen
2016-11-04 23:11 ` [PATCH iproute2 6/7] l2tp: read IPv6 UDP checksum attributes from kernel Asbjørn Sloth Tønnesen
2016-11-04 23:11 ` [PATCH iproute2 7/7] l2tp: show tunnel: expose UDP checksum state Asbjørn Sloth Tønnesen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.