aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_ppp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp/l2tp_ppp.c')
-rw-r--r--net/l2tp/l2tp_ppp.c206
1 files changed, 132 insertions, 74 deletions
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 1addd9f3f40a..8ef6b9416cba 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -57,6 +57,8 @@
57 * http://openl2tp.sourceforge.net. 57 * http://openl2tp.sourceforge.net.
58 */ 58 */
59 59
60#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
61
60#include <linux/module.h> 62#include <linux/module.h>
61#include <linux/string.h> 63#include <linux/string.h>
62#include <linux/list.h> 64#include <linux/list.h>
@@ -106,12 +108,6 @@
106/* Space for UDP, L2TP and PPP headers */ 108/* Space for UDP, L2TP and PPP headers */
107#define PPPOL2TP_HEADER_OVERHEAD 40 109#define PPPOL2TP_HEADER_OVERHEAD 40
108 110
109#define PRINTK(_mask, _type, _lvl, _fmt, args...) \
110 do { \
111 if ((_mask) & (_type)) \
112 printk(_lvl "PPPOL2TP: " _fmt, ##args); \
113 } while (0)
114
115/* Number of bytes to build transmit L2TP headers. 111/* Number of bytes to build transmit L2TP headers.
116 * Unfortunately the size is different depending on whether sequence numbers 112 * Unfortunately the size is different depending on whether sequence numbers
117 * are enabled. 113 * are enabled.
@@ -236,9 +232,9 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
236 232
237 if (sk->sk_state & PPPOX_BOUND) { 233 if (sk->sk_state & PPPOX_BOUND) {
238 struct pppox_sock *po; 234 struct pppox_sock *po;
239 PRINTK(session->debug, PPPOL2TP_MSG_DATA, KERN_DEBUG, 235 l2tp_dbg(session, PPPOL2TP_MSG_DATA,
240 "%s: recv %d byte data frame, passing to ppp\n", 236 "%s: recv %d byte data frame, passing to ppp\n",
241 session->name, data_len); 237 session->name, data_len);
242 238
243 /* We need to forget all info related to the L2TP packet 239 /* We need to forget all info related to the L2TP packet
244 * gathered in the skb as we are going to reuse the same 240 * gathered in the skb as we are going to reuse the same
@@ -259,8 +255,8 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
259 po = pppox_sk(sk); 255 po = pppox_sk(sk);
260 ppp_input(&po->chan, skb); 256 ppp_input(&po->chan, skb);
261 } else { 257 } else {
262 PRINTK(session->debug, PPPOL2TP_MSG_DATA, KERN_INFO, 258 l2tp_info(session, PPPOL2TP_MSG_DATA, "%s: socket not bound\n",
263 "%s: socket not bound\n", session->name); 259 session->name);
264 260
265 /* Not bound. Nothing we can do, so discard. */ 261 /* Not bound. Nothing we can do, so discard. */
266 session->stats.rx_errors++; 262 session->stats.rx_errors++;
@@ -270,8 +266,7 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
270 return; 266 return;
271 267
272no_sock: 268no_sock:
273 PRINTK(session->debug, PPPOL2TP_MSG_DATA, KERN_INFO, 269 l2tp_info(session, PPPOL2TP_MSG_DATA, "%s: no socket\n", session->name);
274 "%s: no socket\n", session->name);
275 kfree_skb(skb); 270 kfree_skb(skb);
276} 271}
277 272
@@ -628,7 +623,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
628{ 623{
629 struct sock *sk = sock->sk; 624 struct sock *sk = sock->sk;
630 struct sockaddr_pppol2tp *sp = (struct sockaddr_pppol2tp *) uservaddr; 625 struct sockaddr_pppol2tp *sp = (struct sockaddr_pppol2tp *) uservaddr;
631 struct sockaddr_pppol2tpv3 *sp3 = (struct sockaddr_pppol2tpv3 *) uservaddr;
632 struct pppox_sock *po = pppox_sk(sk); 626 struct pppox_sock *po = pppox_sk(sk);
633 struct l2tp_session *session = NULL; 627 struct l2tp_session *session = NULL;
634 struct l2tp_tunnel *tunnel; 628 struct l2tp_tunnel *tunnel;
@@ -657,7 +651,13 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
657 if (sk->sk_user_data) 651 if (sk->sk_user_data)
658 goto end; /* socket is already attached */ 652 goto end; /* socket is already attached */
659 653
660 /* Get params from socket address. Handle L2TPv2 and L2TPv3 */ 654 /* Get params from socket address. Handle L2TPv2 and L2TPv3.
655 * This is nasty because there are different sockaddr_pppol2tp
656 * structs for L2TPv2, L2TPv3, over IPv4 and IPv6. We use
657 * the sockaddr size to determine which structure the caller
658 * is using.
659 */
660 peer_tunnel_id = 0;
661 if (sockaddr_len == sizeof(struct sockaddr_pppol2tp)) { 661 if (sockaddr_len == sizeof(struct sockaddr_pppol2tp)) {
662 fd = sp->pppol2tp.fd; 662 fd = sp->pppol2tp.fd;
663 tunnel_id = sp->pppol2tp.s_tunnel; 663 tunnel_id = sp->pppol2tp.s_tunnel;
@@ -665,12 +665,31 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
665 session_id = sp->pppol2tp.s_session; 665 session_id = sp->pppol2tp.s_session;
666 peer_session_id = sp->pppol2tp.d_session; 666 peer_session_id = sp->pppol2tp.d_session;
667 } else if (sockaddr_len == sizeof(struct sockaddr_pppol2tpv3)) { 667 } else if (sockaddr_len == sizeof(struct sockaddr_pppol2tpv3)) {
668 struct sockaddr_pppol2tpv3 *sp3 =
669 (struct sockaddr_pppol2tpv3 *) sp;
668 ver = 3; 670 ver = 3;
669 fd = sp3->pppol2tp.fd; 671 fd = sp3->pppol2tp.fd;
670 tunnel_id = sp3->pppol2tp.s_tunnel; 672 tunnel_id = sp3->pppol2tp.s_tunnel;
671 peer_tunnel_id = sp3->pppol2tp.d_tunnel; 673 peer_tunnel_id = sp3->pppol2tp.d_tunnel;
672 session_id = sp3->pppol2tp.s_session; 674 session_id = sp3->pppol2tp.s_session;
673 peer_session_id = sp3->pppol2tp.d_session; 675 peer_session_id = sp3->pppol2tp.d_session;
676 } else if (sockaddr_len == sizeof(struct sockaddr_pppol2tpin6)) {
677 struct sockaddr_pppol2tpin6 *sp6 =
678 (struct sockaddr_pppol2tpin6 *) sp;
679 fd = sp6->pppol2tp.fd;
680 tunnel_id = sp6->pppol2tp.s_tunnel;
681 peer_tunnel_id = sp6->pppol2tp.d_tunnel;
682 session_id = sp6->pppol2tp.s_session;
683 peer_session_id = sp6->pppol2tp.d_session;
684 } else if (sockaddr_len == sizeof(struct sockaddr_pppol2tpv3in6)) {
685 struct sockaddr_pppol2tpv3in6 *sp6 =
686 (struct sockaddr_pppol2tpv3in6 *) sp;
687 ver = 3;
688 fd = sp6->pppol2tp.fd;
689 tunnel_id = sp6->pppol2tp.s_tunnel;
690 peer_tunnel_id = sp6->pppol2tp.d_tunnel;
691 session_id = sp6->pppol2tp.s_session;
692 peer_session_id = sp6->pppol2tp.d_session;
674 } else { 693 } else {
675 error = -EINVAL; 694 error = -EINVAL;
676 goto end; /* bad socket address */ 695 goto end; /* bad socket address */
@@ -711,12 +730,8 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
711 if (tunnel->recv_payload_hook == NULL) 730 if (tunnel->recv_payload_hook == NULL)
712 tunnel->recv_payload_hook = pppol2tp_recv_payload_hook; 731 tunnel->recv_payload_hook = pppol2tp_recv_payload_hook;
713 732
714 if (tunnel->peer_tunnel_id == 0) { 733 if (tunnel->peer_tunnel_id == 0)
715 if (ver == 2) 734 tunnel->peer_tunnel_id = peer_tunnel_id;
716 tunnel->peer_tunnel_id = sp->pppol2tp.d_tunnel;
717 else
718 tunnel->peer_tunnel_id = sp3->pppol2tp.d_tunnel;
719 }
720 735
721 /* Create session if it doesn't already exist. We handle the 736 /* Create session if it doesn't already exist. We handle the
722 * case where a session was previously created by the netlink 737 * case where a session was previously created by the netlink
@@ -807,8 +822,8 @@ out_no_ppp:
807 /* This is how we get the session context from the socket. */ 822 /* This is how we get the session context from the socket. */
808 sk->sk_user_data = session; 823 sk->sk_user_data = session;
809 sk->sk_state = PPPOX_CONNECTED; 824 sk->sk_state = PPPOX_CONNECTED;
810 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 825 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: created\n",
811 "%s: created\n", session->name); 826 session->name);
812 827
813end: 828end:
814 release_sock(sk); 829 release_sock(sk);
@@ -861,8 +876,8 @@ static int pppol2tp_session_create(struct net *net, u32 tunnel_id, u32 session_i
861 ps = l2tp_session_priv(session); 876 ps = l2tp_session_priv(session);
862 ps->tunnel_sock = tunnel->sock; 877 ps->tunnel_sock = tunnel->sock;
863 878
864 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 879 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: created\n",
865 "%s: created\n", session->name); 880 session->name);
866 881
867 error = 0; 882 error = 0;
868 883
@@ -916,7 +931,7 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
916 } 931 }
917 932
918 inet = inet_sk(tunnel->sock); 933 inet = inet_sk(tunnel->sock);
919 if (tunnel->version == 2) { 934 if ((tunnel->version == 2) && (tunnel->sock->sk_family == AF_INET)) {
920 struct sockaddr_pppol2tp sp; 935 struct sockaddr_pppol2tp sp;
921 len = sizeof(sp); 936 len = sizeof(sp);
922 memset(&sp, 0, len); 937 memset(&sp, 0, len);
@@ -932,6 +947,46 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
932 sp.pppol2tp.addr.sin_port = inet->inet_dport; 947 sp.pppol2tp.addr.sin_port = inet->inet_dport;
933 sp.pppol2tp.addr.sin_addr.s_addr = inet->inet_daddr; 948 sp.pppol2tp.addr.sin_addr.s_addr = inet->inet_daddr;
934 memcpy(uaddr, &sp, len); 949 memcpy(uaddr, &sp, len);
950#if IS_ENABLED(CONFIG_IPV6)
951 } else if ((tunnel->version == 2) &&
952 (tunnel->sock->sk_family == AF_INET6)) {
953 struct ipv6_pinfo *np = inet6_sk(tunnel->sock);
954 struct sockaddr_pppol2tpin6 sp;
955 len = sizeof(sp);
956 memset(&sp, 0, len);
957 sp.sa_family = AF_PPPOX;
958 sp.sa_protocol = PX_PROTO_OL2TP;
959 sp.pppol2tp.fd = tunnel->fd;
960 sp.pppol2tp.pid = pls->owner;
961 sp.pppol2tp.s_tunnel = tunnel->tunnel_id;
962 sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id;
963 sp.pppol2tp.s_session = session->session_id;
964 sp.pppol2tp.d_session = session->peer_session_id;
965 sp.pppol2tp.addr.sin6_family = AF_INET6;
966 sp.pppol2tp.addr.sin6_port = inet->inet_dport;
967 memcpy(&sp.pppol2tp.addr.sin6_addr, &np->daddr,
968 sizeof(np->daddr));
969 memcpy(uaddr, &sp, len);
970 } else if ((tunnel->version == 3) &&
971 (tunnel->sock->sk_family == AF_INET6)) {
972 struct ipv6_pinfo *np = inet6_sk(tunnel->sock);
973 struct sockaddr_pppol2tpv3in6 sp;
974 len = sizeof(sp);
975 memset(&sp, 0, len);
976 sp.sa_family = AF_PPPOX;
977 sp.sa_protocol = PX_PROTO_OL2TP;
978 sp.pppol2tp.fd = tunnel->fd;
979 sp.pppol2tp.pid = pls->owner;
980 sp.pppol2tp.s_tunnel = tunnel->tunnel_id;
981 sp.pppol2tp.d_tunnel = tunnel->peer_tunnel_id;
982 sp.pppol2tp.s_session = session->session_id;
983 sp.pppol2tp.d_session = session->peer_session_id;
984 sp.pppol2tp.addr.sin6_family = AF_INET6;
985 sp.pppol2tp.addr.sin6_port = inet->inet_dport;
986 memcpy(&sp.pppol2tp.addr.sin6_addr, &np->daddr,
987 sizeof(np->daddr));
988 memcpy(uaddr, &sp, len);
989#endif
935 } else if (tunnel->version == 3) { 990 } else if (tunnel->version == 3) {
936 struct sockaddr_pppol2tpv3 sp; 991 struct sockaddr_pppol2tpv3 sp;
937 len = sizeof(sp); 992 len = sizeof(sp);
@@ -998,9 +1053,9 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
998 struct l2tp_tunnel *tunnel = session->tunnel; 1053 struct l2tp_tunnel *tunnel = session->tunnel;
999 struct pppol2tp_ioc_stats stats; 1054 struct pppol2tp_ioc_stats stats;
1000 1055
1001 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_DEBUG, 1056 l2tp_dbg(session, PPPOL2TP_MSG_CONTROL,
1002 "%s: pppol2tp_session_ioctl(cmd=%#x, arg=%#lx)\n", 1057 "%s: pppol2tp_session_ioctl(cmd=%#x, arg=%#lx)\n",
1003 session->name, cmd, arg); 1058 session->name, cmd, arg);
1004 1059
1005 sk = ps->sock; 1060 sk = ps->sock;
1006 sock_hold(sk); 1061 sock_hold(sk);
@@ -1018,8 +1073,8 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
1018 if (copy_to_user((void __user *) arg, &ifr, sizeof(struct ifreq))) 1073 if (copy_to_user((void __user *) arg, &ifr, sizeof(struct ifreq)))
1019 break; 1074 break;
1020 1075
1021 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1076 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get mtu=%d\n",
1022 "%s: get mtu=%d\n", session->name, session->mtu); 1077 session->name, session->mtu);
1023 err = 0; 1078 err = 0;
1024 break; 1079 break;
1025 1080
@@ -1034,8 +1089,8 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
1034 1089
1035 session->mtu = ifr.ifr_mtu; 1090 session->mtu = ifr.ifr_mtu;
1036 1091
1037 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1092 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: set mtu=%d\n",
1038 "%s: set mtu=%d\n", session->name, session->mtu); 1093 session->name, session->mtu);
1039 err = 0; 1094 err = 0;
1040 break; 1095 break;
1041 1096
@@ -1048,8 +1103,8 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
1048 if (put_user(session->mru, (int __user *) arg)) 1103 if (put_user(session->mru, (int __user *) arg))
1049 break; 1104 break;
1050 1105
1051 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1106 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get mru=%d\n",
1052 "%s: get mru=%d\n", session->name, session->mru); 1107 session->name, session->mru);
1053 err = 0; 1108 err = 0;
1054 break; 1109 break;
1055 1110
@@ -1063,8 +1118,8 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
1063 break; 1118 break;
1064 1119
1065 session->mru = val; 1120 session->mru = val;
1066 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1121 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: set mru=%d\n",
1067 "%s: set mru=%d\n", session->name, session->mru); 1122 session->name, session->mru);
1068 err = 0; 1123 err = 0;
1069 break; 1124 break;
1070 1125
@@ -1073,8 +1128,8 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
1073 if (put_user(ps->flags, (int __user *) arg)) 1128 if (put_user(ps->flags, (int __user *) arg))
1074 break; 1129 break;
1075 1130
1076 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1131 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get flags=%d\n",
1077 "%s: get flags=%d\n", session->name, ps->flags); 1132 session->name, ps->flags);
1078 err = 0; 1133 err = 0;
1079 break; 1134 break;
1080 1135
@@ -1083,8 +1138,8 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
1083 if (get_user(val, (int __user *) arg)) 1138 if (get_user(val, (int __user *) arg))
1084 break; 1139 break;
1085 ps->flags = val; 1140 ps->flags = val;
1086 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1141 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: set flags=%d\n",
1087 "%s: set flags=%d\n", session->name, ps->flags); 1142 session->name, ps->flags);
1088 err = 0; 1143 err = 0;
1089 break; 1144 break;
1090 1145
@@ -1100,8 +1155,8 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
1100 if (copy_to_user((void __user *) arg, &stats, 1155 if (copy_to_user((void __user *) arg, &stats,
1101 sizeof(stats))) 1156 sizeof(stats)))
1102 break; 1157 break;
1103 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1158 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get L2TP stats\n",
1104 "%s: get L2TP stats\n", session->name); 1159 session->name);
1105 err = 0; 1160 err = 0;
1106 break; 1161 break;
1107 1162
@@ -1128,9 +1183,9 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel,
1128 struct sock *sk; 1183 struct sock *sk;
1129 struct pppol2tp_ioc_stats stats; 1184 struct pppol2tp_ioc_stats stats;
1130 1185
1131 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_DEBUG, 1186 l2tp_dbg(tunnel, PPPOL2TP_MSG_CONTROL,
1132 "%s: pppol2tp_tunnel_ioctl(cmd=%#x, arg=%#lx)\n", 1187 "%s: pppol2tp_tunnel_ioctl(cmd=%#x, arg=%#lx)\n",
1133 tunnel->name, cmd, arg); 1188 tunnel->name, cmd, arg);
1134 1189
1135 sk = tunnel->sock; 1190 sk = tunnel->sock;
1136 sock_hold(sk); 1191 sock_hold(sk);
@@ -1164,8 +1219,8 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel,
1164 err = -EFAULT; 1219 err = -EFAULT;
1165 break; 1220 break;
1166 } 1221 }
1167 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1222 l2tp_info(tunnel, PPPOL2TP_MSG_CONTROL, "%s: get L2TP stats\n",
1168 "%s: get L2TP stats\n", tunnel->name); 1223 tunnel->name);
1169 err = 0; 1224 err = 0;
1170 break; 1225 break;
1171 1226
@@ -1254,8 +1309,8 @@ static int pppol2tp_tunnel_setsockopt(struct sock *sk,
1254 switch (optname) { 1309 switch (optname) {
1255 case PPPOL2TP_SO_DEBUG: 1310 case PPPOL2TP_SO_DEBUG:
1256 tunnel->debug = val; 1311 tunnel->debug = val;
1257 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1312 l2tp_info(tunnel, PPPOL2TP_MSG_CONTROL, "%s: set debug=%x\n",
1258 "%s: set debug=%x\n", tunnel->name, tunnel->debug); 1313 tunnel->name, tunnel->debug);
1259 break; 1314 break;
1260 1315
1261 default: 1316 default:
@@ -1282,8 +1337,9 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
1282 break; 1337 break;
1283 } 1338 }
1284 session->recv_seq = val ? -1 : 0; 1339 session->recv_seq = val ? -1 : 0;
1285 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1340 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1286 "%s: set recv_seq=%d\n", session->name, session->recv_seq); 1341 "%s: set recv_seq=%d\n",
1342 session->name, session->recv_seq);
1287 break; 1343 break;
1288 1344
1289 case PPPOL2TP_SO_SENDSEQ: 1345 case PPPOL2TP_SO_SENDSEQ:
@@ -1298,8 +1354,9 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
1298 po->chan.hdrlen = val ? PPPOL2TP_L2TP_HDR_SIZE_SEQ : 1354 po->chan.hdrlen = val ? PPPOL2TP_L2TP_HDR_SIZE_SEQ :
1299 PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; 1355 PPPOL2TP_L2TP_HDR_SIZE_NOSEQ;
1300 } 1356 }
1301 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1357 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1302 "%s: set send_seq=%d\n", session->name, session->send_seq); 1358 "%s: set send_seq=%d\n",
1359 session->name, session->send_seq);
1303 break; 1360 break;
1304 1361
1305 case PPPOL2TP_SO_LNSMODE: 1362 case PPPOL2TP_SO_LNSMODE:
@@ -1308,20 +1365,22 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
1308 break; 1365 break;
1309 } 1366 }
1310 session->lns_mode = val ? -1 : 0; 1367 session->lns_mode = val ? -1 : 0;
1311 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1368 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1312 "%s: set lns_mode=%d\n", session->name, session->lns_mode); 1369 "%s: set lns_mode=%d\n",
1370 session->name, session->lns_mode);
1313 break; 1371 break;
1314 1372
1315 case PPPOL2TP_SO_DEBUG: 1373 case PPPOL2TP_SO_DEBUG:
1316 session->debug = val; 1374 session->debug = val;
1317 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1375 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: set debug=%x\n",
1318 "%s: set debug=%x\n", session->name, session->debug); 1376 session->name, session->debug);
1319 break; 1377 break;
1320 1378
1321 case PPPOL2TP_SO_REORDERTO: 1379 case PPPOL2TP_SO_REORDERTO:
1322 session->reorder_timeout = msecs_to_jiffies(val); 1380 session->reorder_timeout = msecs_to_jiffies(val);
1323 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1381 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1324 "%s: set reorder_timeout=%d\n", session->name, session->reorder_timeout); 1382 "%s: set reorder_timeout=%d\n",
1383 session->name, session->reorder_timeout);
1325 break; 1384 break;
1326 1385
1327 default: 1386 default:
@@ -1400,8 +1459,8 @@ static int pppol2tp_tunnel_getsockopt(struct sock *sk,
1400 switch (optname) { 1459 switch (optname) {
1401 case PPPOL2TP_SO_DEBUG: 1460 case PPPOL2TP_SO_DEBUG:
1402 *val = tunnel->debug; 1461 *val = tunnel->debug;
1403 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1462 l2tp_info(tunnel, PPPOL2TP_MSG_CONTROL, "%s: get debug=%x\n",
1404 "%s: get debug=%x\n", tunnel->name, tunnel->debug); 1463 tunnel->name, tunnel->debug);
1405 break; 1464 break;
1406 1465
1407 default: 1466 default:
@@ -1423,32 +1482,32 @@ static int pppol2tp_session_getsockopt(struct sock *sk,
1423 switch (optname) { 1482 switch (optname) {
1424 case PPPOL2TP_SO_RECVSEQ: 1483 case PPPOL2TP_SO_RECVSEQ:
1425 *val = session->recv_seq; 1484 *val = session->recv_seq;
1426 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1485 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1427 "%s: get recv_seq=%d\n", session->name, *val); 1486 "%s: get recv_seq=%d\n", session->name, *val);
1428 break; 1487 break;
1429 1488
1430 case PPPOL2TP_SO_SENDSEQ: 1489 case PPPOL2TP_SO_SENDSEQ:
1431 *val = session->send_seq; 1490 *val = session->send_seq;
1432 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1491 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1433 "%s: get send_seq=%d\n", session->name, *val); 1492 "%s: get send_seq=%d\n", session->name, *val);
1434 break; 1493 break;
1435 1494
1436 case PPPOL2TP_SO_LNSMODE: 1495 case PPPOL2TP_SO_LNSMODE:
1437 *val = session->lns_mode; 1496 *val = session->lns_mode;
1438 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1497 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1439 "%s: get lns_mode=%d\n", session->name, *val); 1498 "%s: get lns_mode=%d\n", session->name, *val);
1440 break; 1499 break;
1441 1500
1442 case PPPOL2TP_SO_DEBUG: 1501 case PPPOL2TP_SO_DEBUG:
1443 *val = session->debug; 1502 *val = session->debug;
1444 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1503 l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get debug=%d\n",
1445 "%s: get debug=%d\n", session->name, *val); 1504 session->name, *val);
1446 break; 1505 break;
1447 1506
1448 case PPPOL2TP_SO_REORDERTO: 1507 case PPPOL2TP_SO_REORDERTO:
1449 *val = (int) jiffies_to_msecs(session->reorder_timeout); 1508 *val = (int) jiffies_to_msecs(session->reorder_timeout);
1450 PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1509 l2tp_info(session, PPPOL2TP_MSG_CONTROL,
1451 "%s: get reorder_timeout=%d\n", session->name, *val); 1510 "%s: get reorder_timeout=%d\n", session->name, *val);
1452 break; 1511 break;
1453 1512
1454 default: 1513 default:
@@ -1811,8 +1870,7 @@ static int __init pppol2tp_init(void)
1811 goto out_unregister_pppox; 1870 goto out_unregister_pppox;
1812#endif 1871#endif
1813 1872
1814 printk(KERN_INFO "PPPoL2TP kernel driver, %s\n", 1873 pr_info("PPPoL2TP kernel driver, %s\n", PPPOL2TP_DRV_VERSION);
1815 PPPOL2TP_DRV_VERSION);
1816 1874
1817out: 1875out:
1818 return err; 1876 return err;