Commit 1d4b016f authored by David S. Miller's avatar David S. Miller

Merge branch 'l2tp-remove-unused-session-fields'

Guillaume Nault says:

====================
l2tp: remove unused session fields

Several fields of the session structures can be set, but remain unused
otherwise.

This series removes these fields and explicitely ignores the
associated ioctls and netlink attributes.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3e4e3643 92ea4a7e
...@@ -60,14 +60,14 @@ struct sockaddr_l2tpip6 { ...@@ -60,14 +60,14 @@ struct sockaddr_l2tpip6 {
/* /*
* Commands. * Commands.
* Valid TLVs of each command are:- * Valid TLVs of each command are:-
* TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum
* TUNNEL_DELETE - CONN_ID * TUNNEL_DELETE - CONN_ID
* TUNNEL_MODIFY - CONN_ID, udpcsum * TUNNEL_MODIFY - CONN_ID, udpcsum
* TUNNEL_GETSTATS - CONN_ID, (stats) * TUNNEL_GETSTATS - CONN_ID, (stats)
* TUNNEL_GET - CONN_ID, (...) * TUNNEL_GET - CONN_ID, (...)
* SESSION_CREATE - SESSION_ID, PW_TYPE, data_seq, cookie, peer_cookie, l2spec * SESSION_CREATE - SESSION_ID, PW_TYPE, cookie, peer_cookie, l2spec
* SESSION_DELETE - SESSION_ID * SESSION_DELETE - SESSION_ID
* SESSION_MODIFY - SESSION_ID, data_seq * SESSION_MODIFY - SESSION_ID
* SESSION_GET - SESSION_ID, (...) * SESSION_GET - SESSION_ID, (...)
* SESSION_GETSTATS - SESSION_ID, (stats) * SESSION_GETSTATS - SESSION_ID, (stats)
* *
...@@ -95,7 +95,7 @@ enum { ...@@ -95,7 +95,7 @@ enum {
L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */ L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */ L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
L2TP_ATTR_OFFSET, /* u16 (not used) */ L2TP_ATTR_OFFSET, /* u16 (not used) */
L2TP_ATTR_DATA_SEQ, /* u16 */ L2TP_ATTR_DATA_SEQ, /* u16 (not used) */
L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */ L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
L2TP_ATTR_L2SPEC_LEN, /* u8 (not used) */ L2TP_ATTR_L2SPEC_LEN, /* u8 (not used) */
L2TP_ATTR_PROTO_VERSION, /* u8 */ L2TP_ATTR_PROTO_VERSION, /* u8 */
...@@ -105,7 +105,7 @@ enum { ...@@ -105,7 +105,7 @@ enum {
L2TP_ATTR_SESSION_ID, /* u32 */ L2TP_ATTR_SESSION_ID, /* u32 */
L2TP_ATTR_PEER_SESSION_ID, /* u32 */ L2TP_ATTR_PEER_SESSION_ID, /* u32 */
L2TP_ATTR_UDP_CSUM, /* u8 */ L2TP_ATTR_UDP_CSUM, /* u8 */
L2TP_ATTR_VLAN_ID, /* u16 */ L2TP_ATTR_VLAN_ID, /* u16 (not used) */
L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */ L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */ L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */ L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */
...@@ -120,7 +120,7 @@ enum { ...@@ -120,7 +120,7 @@ enum {
L2TP_ATTR_UDP_SPORT, /* u16 */ L2TP_ATTR_UDP_SPORT, /* u16 */
L2TP_ATTR_UDP_DPORT, /* u16 */ L2TP_ATTR_UDP_DPORT, /* u16 */
L2TP_ATTR_MTU, /* u16 */ L2TP_ATTR_MTU, /* u16 */
L2TP_ATTR_MRU, /* u16 */ L2TP_ATTR_MRU, /* u16 (not used) */
L2TP_ATTR_STATS, /* nested */ L2TP_ATTR_STATS, /* nested */
L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
...@@ -169,6 +169,7 @@ enum l2tp_encap_type { ...@@ -169,6 +169,7 @@ enum l2tp_encap_type {
L2TP_ENCAPTYPE_IP, L2TP_ENCAPTYPE_IP,
}; };
/* For L2TP_ATTR_DATA_SEQ. Unused. */
enum l2tp_seqmode { enum l2tp_seqmode {
L2TP_SEQ_NONE = 0, L2TP_SEQ_NONE = 0,
L2TP_SEQ_IP = 1, L2TP_SEQ_IP = 1,
......
...@@ -1675,7 +1675,6 @@ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunn ...@@ -1675,7 +1675,6 @@ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunn
session->pwtype = cfg->pw_type; session->pwtype = cfg->pw_type;
session->debug = cfg->debug; session->debug = cfg->debug;
session->mtu = cfg->mtu; session->mtu = cfg->mtu;
session->mru = cfg->mru;
session->send_seq = cfg->send_seq; session->send_seq = cfg->send_seq;
session->recv_seq = cfg->recv_seq; session->recv_seq = cfg->recv_seq;
session->lns_mode = cfg->lns_mode; session->lns_mode = cfg->lns_mode;
......
...@@ -45,10 +45,6 @@ struct l2tp_tunnel; ...@@ -45,10 +45,6 @@ struct l2tp_tunnel;
*/ */
struct l2tp_session_cfg { struct l2tp_session_cfg {
enum l2tp_pwtype pw_type; enum l2tp_pwtype pw_type;
unsigned int data_seq:2; /* data sequencing level
* 0 => none, 1 => IP only,
* 2 => all
*/
unsigned int recv_seq:1; /* expect receive packets with unsigned int recv_seq:1; /* expect receive packets with
* sequence numbers? */ * sequence numbers? */
unsigned int send_seq:1; /* send packets with sequence unsigned int send_seq:1; /* send packets with sequence
...@@ -58,7 +54,6 @@ struct l2tp_session_cfg { ...@@ -58,7 +54,6 @@ struct l2tp_session_cfg {
* control of LNS. */ * control of LNS. */
int debug; /* bitmask of debug message int debug; /* bitmask of debug message
* categories */ * categories */
u16 vlan_id; /* VLAN pseudowire only */
u16 l2specific_type; /* Layer 2 specific type */ u16 l2specific_type; /* Layer 2 specific type */
u8 cookie[8]; /* optional cookie */ u8 cookie[8]; /* optional cookie */
int cookie_len; /* 0, 4 or 8 bytes */ int cookie_len; /* 0, 4 or 8 bytes */
...@@ -67,7 +62,6 @@ struct l2tp_session_cfg { ...@@ -67,7 +62,6 @@ struct l2tp_session_cfg {
int reorder_timeout; /* configured reorder timeout int reorder_timeout; /* configured reorder timeout
* (in jiffies) */ * (in jiffies) */
int mtu; int mtu;
int mru;
char *ifname; char *ifname;
}; };
...@@ -99,10 +93,6 @@ struct l2tp_session { ...@@ -99,10 +93,6 @@ struct l2tp_session {
char name[32]; /* for logging */ char name[32]; /* for logging */
char ifname[IFNAMSIZ]; char ifname[IFNAMSIZ];
unsigned int data_seq:2; /* data sequencing level
* 0 => none, 1 => IP only,
* 2 => all
*/
unsigned int recv_seq:1; /* expect receive packets with unsigned int recv_seq:1; /* expect receive packets with
* sequence numbers? */ * sequence numbers? */
unsigned int send_seq:1; /* send packets with sequence unsigned int send_seq:1; /* send packets with sequence
...@@ -116,7 +106,6 @@ struct l2tp_session { ...@@ -116,7 +106,6 @@ struct l2tp_session {
* (in jiffies) */ * (in jiffies) */
int reorder_skip; /* set if skip to next nr */ int reorder_skip; /* set if skip to next nr */
int mtu; int mtu;
int mru;
enum l2tp_pwtype pwtype; enum l2tp_pwtype pwtype;
struct l2tp_stats stats; struct l2tp_stats stats;
struct hlist_node global_hlist; /* Global hash list node */ struct hlist_node global_hlist; /* Global hash list node */
......
...@@ -191,12 +191,10 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v) ...@@ -191,12 +191,10 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v)
if (session->send_seq || session->recv_seq) if (session->send_seq || session->recv_seq)
seq_printf(m, " nr %hu, ns %hu\n", session->nr, session->ns); seq_printf(m, " nr %hu, ns %hu\n", session->nr, session->ns);
seq_printf(m, " refcnt %d\n", refcount_read(&session->ref_count)); seq_printf(m, " refcnt %d\n", refcount_read(&session->ref_count));
seq_printf(m, " config %d/%d/%c/%c/%s/%s %08x %u\n", seq_printf(m, " config %d/0/%c/%c/-/%s %08x %u\n",
session->mtu, session->mru, session->mtu,
session->recv_seq ? 'R' : '-', session->recv_seq ? 'R' : '-',
session->send_seq ? 'S' : '-', session->send_seq ? 'S' : '-',
session->data_seq == 1 ? "IPSEQ" :
session->data_seq == 2 ? "DATASEQ" : "-",
session->lns_mode ? "LNS" : "LAC", session->lns_mode ? "LNS" : "LAC",
session->debug, session->debug,
jiffies_to_msecs(session->reorder_timeout)); jiffies_to_msecs(session->reorder_timeout));
......
...@@ -560,9 +560,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf ...@@ -560,9 +560,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
} }
if (tunnel->version > 2) { if (tunnel->version > 2) {
if (info->attrs[L2TP_ATTR_DATA_SEQ])
cfg.data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]);
if (info->attrs[L2TP_ATTR_L2SPEC_TYPE]) { if (info->attrs[L2TP_ATTR_L2SPEC_TYPE]) {
cfg.l2specific_type = nla_get_u8(info->attrs[L2TP_ATTR_L2SPEC_TYPE]); cfg.l2specific_type = nla_get_u8(info->attrs[L2TP_ATTR_L2SPEC_TYPE]);
if (cfg.l2specific_type != L2TP_L2SPECTYPE_DEFAULT && if (cfg.l2specific_type != L2TP_L2SPECTYPE_DEFAULT &&
...@@ -594,9 +591,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf ...@@ -594,9 +591,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
} }
if (info->attrs[L2TP_ATTR_IFNAME]) if (info->attrs[L2TP_ATTR_IFNAME])
cfg.ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]); cfg.ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]);
if (info->attrs[L2TP_ATTR_VLAN_ID])
cfg.vlan_id = nla_get_u16(info->attrs[L2TP_ATTR_VLAN_ID]);
} }
if (info->attrs[L2TP_ATTR_DEBUG]) if (info->attrs[L2TP_ATTR_DEBUG])
...@@ -617,9 +611,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf ...@@ -617,9 +611,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
if (info->attrs[L2TP_ATTR_MTU]) if (info->attrs[L2TP_ATTR_MTU])
cfg.mtu = nla_get_u16(info->attrs[L2TP_ATTR_MTU]); cfg.mtu = nla_get_u16(info->attrs[L2TP_ATTR_MTU]);
if (info->attrs[L2TP_ATTR_MRU])
cfg.mru = nla_get_u16(info->attrs[L2TP_ATTR_MRU]);
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
if (l2tp_nl_cmd_ops[cfg.pw_type] == NULL) { if (l2tp_nl_cmd_ops[cfg.pw_type] == NULL) {
genl_unlock(); genl_unlock();
...@@ -693,9 +684,6 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf ...@@ -693,9 +684,6 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf
if (info->attrs[L2TP_ATTR_DEBUG]) if (info->attrs[L2TP_ATTR_DEBUG])
session->debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]); session->debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]);
if (info->attrs[L2TP_ATTR_DATA_SEQ])
session->data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]);
if (info->attrs[L2TP_ATTR_RECV_SEQ]) if (info->attrs[L2TP_ATTR_RECV_SEQ])
session->recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]); session->recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]);
...@@ -713,9 +701,6 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf ...@@ -713,9 +701,6 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf
if (info->attrs[L2TP_ATTR_MTU]) if (info->attrs[L2TP_ATTR_MTU])
session->mtu = nla_get_u16(info->attrs[L2TP_ATTR_MTU]); session->mtu = nla_get_u16(info->attrs[L2TP_ATTR_MTU]);
if (info->attrs[L2TP_ATTR_MRU])
session->mru = nla_get_u16(info->attrs[L2TP_ATTR_MRU]);
ret = l2tp_session_notify(&l2tp_nl_family, info, ret = l2tp_session_notify(&l2tp_nl_family, info,
session, L2TP_CMD_SESSION_MODIFY); session, L2TP_CMD_SESSION_MODIFY);
...@@ -746,9 +731,7 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl ...@@ -746,9 +731,7 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
session->peer_session_id) || session->peer_session_id) ||
nla_put_u32(skb, L2TP_ATTR_DEBUG, session->debug) || nla_put_u32(skb, L2TP_ATTR_DEBUG, session->debug) ||
nla_put_u16(skb, L2TP_ATTR_PW_TYPE, session->pwtype) || nla_put_u16(skb, L2TP_ATTR_PW_TYPE, session->pwtype) ||
nla_put_u16(skb, L2TP_ATTR_MTU, session->mtu) || nla_put_u16(skb, L2TP_ATTR_MTU, session->mtu))
(session->mru &&
nla_put_u16(skb, L2TP_ATTR_MRU, session->mru)))
goto nla_put_failure; goto nla_put_failure;
if ((session->ifname[0] && if ((session->ifname[0] &&
......
...@@ -127,8 +127,6 @@ struct pppol2tp_session { ...@@ -127,8 +127,6 @@ struct pppol2tp_session {
* PPPoX socket */ * PPPoX socket */
struct sock *__sk; /* Copy of .sk, for cleanup */ struct sock *__sk; /* Copy of .sk, for cleanup */
struct rcu_head rcu; /* For asynchronous release */ struct rcu_head rcu; /* For asynchronous release */
int flags; /* accessed by PPPIOCGFLAGS.
* Unused. */
}; };
static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb); static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb);
...@@ -572,10 +570,9 @@ static void pppol2tp_session_init(struct l2tp_session *session) ...@@ -572,10 +570,9 @@ static void pppol2tp_session_init(struct l2tp_session *session)
if (dst) { if (dst) {
u32 pmtu = dst_mtu(dst); u32 pmtu = dst_mtu(dst);
if (pmtu) { if (pmtu)
session->mtu = pmtu - PPPOL2TP_HEADER_OVERHEAD; session->mtu = pmtu - PPPOL2TP_HEADER_OVERHEAD;
session->mru = pmtu - PPPOL2TP_HEADER_OVERHEAD;
}
dst_release(dst); dst_release(dst);
} }
} }
...@@ -783,7 +780,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, ...@@ -783,7 +780,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
} else { } else {
/* Default MTU must allow space for UDP/L2TP/PPP headers */ /* Default MTU must allow space for UDP/L2TP/PPP headers */
cfg.mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD; cfg.mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD;
cfg.mru = cfg.mtu;
cfg.pw_type = L2TP_PWTYPE_PPP; cfg.pw_type = L2TP_PWTYPE_PPP;
session = l2tp_session_create(sizeof(struct pppol2tp_session), session = l2tp_session_create(sizeof(struct pppol2tp_session),
...@@ -887,8 +883,6 @@ static int pppol2tp_session_create(struct net *net, struct l2tp_tunnel *tunnel, ...@@ -887,8 +883,6 @@ static int pppol2tp_session_create(struct net *net, struct l2tp_tunnel *tunnel,
/* Default MTU values. */ /* Default MTU values. */
if (cfg->mtu == 0) if (cfg->mtu == 0)
cfg->mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD; cfg->mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD;
if (cfg->mru == 0)
cfg->mru = cfg->mtu;
/* Allocate and initialize a new session context. */ /* Allocate and initialize a new session context. */
session = l2tp_session_create(sizeof(struct pppol2tp_session), session = l2tp_session_create(sizeof(struct pppol2tp_session),
...@@ -1057,7 +1051,6 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session, ...@@ -1057,7 +1051,6 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
int err = 0; int err = 0;
struct sock *sk; struct sock *sk;
int val = (int) arg; int val = (int) arg;
struct pppol2tp_session *ps = l2tp_session_priv(session);
struct l2tp_tunnel *tunnel = session->tunnel; struct l2tp_tunnel *tunnel = session->tunnel;
struct pppol2tp_ioc_stats stats; struct pppol2tp_ioc_stats stats;
...@@ -1104,51 +1097,18 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session, ...@@ -1104,51 +1097,18 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
break; break;
case PPPIOCGMRU: case PPPIOCGMRU:
err = -ENXIO;
if (!(sk->sk_state & PPPOX_CONNECTED))
break;
err = -EFAULT;
if (put_user(session->mru, (int __user *) arg))
break;
l2tp_info(session, L2TP_MSG_CONTROL, "%s: get mru=%d\n",
session->name, session->mru);
err = 0;
break;
case PPPIOCSMRU:
err = -ENXIO;
if (!(sk->sk_state & PPPOX_CONNECTED))
break;
err = -EFAULT;
if (get_user(val, (int __user *) arg))
break;
session->mru = val;
l2tp_info(session, L2TP_MSG_CONTROL, "%s: set mru=%d\n",
session->name, session->mru);
err = 0;
break;
case PPPIOCGFLAGS: case PPPIOCGFLAGS:
err = -EFAULT; err = -EFAULT;
if (put_user(ps->flags, (int __user *) arg)) if (put_user(0, (int __user *)arg))
break; break;
l2tp_info(session, L2TP_MSG_CONTROL, "%s: get flags=%d\n",
session->name, ps->flags);
err = 0; err = 0;
break; break;
case PPPIOCSMRU:
case PPPIOCSFLAGS: case PPPIOCSFLAGS:
err = -EFAULT; err = -EFAULT;
if (get_user(val, (int __user *) arg)) if (get_user(val, (int __user *)arg))
break; break;
ps->flags = val;
l2tp_info(session, L2TP_MSG_CONTROL, "%s: set flags=%d\n",
session->name, ps->flags);
err = 0; err = 0;
break; break;
...@@ -1732,8 +1692,8 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) ...@@ -1732,8 +1692,8 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v)
tunnel->peer_tunnel_id, tunnel->peer_tunnel_id,
session->peer_session_id, session->peer_session_id,
state, user_data_ok); state, user_data_ok);
seq_printf(m, " %d/%d/%c/%c/%s %08x %u\n", seq_printf(m, " %d/0/%c/%c/%s %08x %u\n",
session->mtu, session->mru, session->mtu,
session->recv_seq ? 'R' : '-', session->recv_seq ? 'R' : '-',
session->send_seq ? 'S' : '-', session->send_seq ? 'S' : '-',
session->lns_mode ? "LNS" : "LAC", session->lns_mode ? "LNS" : "LAC",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment