From: Guillaume Nault <g.nault@alphalink.fr>
To: fgao@ikuai8.com
Cc: paulus@samba.org, davem@davemloft.net,
philipp@redfish-solutions.com, netdev@vger.kernel.org,
gfree.wind@gmail.com
Subject: Re: [PATCH v3 net-next] l2tp: Refactor the codes with existing macros instead of literal number
Date: Mon, 22 Aug 2016 12:07:16 +0200 [thread overview]
Message-ID: <20160822100716.ixxxppc7x4nce5yx@alphalink.fr> (raw)
In-Reply-To: <1471708347-18063-1-git-send-email-fgao@ikuai8.com>
On Sat, Aug 20, 2016 at 11:52:27PM +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> Use PPP_ALLSTATIONS, PPP_UI, and SEND_SHUTDOWN instead of 0xff,
> 0x03, and 2 separately.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
> v3: Modify the subject;
> v2: Only replace the literal number with macros according to Guillaume's advice
> v1: Inital patch
>
> net/l2tp/l2tp_ppp.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
> index d9560aa..65e2fd6 100644
> --- a/net/l2tp/l2tp_ppp.c
> +++ b/net/l2tp/l2tp_ppp.c
> @@ -177,7 +177,7 @@ static int pppol2tp_recv_payload_hook(struct sk_buff *skb)
> if (!pskb_may_pull(skb, 2))
> 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);
>
> return 0;
> @@ -282,7 +282,7 @@ static void pppol2tp_session_sock_put(struct l2tp_session *session)
> static int pppol2tp_sendmsg(struct socket *sock, struct msghdr *m,
> size_t total_len)
> {
> - static const unsigned char ppph[2] = { 0xff, 0x03 };
> + static const unsigned char ppph[2] = {PPP_ALLSTATIONS, PPP_UI};
>
Minor nit: I'd prefer to keep the space after '{' and before '}'.
I didn't want to bother you with this, but since it seems you'll have
to repost...
> struct sock *sk = sock->sk;
> struct sk_buff *skb;
> int error;
> @@ -369,7 +369,7 @@ error:
> */
> 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};
>
Same here.
BTW, I thought you also wanted to remove the static ppph variable
from pppol2tp_xmit() / pppol2tp_sendmsg(), to directly assign
skb->data[0/1] with PPP_ALLSTATIONS/PPP_UI.
next prev parent reply other threads:[~2016-08-22 10:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-20 15:52 [PATCH v3 net-next] l2tp: Refactor the codes with existing macros instead of literal number fgao
2016-08-21 22:23 ` David Miller
2016-08-21 22:36 ` Philp Prindeville
2016-08-21 22:49 ` David Miller
2016-08-22 0:13 ` Feng Gao
2016-08-22 9:54 ` Guillaume Nault
2016-08-22 9:48 ` Guillaume Nault
2016-08-22 10:29 ` Feng Gao
2016-08-22 10:07 ` Guillaume Nault [this message]
2016-08-22 10:22 ` Feng Gao
2016-08-22 11:46 ` Guillaume Nault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160822100716.ixxxppc7x4nce5yx@alphalink.fr \
--to=g.nault@alphalink.fr \
--cc=davem@davemloft.net \
--cc=fgao@ikuai8.com \
--cc=gfree.wind@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
--cc=philipp@redfish-solutions.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox