netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <g.nault@alphalink.fr>
To: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, James Chapman <jchapman@katalix.com>
Subject: Re: [PATCH v2 net-next 3/5] l2tp: remove l2specific_len dependency in l2tp_core
Date: Mon, 15 Jan 2018 19:54:03 +0100	[thread overview]
Message-ID: <20180115185403.GE1422@alphalink.fr> (raw)
In-Reply-To: <CAJ0CqmXfjcmRMYN9N8Ce6aWdph+heWH+=0sD+fi5DZSkLLeU2g@mail.gmail.com>

On Mon, Jan 15, 2018 at 07:43:18PM +0100, Lorenzo Bianconi wrote:
> > On Sun, Jan 14, 2018 at 03:50:56PM +0100, Lorenzo Bianconi wrote:
> >> --- a/net/l2tp/l2tp_core.h
> >> +++ b/net/l2tp/l2tp_core.h
> >> @@ -302,6 +302,17 @@ static inline void l2tp_session_dec_refcount(struct l2tp_session *session)
> >>               l2tp_session_free(session);
> >>  }
> >>
> >> +static inline int l2tp_get_l2specific_len(struct l2tp_session *session)
> >> +{
> >> +     switch (session->l2specific_type) {
> >> +     case L2TP_L2SPECTYPE_NONE:
> >> +             return 0;
> >> +     case L2TP_L2SPECTYPE_DEFAULT:
> >> +     default:
> >> +             return 4;
> >> +     }
> >> +}
> >>
> > The data path only compares ->l2specific_type to L2SPECTYPE_DEFAULT and
> > treats any other value as L2SPECTYPE_NONE. Therefore, we should keep
> > this logic here and return 0 for unknown types.
> 
> The data path only compares l2specific_type to L2SPECTYPE_DEFAULT
> since in the other supported case (L2SPECTYPE_NONE) there is no action
> required. Moreover L2SPECTYPE_DEFAULT is default configured value if
> the user does not provide any value for l2specific_type so there are
> no 'unknown' types and I thought L2TP_L2SPECTYPE_DEFAULT was a better
> choice for default value
> 
Yes, but what I meant is that the data patch treats unknow values as
L2SPECTYPE_NONE, while l2tp_get_l2specific_len() now treats them as
L2TP_L2SPECTYPE_DEFAULT. I'd just prefer to avoid that inconsistency;
it makes it easier to reason about the code.

But if you really prefer L2SPECTYPE_DEFAULT, then fine. Unless someone
messes with new l2spec types, we should never reach this case.

  reply	other threads:[~2018-01-15 18:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-14 14:50 [PATCH v2 net-next 0/5] l2tp: set l2specific_len based on l2specific_type Lorenzo Bianconi
2018-01-14 14:50 ` [PATCH v2 net-next 1/5] l2tp: fix switch default error handling in l2tp_nl_cmd_session_create() Lorenzo Bianconi
2018-01-15 18:33   ` Guillaume Nault
2018-01-15 21:18     ` Lorenzo Bianconi
2018-01-15 22:00       ` James Chapman
2018-01-15 22:07         ` Lorenzo Bianconi
2018-01-16 10:24       ` Guillaume Nault
2018-01-14 14:50 ` [PATCH v2 net-next 2/5] l2tp: double-check l2specific_type provided by userspace Lorenzo Bianconi
2018-01-15 18:00   ` Guillaume Nault
2018-01-15 18:18     ` Lorenzo Bianconi
2018-01-15 18:44       ` Guillaume Nault
2018-01-14 14:50 ` [PATCH v2 net-next 3/5] l2tp: remove l2specific_len dependency in l2tp_core Lorenzo Bianconi
2018-01-15 18:20   ` Guillaume Nault
2018-01-15 18:43     ` Lorenzo Bianconi
2018-01-15 18:54       ` Guillaume Nault [this message]
2018-01-15 21:11         ` Lorenzo Bianconi
2018-01-16  9:40           ` Guillaume Nault
2018-01-14 14:50 ` [PATCH v2 net-next 4/5] l2tp: remove l2specific_len configurable parameter Lorenzo Bianconi
2018-01-14 14:50 ` [PATCH v2 net-next 5/5] l2tp: mark L2TP_ATTR_L2SPEC_LEN as not used Lorenzo Bianconi
2018-01-16 10:55 ` [PATCH v2 net-next 0/5] l2tp: set l2specific_len based on l2specific_type Guillaume Nault
2018-01-16 11:45   ` Lorenzo Bianconi
2018-01-16 11:50     ` 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=20180115185403.GE1422@alphalink.fr \
    --to=g.nault@alphalink.fr \
    --cc=davem@davemloft.net \
    --cc=jchapman@katalix.com \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).