Inline...

On 08/02/2016 12:10 AM, Feng Gao wrote:
Thanks.
Because the original GRE uses the literal number directly, so I follow
this style.

Then I have two questions.
1. pptp_gre_header is defined in "drivers/net/ppp/pptp.c"; If we want
to use it, need to create one new header file, is it ok ?

Yes, I would move the relevant constants and packet structures into include/net/pptp.h ...

While you're at it, there are places like:

islcp = ((data[0] << 8) + data[1]) == PPP_LCP && 1 <= data[2] && data[2] <= 7;

that should be written as:

islcp = PPP_PROTOCOL(data-2) == PPP_LCP && CP_CONF_REQ <= data[2] && data[2] <= CP_CODE_REJ;

Similarly for:

                data[0] = PPP_ALLSTATIONS;
                data[1] = PPP_UI;

that should be using:

        PPP_ADDRESS(data) = PPP_ALLSTATIONS;
        PPP_CONTROL(data) = PPP_UI;

etc. but this cleanup can go in a 2nd patch. The definitions for CONFREQ and CONFACK and CP_CONF_REQ and CP_CONF_ACK and PPP_LCP_ECHOREQ and PPP_LCP_ECHOREP are redundant and probably should all go into ppp_defs.h as well (which would require refactoring drivers/net/ppp/ppp_async.c).


2. The GRE version 0 patch could use the sizeof pptp_gre_header.seq ?

Actually, since you're going to be doing the pptp.h header anyway, I'd add a v0 as well as a v1 struct just to be more clear/concise.

-Philip

Best Regards
Feng


[snip]

Reply via email to