diff options
-rw-r--r-- | include/uapi/linux/l2tp.h | 3 | ||||
-rw-r--r-- | net/l2tp/l2tp_core.c | 15 | ||||
-rw-r--r-- | net/l2tp/l2tp_core.h | 10 | ||||
-rw-r--r-- | net/l2tp/l2tp_debugfs.c | 6 | ||||
-rw-r--r-- | net/l2tp/l2tp_netlink.c | 24 |
5 files changed, 7 insertions, 51 deletions
diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h index d6fee55dbded..f78eef4cc56a 100644 --- a/include/uapi/linux/l2tp.h +++ b/include/uapi/linux/l2tp.h | |||
@@ -94,7 +94,7 @@ enum { | |||
94 | L2TP_ATTR_NONE, /* no data */ | 94 | L2TP_ATTR_NONE, /* no data */ |
95 | L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ | 95 | L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ |
96 | L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ | 96 | L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ |
97 | L2TP_ATTR_OFFSET, /* u16 */ | 97 | L2TP_ATTR_OFFSET, /* u16 (not used) */ |
98 | L2TP_ATTR_DATA_SEQ, /* u16 */ | 98 | L2TP_ATTR_DATA_SEQ, /* u16 */ |
99 | L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ | 99 | L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ |
100 | L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */ | 100 | L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */ |
@@ -127,7 +127,6 @@ enum { | |||
127 | L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* flag */ | 127 | L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* flag */ |
128 | L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* flag */ | 128 | L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* flag */ |
129 | L2TP_ATTR_PAD, | 129 | L2TP_ATTR_PAD, |
130 | L2TP_ATTR_PEER_OFFSET, /* u16 */ | ||
131 | __L2TP_ATTR_MAX, | 130 | __L2TP_ATTR_MAX, |
132 | }; | 131 | }; |
133 | 132 | ||
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 6ff64717da1e..786cd7f6a5e8 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -780,10 +780,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
780 | } | 780 | } |
781 | } | 781 | } |
782 | 782 | ||
783 | /* Session data offset is handled differently for L2TPv2 and | 783 | /* Session data offset is defined only for L2TPv2 and is |
784 | * L2TPv3. For L2TPv2, there is an optional 16-bit value in | 784 | * indicated by an optional 16-bit value in the header. |
785 | * the header. For L2TPv3, the offset is negotiated using AVPs | ||
786 | * in the session setup control protocol. | ||
787 | */ | 785 | */ |
788 | if (tunnel->version == L2TP_HDR_VER_2) { | 786 | if (tunnel->version == L2TP_HDR_VER_2) { |
789 | /* If offset bit set, skip it. */ | 787 | /* If offset bit set, skip it. */ |
@@ -791,8 +789,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
791 | offset = ntohs(*(__be16 *)ptr); | 789 | offset = ntohs(*(__be16 *)ptr); |
792 | ptr += 2 + offset; | 790 | ptr += 2 + offset; |
793 | } | 791 | } |
794 | } else | 792 | } |
795 | ptr += session->peer_offset; | ||
796 | 793 | ||
797 | offset = ptr - optr; | 794 | offset = ptr - optr; |
798 | if (!pskb_may_pull(skb, offset)) | 795 | if (!pskb_may_pull(skb, offset)) |
@@ -1068,8 +1065,6 @@ static int l2tp_build_l2tpv3_header(struct l2tp_session *session, void *buf) | |||
1068 | } | 1065 | } |
1069 | bufp += session->l2specific_len; | 1066 | bufp += session->l2specific_len; |
1070 | } | 1067 | } |
1071 | if (session->offset) | ||
1072 | bufp += session->offset; | ||
1073 | 1068 | ||
1074 | return bufp - optr; | 1069 | return bufp - optr; |
1075 | } | 1070 | } |
@@ -1734,7 +1729,7 @@ void l2tp_session_set_header_len(struct l2tp_session *session, int version) | |||
1734 | if (session->send_seq) | 1729 | if (session->send_seq) |
1735 | session->hdr_len += 4; | 1730 | session->hdr_len += 4; |
1736 | } else { | 1731 | } else { |
1737 | session->hdr_len = 4 + session->cookie_len + session->l2specific_len + session->offset; | 1732 | session->hdr_len = 4 + session->cookie_len + session->l2specific_len; |
1738 | if (session->tunnel->encap == L2TP_ENCAPTYPE_UDP) | 1733 | if (session->tunnel->encap == L2TP_ENCAPTYPE_UDP) |
1739 | session->hdr_len += 4; | 1734 | session->hdr_len += 4; |
1740 | } | 1735 | } |
@@ -1784,8 +1779,6 @@ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunn | |||
1784 | session->recv_seq = cfg->recv_seq; | 1779 | session->recv_seq = cfg->recv_seq; |
1785 | session->lns_mode = cfg->lns_mode; | 1780 | session->lns_mode = cfg->lns_mode; |
1786 | session->reorder_timeout = cfg->reorder_timeout; | 1781 | session->reorder_timeout = cfg->reorder_timeout; |
1787 | session->offset = cfg->offset; | ||
1788 | session->peer_offset = cfg->peer_offset; | ||
1789 | session->l2specific_type = cfg->l2specific_type; | 1782 | session->l2specific_type = cfg->l2specific_type; |
1790 | session->l2specific_len = cfg->l2specific_len; | 1783 | session->l2specific_len = cfg->l2specific_len; |
1791 | session->cookie_len = cfg->cookie_len; | 1784 | session->cookie_len = cfg->cookie_len; |
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index c6fe7cc42a05..c2e9bbd79b35 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h | |||
@@ -59,8 +59,6 @@ struct l2tp_session_cfg { | |||
59 | int debug; /* bitmask of debug message | 59 | int debug; /* bitmask of debug message |
60 | * categories */ | 60 | * categories */ |
61 | u16 vlan_id; /* VLAN pseudowire only */ | 61 | u16 vlan_id; /* VLAN pseudowire only */ |
62 | u16 offset; /* offset to tx payload */ | ||
63 | u16 peer_offset; /* offset to rx payload */ | ||
64 | u16 l2specific_len; /* Layer 2 specific length */ | 62 | u16 l2specific_len; /* Layer 2 specific length */ |
65 | u16 l2specific_type; /* Layer 2 specific type */ | 63 | u16 l2specific_type; /* Layer 2 specific type */ |
66 | u8 cookie[8]; /* optional cookie */ | 64 | u8 cookie[8]; /* optional cookie */ |
@@ -87,14 +85,6 @@ struct l2tp_session { | |||
87 | int cookie_len; | 85 | int cookie_len; |
88 | u8 peer_cookie[8]; | 86 | u8 peer_cookie[8]; |
89 | int peer_cookie_len; | 87 | int peer_cookie_len; |
90 | u16 offset; /* offset from end of L2TP | ||
91 | * header to beginning of | ||
92 | * tx data | ||
93 | */ | ||
94 | u16 peer_offset; /* offset from end of L2TP | ||
95 | * header to beginning of | ||
96 | * rx data | ||
97 | */ | ||
98 | u16 l2specific_len; | 88 | u16 l2specific_len; |
99 | u16 l2specific_type; | 89 | u16 l2specific_type; |
100 | u16 hdr_len; | 90 | u16 hdr_len; |
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c index 4cc30b38aba4..2c30587d1a14 100644 --- a/net/l2tp/l2tp_debugfs.c +++ b/net/l2tp/l2tp_debugfs.c | |||
@@ -180,8 +180,7 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v) | |||
180 | session->lns_mode ? "LNS" : "LAC", | 180 | session->lns_mode ? "LNS" : "LAC", |
181 | session->debug, | 181 | session->debug, |
182 | jiffies_to_msecs(session->reorder_timeout)); | 182 | jiffies_to_msecs(session->reorder_timeout)); |
183 | seq_printf(m, " offset %hu peer_offset %hu l2specific %hu/%hu\n", | 183 | seq_printf(m, " offset 0 l2specific %hu/%hu\n", |
184 | session->offset, session->peer_offset, | ||
185 | session->l2specific_type, session->l2specific_len); | 184 | session->l2specific_type, session->l2specific_len); |
186 | if (session->cookie_len) { | 185 | if (session->cookie_len) { |
187 | seq_printf(m, " cookie %02x%02x%02x%02x", | 186 | seq_printf(m, " cookie %02x%02x%02x%02x", |
@@ -229,8 +228,7 @@ static int l2tp_dfs_seq_show(struct seq_file *m, void *v) | |||
229 | seq_puts(m, " debug tx-pkts/bytes/errs rx-pkts/bytes/errs\n"); | 228 | seq_puts(m, " debug tx-pkts/bytes/errs rx-pkts/bytes/errs\n"); |
230 | seq_puts(m, " SESSION ID, peer ID, PWTYPE\n"); | 229 | seq_puts(m, " SESSION ID, peer ID, PWTYPE\n"); |
231 | seq_puts(m, " refcnt cnt\n"); | 230 | seq_puts(m, " refcnt cnt\n"); |
232 | seq_puts(m, " offset OFFSET peer_offset OFFSET"); | 231 | seq_puts(m, " offset OFFSET l2specific TYPE/LEN\n"); |
233 | seq_puts(m, " l2specific TYPE/LEN\n"); | ||
234 | seq_puts(m, " [ cookie ]\n"); | 232 | seq_puts(m, " [ cookie ]\n"); |
235 | seq_puts(m, " [ peer cookie ]\n"); | 233 | seq_puts(m, " [ peer cookie ]\n"); |
236 | seq_puts(m, " config mtu/mru/rcvseq/sendseq/dataseq/lns debug reorderto\n"); | 234 | seq_puts(m, " config mtu/mru/rcvseq/sendseq/dataseq/lns debug reorderto\n"); |
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index d7d4d7a7a54d..e1ca29f79821 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
@@ -547,25 +547,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf | |||
547 | } | 547 | } |
548 | 548 | ||
549 | if (tunnel->version > 2) { | 549 | if (tunnel->version > 2) { |
550 | if (info->attrs[L2TP_ATTR_PEER_OFFSET]) { | ||
551 | struct nlattr *peer_offset; | ||
552 | |||
553 | peer_offset = info->attrs[L2TP_ATTR_PEER_OFFSET]; | ||
554 | cfg.peer_offset = nla_get_u16(peer_offset); | ||
555 | } | ||
556 | |||
557 | if (info->attrs[L2TP_ATTR_OFFSET]) { | ||
558 | cfg.offset = nla_get_u16(info->attrs[L2TP_ATTR_OFFSET]); | ||
559 | |||
560 | /* in order to maintain compatibility with older | ||
561 | * versions where offset was used for both tx and | ||
562 | * rx side, update rx side with offset if peer_offset | ||
563 | * is not provided by userspace | ||
564 | */ | ||
565 | if (!info->attrs[L2TP_ATTR_PEER_OFFSET]) | ||
566 | cfg.peer_offset = cfg.offset; | ||
567 | } | ||
568 | |||
569 | if (info->attrs[L2TP_ATTR_DATA_SEQ]) | 550 | if (info->attrs[L2TP_ATTR_DATA_SEQ]) |
570 | cfg.data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]); | 551 | cfg.data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]); |
571 | 552 | ||
@@ -777,10 +758,6 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl | |||
777 | 758 | ||
778 | if ((session->ifname[0] && | 759 | if ((session->ifname[0] && |
779 | nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) || | 760 | nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) || |
780 | (session->offset && | ||
781 | nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset)) || | ||
782 | (session->peer_offset && | ||
783 | nla_put_u16(skb, L2TP_ATTR_PEER_OFFSET, session->peer_offset)) || | ||
784 | (session->cookie_len && | 761 | (session->cookie_len && |
785 | nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len, | 762 | nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len, |
786 | &session->cookie[0])) || | 763 | &session->cookie[0])) || |
@@ -921,7 +898,6 @@ static const struct nla_policy l2tp_nl_policy[L2TP_ATTR_MAX + 1] = { | |||
921 | [L2TP_ATTR_PW_TYPE] = { .type = NLA_U16, }, | 898 | [L2TP_ATTR_PW_TYPE] = { .type = NLA_U16, }, |
922 | [L2TP_ATTR_ENCAP_TYPE] = { .type = NLA_U16, }, | 899 | [L2TP_ATTR_ENCAP_TYPE] = { .type = NLA_U16, }, |
923 | [L2TP_ATTR_OFFSET] = { .type = NLA_U16, }, | 900 | [L2TP_ATTR_OFFSET] = { .type = NLA_U16, }, |
924 | [L2TP_ATTR_PEER_OFFSET] = { .type = NLA_U16, }, | ||
925 | [L2TP_ATTR_DATA_SEQ] = { .type = NLA_U8, }, | 901 | [L2TP_ATTR_DATA_SEQ] = { .type = NLA_U8, }, |
926 | [L2TP_ATTR_L2SPEC_TYPE] = { .type = NLA_U8, }, | 902 | [L2TP_ATTR_L2SPEC_TYPE] = { .type = NLA_U8, }, |
927 | [L2TP_ATTR_L2SPEC_LEN] = { .type = NLA_U8, }, | 903 | [L2TP_ATTR_L2SPEC_LEN] = { .type = NLA_U8, }, |