diff options
author | James Chapman <jchapman@katalix.com> | 2010-04-02 02:19:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-03 17:56:08 -0400 |
commit | 789a4a2c61d843df67988d69e7c3f3a4bca97e8e (patch) | |
tree | 9f98e9903e34b9a583fa5f8ff03551c77d194c43 /net/l2tp/l2tp_netlink.c | |
parent | 0ad6614048cf722e4d27909665b4846805357f1b (diff) |
l2tp: Add support for static unmanaged L2TPv3 tunnels
This patch adds support for static (unmanaged) L2TPv3 tunnels, where
the tunnel socket is created by the kernel rather than being created
by userspace. This means L2TP tunnels and sessions can be created
manually, without needing an L2TP control protocol implemented in
userspace. This might be useful where the user wants a simple ethernet
over IP tunnel.
A patch to iproute2 adds a new command set under "ip l2tp" to make use
of this feature. This will be submitted separately.
Signed-off-by: James Chapman <jchapman@katalix.com>
Reviewed-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp/l2tp_netlink.c')
-rw-r--r-- | net/l2tp/l2tp_netlink.c | 18 |
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]); |