aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp/l2tp_netlink.c')
-rw-r--r--net/l2tp/l2tp_netlink.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 3d0f7f6f7488..12341a6cc70e 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -129,11 +129,21 @@ static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info
129 } 129 }
130 cfg.encap = nla_get_u16(info->attrs[L2TP_ATTR_ENCAP_TYPE]); 130 cfg.encap = nla_get_u16(info->attrs[L2TP_ATTR_ENCAP_TYPE]);
131 131
132 if (!info->attrs[L2TP_ATTR_FD]) { 132 fd = -1;
133 ret = -EINVAL; 133 if (info->attrs[L2TP_ATTR_FD]) {
134 goto out; 134 fd = nla_get_u32(info->attrs[L2TP_ATTR_FD]);
135 } else {
136 if (info->attrs[L2TP_ATTR_IP_SADDR])
137 cfg.local_ip.s_addr = nla_get_be32(info->attrs[L2TP_ATTR_IP_SADDR]);
138 if (info->attrs[L2TP_ATTR_IP_DADDR])
139 cfg.peer_ip.s_addr = nla_get_be32(info->attrs[L2TP_ATTR_IP_DADDR]);
140 if (info->attrs[L2TP_ATTR_UDP_SPORT])
141 cfg.local_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_SPORT]);
142 if (info->attrs[L2TP_ATTR_UDP_DPORT])
143 cfg.peer_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_DPORT]);
144 if (info->attrs[L2TP_ATTR_UDP_CSUM])
145 cfg.use_udp_checksums = nla_get_flag(info->attrs[L2TP_ATTR_UDP_CSUM]);
135 } 146 }
136 fd = nla_get_u32(info->attrs[L2TP_ATTR_FD]);
137 147
138 if (info->attrs[L2TP_ATTR_DEBUG]) 148 if (info->attrs[L2TP_ATTR_DEBUG])
139 cfg.debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]); 149 cfg.debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]);