l2tp: drop ->mru from struct l2tp_session
authorGuillaume Nault <g.nault@alphalink.fr>
Fri, 27 Jul 2018 09:00:00 +0000 (11:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Jul 2018 20:34:53 +0000 (13:34 -0700)
This field is not used.

Treat PPPIOC*MRU the same way as PPPIOC*FLAGS: "get" requests return 0,
while "set" requests vadidate the user supplied pointer but discard its
value.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/l2tp.h
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h
net/l2tp/l2tp_debugfs.c
net/l2tp/l2tp_netlink.c
net/l2tp/l2tp_ppp.c

index 41bf79a4b165be33de86e1244003297377f81d62..8bb8c7cfabe515fc737e3ce21b4fd6f3607aab3f 100644 (file)
@@ -120,7 +120,7 @@ enum {
        L2TP_ATTR_UDP_SPORT,            /* u16 */
        L2TP_ATTR_UDP_DPORT,            /* u16 */
        L2TP_ATTR_MTU,                  /* u16 */
-       L2TP_ATTR_MRU,                  /* u16 */
+       L2TP_ATTR_MRU,                  /* u16 (not used) */
        L2TP_ATTR_STATS,                /* nested */
        L2TP_ATTR_IP6_SADDR,            /* struct in6_addr */
        L2TP_ATTR_IP6_DADDR,            /* struct in6_addr */
index d10f4ed52d9202c359fb8e3c15f320fa0985d183..c61a467fd9b8198fd535c50ca2f2d1140930594d 100644 (file)
@@ -1675,7 +1675,6 @@ struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunn
                        session->pwtype = cfg->pw_type;
                        session->debug = cfg->debug;
                        session->mtu = cfg->mtu;
-                       session->mru = cfg->mru;
                        session->send_seq = cfg->send_seq;
                        session->recv_seq = cfg->recv_seq;
                        session->lns_mode = cfg->lns_mode;
index 49fd5e05538ce61e02aa5e270209912a839f4c29..fa5ae9432d389ac6458cf0926cacb2cbbf67aa11 100644 (file)
@@ -62,7 +62,6 @@ struct l2tp_session_cfg {
        int                     reorder_timeout; /* configured reorder timeout
                                                  * (in jiffies) */
        int                     mtu;
-       int                     mru;
        char                    *ifname;
 };
 
@@ -107,7 +106,6 @@ struct l2tp_session {
                                                  * (in jiffies) */
        int                     reorder_skip;   /* set if skip to next nr */
        int                     mtu;
-       int                     mru;
        enum l2tp_pwtype        pwtype;
        struct l2tp_stats       stats;
        struct hlist_node       global_hlist;   /* Global hash list node */
index 91b9248610f06a6c558905abc83c954c0e324dbd..aee271741f5b194cd8ce1e392dafe2292d0221ac 100644 (file)
@@ -191,8 +191,8 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v)
        if (session->send_seq || session->recv_seq)
                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, "   config %d/%d/%c/%c/-/%s %08x %u\n",
-                  session->mtu, session->mru,
+       seq_printf(m, "   config %d/0/%c/%c/-/%s %08x %u\n",
+                  session->mtu,
                   session->recv_seq ? 'R' : '-',
                   session->send_seq ? 'S' : '-',
                   session->lns_mode ? "LNS" : "LAC",
index 8ea1deefbc3736a4e05ea96b2295eaed82fadb3f..a7c409215336e3a9c7ee7d901a520218940dd91f 100644 (file)
@@ -611,9 +611,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
        if (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
        if (l2tp_nl_cmd_ops[cfg.pw_type] == NULL) {
                genl_unlock();
@@ -704,9 +701,6 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf
        if (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,
                                  session, L2TP_CMD_SESSION_MODIFY);
 
@@ -737,9 +731,7 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
                        session->peer_session_id) ||
            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_MTU, session->mtu) ||
-           (session->mru &&
-            nla_put_u16(skb, L2TP_ATTR_MRU, session->mru)))
+           nla_put_u16(skb, L2TP_ATTR_MTU, session->mtu))
                goto nla_put_failure;
 
        if ((session->ifname[0] &&
index 759ce842126952fd2180632eb48f0fa7f9aebea7..44cac66284a503cd7e0eff4fc150590926bd663a 100644 (file)
@@ -570,10 +570,9 @@ static void pppol2tp_session_init(struct l2tp_session *session)
        if (dst) {
                u32 pmtu = dst_mtu(dst);
 
-               if (pmtu) {
+               if (pmtu)
                        session->mtu = pmtu - PPPOL2TP_HEADER_OVERHEAD;
-                       session->mru = pmtu - PPPOL2TP_HEADER_OVERHEAD;
-               }
+
                dst_release(dst);
        }
 }
@@ -781,7 +780,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
        } else {
                /* Default MTU must allow space for UDP/L2TP/PPP headers */
                cfg.mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD;
-               cfg.mru = cfg.mtu;
                cfg.pw_type = L2TP_PWTYPE_PPP;
 
                session = l2tp_session_create(sizeof(struct pppol2tp_session),
@@ -885,8 +883,6 @@ static int pppol2tp_session_create(struct net *net, struct l2tp_tunnel *tunnel,
        /* Default MTU values. */
        if (cfg->mtu == 0)
                cfg->mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD;
-       if (cfg->mru == 0)
-               cfg->mru = cfg->mtu;
 
        /* Allocate and initialize a new session context. */
        session = l2tp_session_create(sizeof(struct pppol2tp_session),
@@ -1101,34 +1097,6 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
                break;
 
        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:
                err = -EFAULT;
                if (put_user(0, (int __user *)arg))
@@ -1136,6 +1104,7 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
                err = 0;
                break;
 
+       case PPPIOCSMRU:
        case PPPIOCSFLAGS:
                err = -EFAULT;
                if (get_user(val, (int __user *)arg))
@@ -1723,8 +1692,8 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v)
                   tunnel->peer_tunnel_id,
                   session->peer_session_id,
                   state, user_data_ok);
-       seq_printf(m, "   %d/%d/%c/%c/%s %08x %u\n",
-                  session->mtu, session->mru,
+       seq_printf(m, "   %d/0/%c/%c/%s %08x %u\n",
+                  session->mtu,
                   session->recv_seq ? 'R' : '-',
                   session->send_seq ? 'S' : '-',
                   session->lns_mode ? "LNS" : "LAC",