netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft RFC] payload: use ethertype in hexadecimal for meta protocol
Date: Wed, 15 Jan 2014 17:17:21 +0000	[thread overview]
Message-ID: <20140115171642.GA4033@macbook.localnet> (raw)
In-Reply-To: <1389805902-8807-1-git-send-email-pablo@netfilter.org>

On Wed, Jan 15, 2014 at 06:11:42PM +0100, Pablo Neira Ayuso wrote:
> This is a temporary workaround to avoid parsing problems since
> ip and arp are misinterpreted by the parser. It also uses ipv6
> which is different from ip6 and it seems inconsistent to me.

Why not fix it the way we did for TCP/UDP/...?

I agree about the inconsistencies wrt. ipv6 vs. ip6, we should change
all occurences to one of both. Don't really care which one, but I guess
ipv6 is "more correct".

> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> A possible alternative to this patch could be to use something
> like: ether-arp ether-ip ether-ipv6 ether-vlan, as these represent
> ethernet protocol types.



> 
>  src/payload.c |   17 +++--------------
>  1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/src/payload.c b/src/payload.c
> index 86d75fa..c4ea6da 100644
> --- a/src/payload.c
> +++ b/src/payload.c
> @@ -978,16 +978,6 @@ const struct datatype etheraddr_type = {
>  	.basetype	= &lladdr_type,
>  };
>  
> -static const struct symbol_table ethertype_tbl = {
> -	.symbols	= {
> -		SYMBOL("ip",		ETH_P_IP),
> -		SYMBOL("arp",		ETH_P_ARP),
> -		SYMBOL("ipv6",		ETH_P_IPV6),
> -		SYMBOL("vlan",		ETH_P_8021Q),
> -		SYMBOL_LIST_END
> -	},
> -};
> -
>  static struct error_record *ethertype_parse(const struct expr *sym,
>  					    struct expr **res)
>  {
> @@ -996,14 +986,13 @@ static struct error_record *ethertype_parse(const struct expr *sym,
>  	erec = sym->dtype->basetype->parse(sym, res);
>  	if (erec != NULL)
>  		return erec;
> -	if (*res)
> -		return NULL;
> -	return symbolic_constant_parse(sym, &ethertype_tbl, res);
> +
> +	return NULL;
>  }
>  
>  static void ethertype_print(const struct expr *expr)
>  {
> -	return symbolic_constant_print(&ethertype_tbl, expr);
> +	expr_basetype(expr)->print(expr);
>  }
>  
>  const struct datatype ethertype_type = {
> -- 
> 1.7.10.4

      reply	other threads:[~2014-01-15 17:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 17:11 [PATCH nft RFC] payload: use ethertype in hexadecimal for meta protocol Pablo Neira Ayuso
2014-01-15 17:17 ` Patrick McHardy [this message]

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=20140115171642.GA4033@macbook.localnet \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).