l2tp_ppp.c (3e1bc8bf974e2d4e7beb842a4c801c2542eff3bd) | l2tp_ppp.c (bda06be2158c7aa7e41b15500c4d3840369c19a6) |
---|---|
1/***************************************************************************** 2 * Linux PPP over L2TP (PPPoX/PPPoL2TP) Sockets 3 * 4 * PPPoX --- Generic PPP encapsulation socket family 5 * PPPoL2TP --- PPP over L2TP (RFC 2661) 6 * 7 * Version: 2.0.0 8 * --- 598 unchanged lines hidden (view full) --- 607 struct l2tp_tunnel *tunnel; 608 struct pppol2tp_session *ps; 609 struct l2tp_session_cfg cfg = { 0, }; 610 int error = 0; 611 u32 tunnel_id, peer_tunnel_id; 612 u32 session_id, peer_session_id; 613 bool drop_refcnt = false; 614 bool drop_tunnel = false; | 1/***************************************************************************** 2 * Linux PPP over L2TP (PPPoX/PPPoL2TP) Sockets 3 * 4 * PPPoX --- Generic PPP encapsulation socket family 5 * PPPoL2TP --- PPP over L2TP (RFC 2661) 6 * 7 * Version: 2.0.0 8 * --- 598 unchanged lines hidden (view full) --- 607 struct l2tp_tunnel *tunnel; 608 struct pppol2tp_session *ps; 609 struct l2tp_session_cfg cfg = { 0, }; 610 int error = 0; 611 u32 tunnel_id, peer_tunnel_id; 612 u32 session_id, peer_session_id; 613 bool drop_refcnt = false; 614 bool drop_tunnel = false; |
615 bool new_session = false; 616 bool new_tunnel = false; |
|
615 int ver = 2; 616 int fd; 617 618 lock_sock(sk); 619 620 error = -EINVAL; 621 622 if (sockaddr_len != sizeof(struct sockaddr_pppol2tp) && --- 94 unchanged lines hidden (view full) --- 717 l2tp_tunnel_inc_refcount(tunnel); 718 error = l2tp_tunnel_register(tunnel, sock_net(sk), 719 &tcfg); 720 if (error < 0) { 721 kfree(tunnel); 722 goto end; 723 } 724 drop_tunnel = true; | 617 int ver = 2; 618 int fd; 619 620 lock_sock(sk); 621 622 error = -EINVAL; 623 624 if (sockaddr_len != sizeof(struct sockaddr_pppol2tp) && --- 94 unchanged lines hidden (view full) --- 719 l2tp_tunnel_inc_refcount(tunnel); 720 error = l2tp_tunnel_register(tunnel, sock_net(sk), 721 &tcfg); 722 if (error < 0) { 723 kfree(tunnel); 724 goto end; 725 } 726 drop_tunnel = true; |
727 new_tunnel = true; |
|
725 } 726 } else { 727 /* Error if we can't find the tunnel */ 728 error = -ENOENT; 729 if (tunnel == NULL) 730 goto end; 731 732 /* Error if socket is not prepped */ --- 50 unchanged lines hidden (view full) --- 783 mutex_lock(&ps->sk_lock); 784 error = l2tp_session_register(session, tunnel); 785 if (error < 0) { 786 mutex_unlock(&ps->sk_lock); 787 kfree(session); 788 goto end; 789 } 790 drop_refcnt = true; | 728 } 729 } else { 730 /* Error if we can't find the tunnel */ 731 error = -ENOENT; 732 if (tunnel == NULL) 733 goto end; 734 735 /* Error if socket is not prepped */ --- 50 unchanged lines hidden (view full) --- 786 mutex_lock(&ps->sk_lock); 787 error = l2tp_session_register(session, tunnel); 788 if (error < 0) { 789 mutex_unlock(&ps->sk_lock); 790 kfree(session); 791 goto end; 792 } 793 drop_refcnt = true; |
794 new_session = true; |
|
791 } 792 793 /* Special case: if source & dest session_id == 0x0000, this 794 * socket is being created to manage the tunnel. Just set up 795 * the internal context for use by ioctl() and sockopt() 796 * handlers. 797 */ 798 if ((session->session_id == 0) && --- 30 unchanged lines hidden (view full) --- 829 */ 830 drop_refcnt = false; 831 832 sk->sk_state = PPPOX_CONNECTED; 833 l2tp_info(session, L2TP_MSG_CONTROL, "%s: created\n", 834 session->name); 835 836end: | 795 } 796 797 /* Special case: if source & dest session_id == 0x0000, this 798 * socket is being created to manage the tunnel. Just set up 799 * the internal context for use by ioctl() and sockopt() 800 * handlers. 801 */ 802 if ((session->session_id == 0) && --- 30 unchanged lines hidden (view full) --- 833 */ 834 drop_refcnt = false; 835 836 sk->sk_state = PPPOX_CONNECTED; 837 l2tp_info(session, L2TP_MSG_CONTROL, "%s: created\n", 838 session->name); 839 840end: |
841 if (error) { 842 if (new_session) 843 l2tp_session_delete(session); 844 if (new_tunnel) 845 l2tp_tunnel_delete(tunnel); 846 } |
|
837 if (drop_refcnt) 838 l2tp_session_dec_refcount(session); 839 if (drop_tunnel) 840 l2tp_tunnel_dec_refcount(tunnel); 841 release_sock(sk); 842 843 return error; 844} --- 1049 unchanged lines hidden --- | 847 if (drop_refcnt) 848 l2tp_session_dec_refcount(session); 849 if (drop_tunnel) 850 l2tp_tunnel_dec_refcount(tunnel); 851 release_sock(sk); 852 853 return error; 854} --- 1049 unchanged lines hidden --- |