netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: Simon Horman <simon.horman@netronome.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Tom Herbert <tom@quantonium.net>
Subject: Re: [PATCH v5 net-next 3/7] ipeh: Generic TLV parser
Date: Sat, 14 Dec 2019 11:08:28 -0800	[thread overview]
Message-ID: <CALx6S37Mejm1_nbwxJhKC3o5EY0gidTLuY5roepF2dKyXEB1eg@mail.gmail.com> (raw)
In-Reply-To: <20191006130526.c65ibu5hoizctaq6@netronome.com>

On Sun, Oct 6, 2019 at 6:05 AM Simon Horman <simon.horman@netronome.com> wrote:
>
> On Thu, Oct 03, 2019 at 02:58:00PM -0700, Tom Herbert wrote:
> > From: Tom Herbert <tom@quantonium.net>
> >
> > Create a generic TLV parser. This will be used with various
> > extension headers that carry options including Destination,
> > Hop-by-Hop, Segment Routing TLVs, and other cases of simple
> > stateless parsing.
> >
> > Signed-off-by: Tom Herbert <tom@herbertland.com>
> > ---
> >  include/net/ipeh.h        |  25 ++++++++
> >  net/ipv6/exthdrs.c        | 159 +++++++++++-----------------------------------
> >  net/ipv6/exthdrs_common.c | 114 +++++++++++++++++++++++++++++++++
> >  3 files changed, 177 insertions(+), 121 deletions(-)
> >
> > diff --git a/include/net/ipeh.h b/include/net/ipeh.h
> > index 3b24831..c1aa7b6 100644
> > --- a/include/net/ipeh.h
> > +++ b/include/net/ipeh.h
> > @@ -31,4 +31,29 @@ struct ipv6_txoptions *ipeh_renew_options(struct sock *sk,
> >  struct ipv6_txoptions *ipeh_fixup_options(struct ipv6_txoptions *opt_space,
> >                                         struct ipv6_txoptions *opt);
> >
> > +/* Generic extension header TLV parser */
> > +
> > +enum ipeh_parse_errors {
> > +     IPEH_PARSE_ERR_PAD1,            /* Excessive PAD1 */
> > +     IPEH_PARSE_ERR_PADN,            /* Excessive PADN */
> > +     IPEH_PARSE_ERR_PADNZ,           /* Non-zero padding data */
> > +     IPEH_PARSE_ERR_EH_TOOBIG,       /* Length of EH exceeds limit */
> > +     IPEH_PARSE_ERR_OPT_TOOBIG,      /* Option size exceeds limit */
> > +     IPEH_PARSE_ERR_OPT_TOOMANY,     /* Option count exceeds limit */
> > +     IPEH_PARSE_ERR_OPT_UNK_DISALW,  /* Unknown option disallowed */
> > +     IPEH_PARSE_ERR_OPT_UNK,         /* Unknown option */
> > +};
> > +
> > +/* The generic TLV parser assumes that the type value of PAD1 is 0, and PADN
> > + * is 1. This is true for Destination, Hop-by-Hop and current definition
> > + * of Segment Routing TLVs.
> > + */
> > +#define IPEH_TLV_PAD1        0
> > +#define IPEH_TLV_PADN        1
> > +
> > +bool ipeh_parse_tlv(const struct tlvtype_proc *procs, struct sk_buff *skb,
> > +                 int max_count, int off, int len,
> > +                 bool (*parse_error)(struct sk_buff *skb,
> > +                                     int off, enum ipeh_parse_errors error));
> > +
> >  #endif /* _NET_IPEH_H */
>
> Hi Tom,
>
> Unless I misread things, which is entirely possible, it seems
> as well as moving code around this patch changes behaviour under
> some error conditions via the parse_error callback and
> the ipv6_parse_error() implementation of it below.
>
> I think such a change is worth of at lest calling out in the changelog
> and perhaps braking out into a separate patch.
>
Okay, makes sense to split out the parse_error code. I also noticed
that there's no counter being bumped when we drop a HBH option, I'll
fix that.

> ...

  reply	other threads:[~2019-12-14 19:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 21:57 [PATCH v5 net-next 0/7] ipv6: Extension header infrastructure Tom Herbert
2019-10-03 21:57 ` [PATCH v5 net-next 1/7] ipeh: Create exthdrs_options.c and ipeh.h Tom Herbert
2019-10-06 13:02   ` Simon Horman
2019-12-14 18:44     ` Tom Herbert
2019-10-03 21:57 ` [PATCH v5 net-next 2/7] ipeh: Move generic EH functions to exthdrs_common.c Tom Herbert
2019-10-06 13:00   ` Simon Horman
2019-12-14 18:47     ` Tom Herbert
2019-12-18 10:56       ` Simon Horman
2019-10-03 21:58 ` [PATCH v5 net-next 3/7] ipeh: Generic TLV parser Tom Herbert
2019-10-06 13:05   ` Simon Horman
2019-12-14 19:08     ` Tom Herbert [this message]
2019-10-03 21:58 ` [PATCH v5 net-next 4/7] ip6tlvs: Registration of TLV handlers and parameters Tom Herbert
2019-10-06 13:18   ` Simon Horman
2019-10-03 21:58 ` [PATCH v5 net-next 5/7] ip6tlvs: Add TX parameters Tom Herbert
2019-10-06 13:25   ` Simon Horman
2019-12-14 19:19     ` Tom Herbert
2019-10-03 21:58 ` [PATCH v5 net-next 6/7] ip6tlvs: Add netlink interface Tom Herbert
2019-10-07 12:39   ` Simon Horman
2019-12-14 19:25     ` Tom Herbert
2019-10-03 21:58 ` [PATCH v5 net-next 7/7] ip6tlvs: Validation of TX Destination and Hop-by-Hop options Tom Herbert

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=CALx6S37Mejm1_nbwxJhKC3o5EY0gidTLuY5roepF2dKyXEB1eg@mail.gmail.com \
    --to=tom@herbertland.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    --cc=tom@quantonium.net \
    /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).