1 /* 2 * L2TPv3 IP encapsulation support 3 * 4 * Copyright (c) 2008,2009,2010 Katalix Systems Ltd 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 9 * 2 of the License, or (at your option) any later version. 10 */ 11 12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13 14 #include <asm/ioctls.h> 15 #include <linux/icmp.h> 16 #include <linux/module.h> 17 #include <linux/skbuff.h> 18 #include <linux/random.h> 19 #include <linux/socket.h> 20 #include <linux/l2tp.h> 21 #include <linux/in.h> 22 #include <net/sock.h> 23 #include <net/ip.h> 24 #include <net/icmp.h> 25 #include <net/udp.h> 26 #include <net/inet_common.h> 27 #include <net/inet_hashtables.h> 28 #include <net/tcp_states.h> 29 #include <net/protocol.h> 30 #include <net/xfrm.h> 31 32 #include "l2tp_core.h" 33 34 struct l2tp_ip_sock { 35 /* inet_sock has to be the first member of l2tp_ip_sock */ 36 struct inet_sock inet; 37 38 u32 conn_id; 39 u32 peer_conn_id; 40 }; 41 42 static DEFINE_RWLOCK(l2tp_ip_lock); 43 static struct hlist_head l2tp_ip_table; 44 static struct hlist_head l2tp_ip_bind_table; 45 46 static inline struct l2tp_ip_sock *l2tp_ip_sk(const struct sock *sk) 47 { 48 return (struct l2tp_ip_sock *)sk; 49 } 50 51 static struct sock *__l2tp_ip_bind_lookup(const struct net *net, __be32 laddr, 52 __be32 raddr, int dif, u32 tunnel_id) 53 { 54 struct sock *sk; 55 56 sk_for_each_bound(sk, &l2tp_ip_bind_table) { 57 const struct l2tp_ip_sock *l2tp = l2tp_ip_sk(sk); 58 const struct inet_sock *inet = inet_sk(sk); 59 60 if (!net_eq(sock_net(sk), net)) 61 continue; 62 63 if (sk->sk_bound_dev_if && dif && sk->sk_bound_dev_if != dif) 64 continue; 65 66 if (inet->inet_rcv_saddr && laddr && 67 inet->inet_rcv_saddr != laddr) 68 continue; 69 70 if (inet->inet_daddr && raddr && inet->inet_daddr != raddr) 71 continue; 72 73 if (l2tp->conn_id != tunnel_id) 74 continue; 75 76 goto found; 77 } 78 79 sk = NULL; 80 found: 81 return sk; 82 } 83 84 /* When processing receive frames, there are two cases to 85 * consider. Data frames consist of a non-zero session-id and an 86 * optional cookie. Control frames consist of a regular L2TP header 87 * preceded by 32-bits of zeros. 88 * 89 * L2TPv3 Session Header Over IP 90 * 91 * 0 1 2 3 92 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 93 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 94 * | Session ID | 95 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 96 * | Cookie (optional, maximum 64 bits)... 97 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 98 * | 99 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 100 * 101 * L2TPv3 Control Message Header Over IP 102 * 103 * 0 1 2 3 104 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 105 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 106 * | (32 bits of zeros) | 107 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 108 * |T|L|x|x|S|x|x|x|x|x|x|x| Ver | Length | 109 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 110 * | Control Connection ID | 111 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 112 * | Ns | Nr | 113 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 114 * 115 * All control frames are passed to userspace. 116 */ 117 static int l2tp_ip_recv(struct sk_buff *skb) 118 { 119 struct net *net = dev_net(skb->dev); 120 struct sock *sk; 121 u32 session_id; 122 u32 tunnel_id; 123 unsigned char *ptr, *optr; 124 struct l2tp_session *session; 125 struct l2tp_tunnel *tunnel = NULL; 126 int length; 127 128 if (!pskb_may_pull(skb, 4)) 129 goto discard; 130 131 /* Point to L2TP header */ 132 optr = ptr = skb->data; 133 session_id = ntohl(*((__be32 *) ptr)); 134 ptr += 4; 135 136 /* RFC3931: L2TP/IP packets have the first 4 bytes containing 137 * the session_id. If it is 0, the packet is a L2TP control 138 * frame and the session_id value can be discarded. 139 */ 140 if (session_id == 0) { 141 __skb_pull(skb, 4); 142 goto pass_up; 143 } 144 145 /* Ok, this is a data packet. Lookup the session. */ 146 session = l2tp_session_get(net, NULL, session_id); 147 if (!session) 148 goto discard; 149 150 tunnel = session->tunnel; 151 if (!tunnel) 152 goto discard_sess; 153 154 /* Trace packet contents, if enabled */ 155 if (tunnel->debug & L2TP_MSG_DATA) { 156 length = min(32u, skb->len); 157 if (!pskb_may_pull(skb, length)) 158 goto discard_sess; 159 160 /* Point to L2TP header */ 161 optr = ptr = skb->data; 162 ptr += 4; 163 pr_debug("%s: ip recv\n", tunnel->name); 164 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); 165 } 166 167 l2tp_recv_common(session, skb, ptr, optr, 0, skb->len, tunnel->recv_payload_hook); 168 l2tp_session_dec_refcount(session); 169 170 return 0; 171 172 pass_up: 173 /* Get the tunnel_id from the L2TP header */ 174 if (!pskb_may_pull(skb, 12)) 175 goto discard; 176 177 if ((skb->data[0] & 0xc0) != 0xc0) 178 goto discard; 179 180 tunnel_id = ntohl(*(__be32 *) &skb->data[4]); 181 tunnel = l2tp_tunnel_find(net, tunnel_id); 182 if (tunnel) { 183 sk = tunnel->sock; 184 sock_hold(sk); 185 } else { 186 struct iphdr *iph = (struct iphdr *) skb_network_header(skb); 187 188 read_lock_bh(&l2tp_ip_lock); 189 sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr, 190 inet_iif(skb), tunnel_id); 191 if (!sk) { 192 read_unlock_bh(&l2tp_ip_lock); 193 goto discard; 194 } 195 196 sock_hold(sk); 197 read_unlock_bh(&l2tp_ip_lock); 198 } 199 200 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) 201 goto discard_put; 202 203 nf_reset(skb); 204 205 return sk_receive_skb(sk, skb, 1); 206 207 discard_sess: 208 l2tp_session_dec_refcount(session); 209 goto discard; 210 211 discard_put: 212 sock_put(sk); 213 214 discard: 215 kfree_skb(skb); 216 return 0; 217 } 218 219 static int l2tp_ip_open(struct sock *sk) 220 { 221 /* Prevent autobind. We don't have ports. */ 222 inet_sk(sk)->inet_num = IPPROTO_L2TP; 223 224 write_lock_bh(&l2tp_ip_lock); 225 sk_add_node(sk, &l2tp_ip_table); 226 write_unlock_bh(&l2tp_ip_lock); 227 228 return 0; 229 } 230 231 static void l2tp_ip_close(struct sock *sk, long timeout) 232 { 233 write_lock_bh(&l2tp_ip_lock); 234 hlist_del_init(&sk->sk_bind_node); 235 sk_del_node_init(sk); 236 write_unlock_bh(&l2tp_ip_lock); 237 sk_common_release(sk); 238 } 239 240 static void l2tp_ip_destroy_sock(struct sock *sk) 241 { 242 struct sk_buff *skb; 243 struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk); 244 245 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) 246 kfree_skb(skb); 247 248 if (tunnel) { 249 l2tp_tunnel_closeall(tunnel); 250 sock_put(sk); 251 } 252 253 sk_refcnt_debug_dec(sk); 254 } 255 256 static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) 257 { 258 struct inet_sock *inet = inet_sk(sk); 259 struct sockaddr_l2tpip *addr = (struct sockaddr_l2tpip *) uaddr; 260 struct net *net = sock_net(sk); 261 int ret; 262 int chk_addr_ret; 263 264 if (addr_len < sizeof(struct sockaddr_l2tpip)) 265 return -EINVAL; 266 if (addr->l2tp_family != AF_INET) 267 return -EINVAL; 268 269 lock_sock(sk); 270 271 ret = -EINVAL; 272 if (!sock_flag(sk, SOCK_ZAPPED)) 273 goto out; 274 275 if (sk->sk_state != TCP_CLOSE) 276 goto out; 277 278 chk_addr_ret = inet_addr_type(net, addr->l2tp_addr.s_addr); 279 ret = -EADDRNOTAVAIL; 280 if (addr->l2tp_addr.s_addr && chk_addr_ret != RTN_LOCAL && 281 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) 282 goto out; 283 284 if (addr->l2tp_addr.s_addr) 285 inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; 286 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) 287 inet->inet_saddr = 0; /* Use device */ 288 289 write_lock_bh(&l2tp_ip_lock); 290 if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 0, 291 sk->sk_bound_dev_if, addr->l2tp_conn_id)) { 292 write_unlock_bh(&l2tp_ip_lock); 293 ret = -EADDRINUSE; 294 goto out; 295 } 296 297 sk_dst_reset(sk); 298 l2tp_ip_sk(sk)->conn_id = addr->l2tp_conn_id; 299 300 sk_add_bind_node(sk, &l2tp_ip_bind_table); 301 sk_del_node_init(sk); 302 write_unlock_bh(&l2tp_ip_lock); 303 304 ret = 0; 305 sock_reset_flag(sk, SOCK_ZAPPED); 306 307 out: 308 release_sock(sk); 309 310 return ret; 311 } 312 313 static int l2tp_ip_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) 314 { 315 struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *) uaddr; 316 int rc; 317 318 if (addr_len < sizeof(*lsa)) 319 return -EINVAL; 320 321 if (ipv4_is_multicast(lsa->l2tp_addr.s_addr)) 322 return -EINVAL; 323 324 lock_sock(sk); 325 326 /* Must bind first - autobinding does not work */ 327 if (sock_flag(sk, SOCK_ZAPPED)) { 328 rc = -EINVAL; 329 goto out_sk; 330 } 331 332 rc = __ip4_datagram_connect(sk, uaddr, addr_len); 333 if (rc < 0) 334 goto out_sk; 335 336 l2tp_ip_sk(sk)->peer_conn_id = lsa->l2tp_conn_id; 337 338 write_lock_bh(&l2tp_ip_lock); 339 hlist_del_init(&sk->sk_bind_node); 340 sk_add_bind_node(sk, &l2tp_ip_bind_table); 341 write_unlock_bh(&l2tp_ip_lock); 342 343 out_sk: 344 release_sock(sk); 345 346 return rc; 347 } 348 349 static int l2tp_ip_disconnect(struct sock *sk, int flags) 350 { 351 if (sock_flag(sk, SOCK_ZAPPED)) 352 return 0; 353 354 return __udp_disconnect(sk, flags); 355 } 356 357 static int l2tp_ip_getname(struct socket *sock, struct sockaddr *uaddr, 358 int *uaddr_len, int peer) 359 { 360 struct sock *sk = sock->sk; 361 struct inet_sock *inet = inet_sk(sk); 362 struct l2tp_ip_sock *lsk = l2tp_ip_sk(sk); 363 struct sockaddr_l2tpip *lsa = (struct sockaddr_l2tpip *)uaddr; 364 365 memset(lsa, 0, sizeof(*lsa)); 366 lsa->l2tp_family = AF_INET; 367 if (peer) { 368 if (!inet->inet_dport) 369 return -ENOTCONN; 370 lsa->l2tp_conn_id = lsk->peer_conn_id; 371 lsa->l2tp_addr.s_addr = inet->inet_daddr; 372 } else { 373 __be32 addr = inet->inet_rcv_saddr; 374 if (!addr) 375 addr = inet->inet_saddr; 376 lsa->l2tp_conn_id = lsk->conn_id; 377 lsa->l2tp_addr.s_addr = addr; 378 } 379 *uaddr_len = sizeof(*lsa); 380 return 0; 381 } 382 383 static int l2tp_ip_backlog_recv(struct sock *sk, struct sk_buff *skb) 384 { 385 int rc; 386 387 /* Charge it to the socket, dropping if the queue is full. */ 388 rc = sock_queue_rcv_skb(sk, skb); 389 if (rc < 0) 390 goto drop; 391 392 return 0; 393 394 drop: 395 IP_INC_STATS(sock_net(sk), IPSTATS_MIB_INDISCARDS); 396 kfree_skb(skb); 397 return 0; 398 } 399 400 /* Userspace will call sendmsg() on the tunnel socket to send L2TP 401 * control frames. 402 */ 403 static int l2tp_ip_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 404 { 405 struct sk_buff *skb; 406 int rc; 407 struct inet_sock *inet = inet_sk(sk); 408 struct rtable *rt = NULL; 409 struct flowi4 *fl4; 410 int connected = 0; 411 __be32 daddr; 412 413 lock_sock(sk); 414 415 rc = -ENOTCONN; 416 if (sock_flag(sk, SOCK_DEAD)) 417 goto out; 418 419 /* Get and verify the address. */ 420 if (msg->msg_name) { 421 DECLARE_SOCKADDR(struct sockaddr_l2tpip *, lip, msg->msg_name); 422 rc = -EINVAL; 423 if (msg->msg_namelen < sizeof(*lip)) 424 goto out; 425 426 if (lip->l2tp_family != AF_INET) { 427 rc = -EAFNOSUPPORT; 428 if (lip->l2tp_family != AF_UNSPEC) 429 goto out; 430 } 431 432 daddr = lip->l2tp_addr.s_addr; 433 } else { 434 rc = -EDESTADDRREQ; 435 if (sk->sk_state != TCP_ESTABLISHED) 436 goto out; 437 438 daddr = inet->inet_daddr; 439 connected = 1; 440 } 441 442 /* Allocate a socket buffer */ 443 rc = -ENOMEM; 444 skb = sock_wmalloc(sk, 2 + NET_SKB_PAD + sizeof(struct iphdr) + 445 4 + len, 0, GFP_KERNEL); 446 if (!skb) 447 goto error; 448 449 /* Reserve space for headers, putting IP header on 4-byte boundary. */ 450 skb_reserve(skb, 2 + NET_SKB_PAD); 451 skb_reset_network_header(skb); 452 skb_reserve(skb, sizeof(struct iphdr)); 453 skb_reset_transport_header(skb); 454 455 /* Insert 0 session_id */ 456 *((__be32 *) skb_put(skb, 4)) = 0; 457 458 /* Copy user data into skb */ 459 rc = memcpy_from_msg(skb_put(skb, len), msg, len); 460 if (rc < 0) { 461 kfree_skb(skb); 462 goto error; 463 } 464 465 fl4 = &inet->cork.fl.u.ip4; 466 if (connected) 467 rt = (struct rtable *) __sk_dst_check(sk, 0); 468 469 rcu_read_lock(); 470 if (rt == NULL) { 471 const struct ip_options_rcu *inet_opt; 472 473 inet_opt = rcu_dereference(inet->inet_opt); 474 475 /* Use correct destination address if we have options. */ 476 if (inet_opt && inet_opt->opt.srr) 477 daddr = inet_opt->opt.faddr; 478 479 /* If this fails, retransmit mechanism of transport layer will 480 * keep trying until route appears or the connection times 481 * itself out. 482 */ 483 rt = ip_route_output_ports(sock_net(sk), fl4, sk, 484 daddr, inet->inet_saddr, 485 inet->inet_dport, inet->inet_sport, 486 sk->sk_protocol, RT_CONN_FLAGS(sk), 487 sk->sk_bound_dev_if); 488 if (IS_ERR(rt)) 489 goto no_route; 490 if (connected) { 491 sk_setup_caps(sk, &rt->dst); 492 } else { 493 skb_dst_set(skb, &rt->dst); 494 goto xmit; 495 } 496 } 497 498 /* We dont need to clone dst here, it is guaranteed to not disappear. 499 * __dev_xmit_skb() might force a refcount if needed. 500 */ 501 skb_dst_set_noref(skb, &rt->dst); 502 503 xmit: 504 /* Queue the packet to IP for output */ 505 rc = ip_queue_xmit(sk, skb, &inet->cork.fl); 506 rcu_read_unlock(); 507 508 error: 509 if (rc >= 0) 510 rc = len; 511 512 out: 513 release_sock(sk); 514 return rc; 515 516 no_route: 517 rcu_read_unlock(); 518 IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); 519 kfree_skb(skb); 520 rc = -EHOSTUNREACH; 521 goto out; 522 } 523 524 static int l2tp_ip_recvmsg(struct sock *sk, struct msghdr *msg, 525 size_t len, int noblock, int flags, int *addr_len) 526 { 527 struct inet_sock *inet = inet_sk(sk); 528 size_t copied = 0; 529 int err = -EOPNOTSUPP; 530 DECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name); 531 struct sk_buff *skb; 532 533 if (flags & MSG_OOB) 534 goto out; 535 536 skb = skb_recv_datagram(sk, flags, noblock, &err); 537 if (!skb) 538 goto out; 539 540 copied = skb->len; 541 if (len < copied) { 542 msg->msg_flags |= MSG_TRUNC; 543 copied = len; 544 } 545 546 err = skb_copy_datagram_msg(skb, 0, msg, copied); 547 if (err) 548 goto done; 549 550 sock_recv_timestamp(msg, sk, skb); 551 552 /* Copy the address. */ 553 if (sin) { 554 sin->sin_family = AF_INET; 555 sin->sin_addr.s_addr = ip_hdr(skb)->saddr; 556 sin->sin_port = 0; 557 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); 558 *addr_len = sizeof(*sin); 559 } 560 if (inet->cmsg_flags) 561 ip_cmsg_recv(msg, skb); 562 if (flags & MSG_TRUNC) 563 copied = skb->len; 564 done: 565 skb_free_datagram(sk, skb); 566 out: 567 return err ? err : copied; 568 } 569 570 int l2tp_ioctl(struct sock *sk, int cmd, unsigned long arg) 571 { 572 struct sk_buff *skb; 573 int amount; 574 575 switch (cmd) { 576 case SIOCOUTQ: 577 amount = sk_wmem_alloc_get(sk); 578 break; 579 case SIOCINQ: 580 spin_lock_bh(&sk->sk_receive_queue.lock); 581 skb = skb_peek(&sk->sk_receive_queue); 582 amount = skb ? skb->len : 0; 583 spin_unlock_bh(&sk->sk_receive_queue.lock); 584 break; 585 586 default: 587 return -ENOIOCTLCMD; 588 } 589 590 return put_user(amount, (int __user *)arg); 591 } 592 EXPORT_SYMBOL(l2tp_ioctl); 593 594 static struct proto l2tp_ip_prot = { 595 .name = "L2TP/IP", 596 .owner = THIS_MODULE, 597 .init = l2tp_ip_open, 598 .close = l2tp_ip_close, 599 .bind = l2tp_ip_bind, 600 .connect = l2tp_ip_connect, 601 .disconnect = l2tp_ip_disconnect, 602 .ioctl = l2tp_ioctl, 603 .destroy = l2tp_ip_destroy_sock, 604 .setsockopt = ip_setsockopt, 605 .getsockopt = ip_getsockopt, 606 .sendmsg = l2tp_ip_sendmsg, 607 .recvmsg = l2tp_ip_recvmsg, 608 .backlog_rcv = l2tp_ip_backlog_recv, 609 .hash = inet_hash, 610 .unhash = inet_unhash, 611 .obj_size = sizeof(struct l2tp_ip_sock), 612 #ifdef CONFIG_COMPAT 613 .compat_setsockopt = compat_ip_setsockopt, 614 .compat_getsockopt = compat_ip_getsockopt, 615 #endif 616 }; 617 618 static const struct proto_ops l2tp_ip_ops = { 619 .family = PF_INET, 620 .owner = THIS_MODULE, 621 .release = inet_release, 622 .bind = inet_bind, 623 .connect = inet_dgram_connect, 624 .socketpair = sock_no_socketpair, 625 .accept = sock_no_accept, 626 .getname = l2tp_ip_getname, 627 .poll = datagram_poll, 628 .ioctl = inet_ioctl, 629 .listen = sock_no_listen, 630 .shutdown = inet_shutdown, 631 .setsockopt = sock_common_setsockopt, 632 .getsockopt = sock_common_getsockopt, 633 .sendmsg = inet_sendmsg, 634 .recvmsg = sock_common_recvmsg, 635 .mmap = sock_no_mmap, 636 .sendpage = sock_no_sendpage, 637 #ifdef CONFIG_COMPAT 638 .compat_setsockopt = compat_sock_common_setsockopt, 639 .compat_getsockopt = compat_sock_common_getsockopt, 640 #endif 641 }; 642 643 static struct inet_protosw l2tp_ip_protosw = { 644 .type = SOCK_DGRAM, 645 .protocol = IPPROTO_L2TP, 646 .prot = &l2tp_ip_prot, 647 .ops = &l2tp_ip_ops, 648 }; 649 650 static struct net_protocol l2tp_ip_protocol __read_mostly = { 651 .handler = l2tp_ip_recv, 652 .netns_ok = 1, 653 }; 654 655 static int __init l2tp_ip_init(void) 656 { 657 int err; 658 659 pr_info("L2TP IP encapsulation support (L2TPv3)\n"); 660 661 err = proto_register(&l2tp_ip_prot, 1); 662 if (err != 0) 663 goto out; 664 665 err = inet_add_protocol(&l2tp_ip_protocol, IPPROTO_L2TP); 666 if (err) 667 goto out1; 668 669 inet_register_protosw(&l2tp_ip_protosw); 670 return 0; 671 672 out1: 673 proto_unregister(&l2tp_ip_prot); 674 out: 675 return err; 676 } 677 678 static void __exit l2tp_ip_exit(void) 679 { 680 inet_unregister_protosw(&l2tp_ip_protosw); 681 inet_del_protocol(&l2tp_ip_protocol, IPPROTO_L2TP); 682 proto_unregister(&l2tp_ip_prot); 683 } 684 685 module_init(l2tp_ip_init); 686 module_exit(l2tp_ip_exit); 687 688 MODULE_LICENSE("GPL"); 689 MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); 690 MODULE_DESCRIPTION("L2TP over IP"); 691 MODULE_VERSION("1.0"); 692 693 /* Use the value of SOCK_DGRAM (2) directory, because __stringify doesn't like 694 * enums 695 */ 696 MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP); 697 MODULE_ALIAS_NET_PF_PROTO(PF_INET, IPPROTO_L2TP); 698