Skip to content

Commit 5ab1fe7

Browse files
gfreewinddavem330
authored andcommitted
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: Gao Feng <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 04462f2 commit 5ab1fe7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/l2tp/l2tp_ppp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int pppol2tp_recv_payload_hook(struct sk_buff *skb)
177177
if (!pskb_may_pull(skb, 2))
178178
return 1;
179179

180-
if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03))
180+
if ((skb->data[0] == PPP_ALLSTATIONS) && (skb->data[1] == PPP_UI))
181181
skb_pull(skb, 2);
182182

183183
return 0;
@@ -282,7 +282,7 @@ static void pppol2tp_session_sock_put(struct l2tp_session *session)
282282
static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m,
283283
size_t total_len)
284284
{
285-
static const unsigned char ppph[2] = { 0xff, 0x03 };
285+
static const unsigned char ppph[2] = {PPP_ALLSTATIONS, PPP_UI};
286286
struct sock *sk = sock->sk;
287287
struct sk_buff *skb;
288288
int error;
@@ -369,7 +369,7 @@ static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m,
369369
*/
370370
static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
371371
{
372-
static const u8 ppph[2] = { 0xff, 0x03 };
372+
static const u8 ppph[2] = {PPP_ALLSTATIONS, PPP_UI};
373373
struct sock *sk = (struct sock *) chan->private;
374374
struct sock *sk_tun;
375375
struct l2tp_session *session;
@@ -440,7 +440,7 @@ static void pppol2tp_session_close(struct l2tp_session *session)
440440
BUG_ON(session->magic != L2TP_SESSION_MAGIC);
441441

442442
if (sock) {
443-
inet_shutdown(sock, 2);
443+
inet_shutdown(sock, SEND_SHUTDOWN);
444444
/* Don't let the session go away before our socket does */
445445
l2tp_session_inc_refcount(session);
446446
}

0 commit comments

Comments
 (0)