Commit 9f7da9a0 authored by Tom Parkin's avatar Tom Parkin Committed by David S. Miller

l2tp: cleanup difficult-to-read line breaks

Some l2tp code had line breaks which made the code more difficult to
read.  These were originally motivated by the 80-character line width
coding guidelines, but were actually a negative from the perspective of
trying to follow the code.

Remove these linebreaks for clearer code, even if we do exceed 80
characters in width in some places.
Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 20dcb110
...@@ -165,71 +165,63 @@ static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info ...@@ -165,71 +165,63 @@ static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info
struct l2tp_tunnel_cfg cfg = { 0, }; struct l2tp_tunnel_cfg cfg = { 0, };
struct l2tp_tunnel *tunnel; struct l2tp_tunnel *tunnel;
struct net *net = genl_info_net(info); struct net *net = genl_info_net(info);
struct nlattr **attrs = info->attrs;
if (!info->attrs[L2TP_ATTR_CONN_ID]) { if (!attrs[L2TP_ATTR_CONN_ID]) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]); tunnel_id = nla_get_u32(attrs[L2TP_ATTR_CONN_ID]);
if (!info->attrs[L2TP_ATTR_PEER_CONN_ID]) { if (!attrs[L2TP_ATTR_PEER_CONN_ID]) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
peer_tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_PEER_CONN_ID]); peer_tunnel_id = nla_get_u32(attrs[L2TP_ATTR_PEER_CONN_ID]);
if (!info->attrs[L2TP_ATTR_PROTO_VERSION]) { if (!attrs[L2TP_ATTR_PROTO_VERSION]) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
proto_version = nla_get_u8(info->attrs[L2TP_ATTR_PROTO_VERSION]); proto_version = nla_get_u8(attrs[L2TP_ATTR_PROTO_VERSION]);
if (!info->attrs[L2TP_ATTR_ENCAP_TYPE]) { if (!attrs[L2TP_ATTR_ENCAP_TYPE]) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
cfg.encap = nla_get_u16(info->attrs[L2TP_ATTR_ENCAP_TYPE]); cfg.encap = nla_get_u16(attrs[L2TP_ATTR_ENCAP_TYPE]);
fd = -1; fd = -1;
if (info->attrs[L2TP_ATTR_FD]) { if (attrs[L2TP_ATTR_FD]) {
fd = nla_get_u32(info->attrs[L2TP_ATTR_FD]); fd = nla_get_u32(attrs[L2TP_ATTR_FD]);
} else { } else {
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (info->attrs[L2TP_ATTR_IP6_SADDR] && if (attrs[L2TP_ATTR_IP6_SADDR] && attrs[L2TP_ATTR_IP6_DADDR]) {
info->attrs[L2TP_ATTR_IP6_DADDR]) { cfg.local_ip6 = nla_data(attrs[L2TP_ATTR_IP6_SADDR]);
cfg.local_ip6 = nla_data( cfg.peer_ip6 = nla_data(attrs[L2TP_ATTR_IP6_DADDR]);
info->attrs[L2TP_ATTR_IP6_SADDR]);
cfg.peer_ip6 = nla_data(
info->attrs[L2TP_ATTR_IP6_DADDR]);
} else } else
#endif #endif
if (info->attrs[L2TP_ATTR_IP_SADDR] && if (attrs[L2TP_ATTR_IP_SADDR] && attrs[L2TP_ATTR_IP_DADDR]) {
info->attrs[L2TP_ATTR_IP_DADDR]) { cfg.local_ip.s_addr = nla_get_in_addr(attrs[L2TP_ATTR_IP_SADDR]);
cfg.local_ip.s_addr = nla_get_in_addr( cfg.peer_ip.s_addr = nla_get_in_addr(attrs[L2TP_ATTR_IP_DADDR]);
info->attrs[L2TP_ATTR_IP_SADDR]);
cfg.peer_ip.s_addr = nla_get_in_addr(
info->attrs[L2TP_ATTR_IP_DADDR]);
} else { } else {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
if (info->attrs[L2TP_ATTR_UDP_SPORT]) if (attrs[L2TP_ATTR_UDP_SPORT])
cfg.local_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_SPORT]); cfg.local_udp_port = nla_get_u16(attrs[L2TP_ATTR_UDP_SPORT]);
if (info->attrs[L2TP_ATTR_UDP_DPORT]) if (attrs[L2TP_ATTR_UDP_DPORT])
cfg.peer_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_DPORT]); cfg.peer_udp_port = nla_get_u16(attrs[L2TP_ATTR_UDP_DPORT]);
cfg.use_udp_checksums = nla_get_flag( cfg.use_udp_checksums = nla_get_flag(attrs[L2TP_ATTR_UDP_CSUM]);
info->attrs[L2TP_ATTR_UDP_CSUM]);
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
cfg.udp6_zero_tx_checksums = nla_get_flag( cfg.udp6_zero_tx_checksums = nla_get_flag(attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX]);
info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX]); cfg.udp6_zero_rx_checksums = nla_get_flag(attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX]);
cfg.udp6_zero_rx_checksums = nla_get_flag(
info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX]);
#endif #endif
} }
if (info->attrs[L2TP_ATTR_DEBUG]) if (attrs[L2TP_ATTR_DEBUG])
cfg.debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]); cfg.debug = nla_get_u32(attrs[L2TP_ATTR_DEBUG]);
ret = -EINVAL; ret = -EINVAL;
switch (cfg.encap) { switch (cfg.encap) {
...@@ -715,8 +707,7 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl ...@@ -715,8 +707,7 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) || if (nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) ||
nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) || nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) ||
nla_put_u32(skb, L2TP_ATTR_PEER_CONN_ID, tunnel->peer_tunnel_id) || nla_put_u32(skb, L2TP_ATTR_PEER_CONN_ID, tunnel->peer_tunnel_id) ||
nla_put_u32(skb, L2TP_ATTR_PEER_SESSION_ID, nla_put_u32(skb, L2TP_ATTR_PEER_SESSION_ID, 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))
goto nla_put_failure; goto nla_put_failure;
...@@ -724,11 +715,9 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl ...@@ -724,11 +715,9 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
if ((session->ifname[0] && if ((session->ifname[0] &&
nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) || nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) ||
(session->cookie_len && (session->cookie_len &&
nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len, nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len, session->cookie)) ||
&session->cookie[0])) ||
(session->peer_cookie_len && (session->peer_cookie_len &&
nla_put(skb, L2TP_ATTR_PEER_COOKIE, session->peer_cookie_len, nla_put(skb, L2TP_ATTR_PEER_COOKIE, session->peer_cookie_len, session->peer_cookie)) ||
&session->peer_cookie[0])) ||
nla_put_u8(skb, L2TP_ATTR_RECV_SEQ, session->recv_seq) || nla_put_u8(skb, L2TP_ATTR_RECV_SEQ, session->recv_seq) ||
nla_put_u8(skb, L2TP_ATTR_SEND_SEQ, session->send_seq) || nla_put_u8(skb, L2TP_ATTR_SEND_SEQ, session->send_seq) ||
nla_put_u8(skb, L2TP_ATTR_LNS_MODE, session->lns_mode) || nla_put_u8(skb, L2TP_ATTR_LNS_MODE, session->lns_mode) ||
......
...@@ -1566,8 +1566,7 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) ...@@ -1566,8 +1566,7 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v)
user_data_ok = 'N'; user_data_ok = 'N';
} }
seq_printf(m, " SESSION '%s' %08X/%d %04X/%04X -> " seq_printf(m, " SESSION '%s' %08X/%d %04X/%04X -> %04X/%04X %d %c\n",
"%04X/%04X %d %c\n",
session->name, ip, port, session->name, ip, port,
tunnel->tunnel_id, tunnel->tunnel_id,
session->session_id, session->session_id,
...@@ -1606,8 +1605,7 @@ static int pppol2tp_seq_show(struct seq_file *m, void *v) ...@@ -1606,8 +1605,7 @@ static int pppol2tp_seq_show(struct seq_file *m, void *v)
seq_puts(m, "PPPoL2TP driver info, " PPPOL2TP_DRV_VERSION "\n"); seq_puts(m, "PPPoL2TP driver info, " PPPOL2TP_DRV_VERSION "\n");
seq_puts(m, "TUNNEL name, user-data-ok session-count\n"); seq_puts(m, "TUNNEL name, user-data-ok session-count\n");
seq_puts(m, " debug tx-pkts/bytes/errs rx-pkts/bytes/errs\n"); seq_puts(m, " debug tx-pkts/bytes/errs rx-pkts/bytes/errs\n");
seq_puts(m, " SESSION name, addr/port src-tid/sid " seq_puts(m, " SESSION name, addr/port src-tid/sid dest-tid/sid state user-data-ok\n");
"dest-tid/sid state user-data-ok\n");
seq_puts(m, " mtu/mru/rcvseq/sendseq/lns debug reorderto\n"); seq_puts(m, " mtu/mru/rcvseq/sendseq/lns debug reorderto\n");
seq_puts(m, " nr/ns tx-pkts/bytes/errs rx-pkts/bytes/errs\n"); seq_puts(m, " nr/ns tx-pkts/bytes/errs rx-pkts/bytes/errs\n");
goto out; goto out;
......
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