All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Laszlo Attila Toth <panther@balabit.hu>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 1/2] Find address type on a specific or on any interface
Date: Thu, 18 Oct 2007 11:13:21 +0200	[thread overview]
Message-ID: <471723B1.2080804@trash.net> (raw)
In-Reply-To: <11921980402340-git-send-email-panther@balabit.hu>

Laszlo Attila Toth wrote:
> +/*
> + * Find address type as if only "on_dev" was present in the system. If
> + * on_dev is NULL then all interfaces are taken into consideration.
> + */
> +static inline unsigned __inet_addr_type_on_dev(__be32 addr, const struct net_device *on_dev)

I would prefer the name "__inet_dev_addr_type" or "__dev_inet_addr_type"

>  {
>  	struct flowi		fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
>  	struct fib_result	res;
> @@ -164,13 +168,25 @@ unsigned inet_addr_type(__be32 addr)
>  		ret = RTN_UNICAST;
>  		if (!ip_fib_local_table->tb_lookup(ip_fib_local_table,
>  						   &fl, &res)) {
> -			ret = res.type;
> +			if ((!on_dev || on_dev == res.fi->fib_dev)) {
> +			        ret = res.type;
> +			}

No braces around single statements that fit on one line please.

>  			fib_res_put(&res);
>  		}
>  	}
>  	return ret;
>  }
>  
> +unsigned inet_addr_type(__be32 addr)
> +{
> +  return __inet_addr_type_on_dev(addr, NULL);

Use tabs for indenting.

  parent reply	other threads:[~2007-10-18  9:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-12 14:03 [PATCH 0/2] address type match limited to incoming interface Laszlo Attila Toth
2007-10-12 14:07 ` [PATCH 1/2] Find address type on a specific or on any interface Laszlo Attila Toth
2007-10-12 14:07   ` [PATCH 2/2] Addrtype match extension: limit addrtype check on the packet's interface Laszlo Attila Toth
2007-10-18  9:16     ` Patrick McHardy
2007-10-18 11:34       ` Laszlo Attila Toth
2007-10-20 14:50       ` Laszlo Attila Toth
2007-10-18  9:13   ` Patrick McHardy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-10-05 15:20 [PATCH 0/2] Addrtype match limit to a specific interface. Patches Tóth László Attila
2007-10-05 15:20 ` [PATCH 1/2] Find address type on a specific or on any interface Tóth László Attila

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=471723B1.2080804@trash.net \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=panther@balabit.hu \
    /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.