Commit 5ab1fe72 authored by Gao Feng's avatar Gao Feng Committed by David S. Miller

l2tp: Refactor the codes with existing macros instead of literal number

Use PPP_ALLSTATIONS, PPP_UI, and SEND_SHUTDOWN instead of 0xff,
0x03, and 2 separately.
Signed-off-by: default avatarGao Feng <fgao@ikuai8.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 04462f2a
...@@ -177,7 +177,7 @@ static int pppol2tp_recv_payload_hook(struct sk_buff *skb) ...@@ -177,7 +177,7 @@ static int pppol2tp_recv_payload_hook(struct sk_buff *skb)
if (!pskb_may_pull(skb, 2)) if (!pskb_may_pull(skb, 2))
return 1; return 1;
if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) if ((skb->data[0] == PPP_ALLSTATIONS) && (skb->data[1] == PPP_UI))
skb_pull(skb, 2); skb_pull(skb, 2);
return 0; return 0;
...@@ -282,7 +282,7 @@ static void pppol2tp_session_sock_put(struct l2tp_session *session) ...@@ -282,7 +282,7 @@ static void pppol2tp_session_sock_put(struct l2tp_session *session)
static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m, static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m,
size_t total_len) size_t total_len)
{ {
static const unsigned char ppph[2] = { 0xff, 0x03 }; static const unsigned char ppph[2] = {PPP_ALLSTATIONS, PPP_UI};
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sk_buff *skb; struct sk_buff *skb;
int error; int error;
...@@ -369,7 +369,7 @@ static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m, ...@@ -369,7 +369,7 @@ static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m,
*/ */
static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
{ {
static const u8 ppph[2] = { 0xff, 0x03 }; static const u8 ppph[2] = {PPP_ALLSTATIONS, PPP_UI};
struct sock *sk = (struct sock *) chan->private; struct sock *sk = (struct sock *) chan->private;
struct sock *sk_tun; struct sock *sk_tun;
struct l2tp_session *session; struct l2tp_session *session;
...@@ -440,7 +440,7 @@ static void pppol2tp_session_close(struct l2tp_session *session) ...@@ -440,7 +440,7 @@ static void pppol2tp_session_close(struct l2tp_session *session)
BUG_ON(session->magic != L2TP_SESSION_MAGIC); BUG_ON(session->magic != L2TP_SESSION_MAGIC);
if (sock) { if (sock) {
inet_shutdown(sock, 2); inet_shutdown(sock, SEND_SHUTDOWN);
/* Don't let the session go away before our socket does */ /* Don't let the session go away before our socket does */
l2tp_session_inc_refcount(session); l2tp_session_inc_refcount(session);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment