All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Zhang, Chunyu" <zhangcy@cn.fujitsu.com>
Cc: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: Re: Re: [PATCH] Add NFPROTO_ARP for mark
Date: Thu, 16 Apr 2015 13:06:03 +0200	[thread overview]
Message-ID: <20150416110603.GA3451@salvia> (raw)
In-Reply-To: <A43879EB4A7F5F449E2CA8148EA79E51758324@G08CNEXMBPEKD01.g08.fujitsu.local>

On Thu, Apr 16, 2015 at 05:39:31AM +0000, Zhang, Chunyu wrote:
> 
> hi pablo
> 
> >From: Pablo Neira Ayuso
> >Date: 2015-04-09
> >To: Zhang, Chunyu/章 春宇
> >Subject: Re: Re: [PATCH] Add NFPROTO_ARP for mark
> >
> >On Thu, Apr 09, 2015 at 03:54:33AM +0000, Zhang, Chunyu wrote:
> >> >From: Pablo Neira Ayuso
> >> >Date: 2015-04-09
> >> >To: Zhang, Chunyu/章 春宇
> >> >Subject: Re: [PATCH] Add NFPROTO_ARP for mark
> >[...]
> >> >> @@ -41,13 +42,23 @@ mark_mt(const struct sk_buff *skb, struct xt_action_param *par)
> >> >>       return ((skb->mark & info->mask) == info->mark) ^ info->invert;
> >> >>  }
> >> >>
> >> >> -static struct xt_target mark_tg_reg __read_mostly = {
> >> >> -     .name           = "MARK",
> >> >> -     .revision       = 2,
> >> >> -     .family         = NFPROTO_UNSPEC,
> >> >> -     .target         = mark_tg,
> >> >> -     .targetsize     = sizeof(struct xt_mark_tginfo2),
> >> >> -     .me             = THIS_MODULE,
> >> >> +static struct xt_target mark_tg_reg[] __read_mostly = {
> >> >> +     {
> >> >> +             .name           = "MARK",
> >> >> +             .revision       = 2,
> >> >> +             .family         = NFPROTO_UNSPEC,
> >> >> +             .target         = mark_tg,
> >> >> +             .targetsize     = sizeof(struct xt_mark_tginfo2),
> >> >> +             .me             = THIS_MODULE,
> >> >> +     },
> >> >> +     {
> >> >> +             .name           = "MARK",
> >> >> +             .revision       = 2,
> >> >> +             .family         = NFPROTO_ARP,
> >> >> +             .target         = mark_tg,
> >> >> +             .targetsize     = sizeof(struct xt_mark_tginfo2),
> >> >> +             .me             = THIS_MODULE,
> >> >> +     }
> >> >>  };
> >> >
> >> >You don't need this.
> >> >
> >> >The problem is here that your patch:
> >> >
> >> >http://patchwork.ozlabs.org/patch/455966/
> >> >
> >> >is missing this chunk:
> >> >
> >> >diff --git a/libarptc/libarptc_incl.c b/libarptc/libarptc_incl.c
> >> >index a034930..87404ce 100644
> >> >--- a/libarptc/libarptc_incl.c
> >> >+++ b/libarptc/libarptc_incl.c
> >> >@@ -872,7 +872,7 @@ map_target(const TC_HANDLE_T handle,
> >> >        /* memset to all 0 for your memcmp convenience. */
> >> >        memset(t->u.user.name + strlen(t->u.user.name),
> >> >               0,
> >> >-              FUNCTION_MAXNAMELEN - strlen(t->u.user.name));
> >> >+              FUNCTION_MAXNAMELEN - 1 - strlen(t->u.user.name));
> >> >        return 1;
> >> > }
> 
> 1. 
> maybe should change like this?
> 
> diff --git a/libarptc/libarptc_incl.c b/libarptc/libarptc_incl.c
> index a034930..4049cbd 100644
> --- a/libarptc/libarptc_incl.c
> +++ b/libarptc/libarptc_incl.c
> @@ -872,7 +872,7 @@ map_target(const TC_HANDLE_T handle,
>         /* memset to all 0 for your memcmp convenience. */
>         memset(t->u.user.name + strlen(t->u.user.name),
>                0,
> -              FUNCTION_MAXNAMELEN - strlen(t->u.user.name));
> +              XT_EXTENSION_MAXNAMELEN - strlen(t->u.user.name));

No, you can't do this.

After getting arptables userspace in sync with kernel headers, you can
see that:

#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN

and:

libarptc/libarptc.c:#define FUNCTION_MAXNAMELEN ARPT_FUNCTION_MAXNAMELEN

You have to do it the way I suggested.

Another motivation to make it the way I indicated is that this will be
in sync with iptables/ip6tables.

Anyway, I have just pushed this branch:

http://git.netfilter.org/arptables/log/?h=next

to try to close this discussion.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-04-16 11:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07  2:45 [PATCH] Add NFPROTO_ARP for mark target Zhang Chunyu
2015-04-07  2:45 ` [PATCH] Add NFPROTO_ARP for mark Zhang Chunyu
2015-04-08 17:49   ` Pablo Neira Ayuso
2015-04-09  3:54     ` Zhang, Chunyu
2015-04-09 10:41       ` Pablo Neira Ayuso
2015-04-16  5:39         ` Zhang, Chunyu
2015-04-16  5:45           ` Zhang, Chunyu
2015-04-16 11:06           ` Pablo Neira Ayuso [this message]
2015-04-17  1:38             ` Zhang, Chunyu

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=20150416110603.GA3451@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=zhangcy@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.