netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart De Schuymer <bdschuym-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org>
To: Harald Welte <laforge-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org>
Cc: Linux Netdev List
	<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	ebtables-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] ebtables: Port ebt_[u]log.c to nf[netlink]_log
Date: Mon, 17 Oct 2005 17:59:59 +0000	[thread overview]
Message-ID: <1129571999.3383.6.camel@localhost.localdomain> (raw)
In-Reply-To: <20051007234903.GR4450-5xaKNk1AN7bNqB9Gf7YOJg/oQhhTQFE7QQ4Iyu8u01E@public.gmane.org>

Op za, 08-10-2005 te 01:49 +0200, schreef Harald Welte:
> Hi Bart!
> 
> The patch below is totally untested (though it compiles), and updates
> ebtables to resemble the behaviour that we now have in ipv4 (and ipv6):
> {ip,ip6,eb}tables just tell the nf_log core that they want to log a
> packet, the mechanism (syslog, nfnetlink_log, ...) is actually decided
> by nf_log.
> 
> By default, everything will behave like before.
> 
> Please review, and test that ebt_log and ebt_ulog are still working as
> expected.  Thanks!

Sorry for the late reply, some hardware problems got in the way.
Apart from the comments below, the patch is fine by me (I tested both).

Thanks a lot,
Bart

> @@ -144,6 +153,21 @@ static void ebt_log(const struct sk_buff
>  out:
>  	printk("\n");
>  	spin_unlock_bh(&ebt_log_lock);
> +
> +}
> +
> +static void ebt_log(const struct sk_buff *skb, unsigned int hooknr,
> +   const struct net_device *in, const struct net_device *out,
> +   const void *data, unsigned int datalen)
> +{
> +	struct ebt_log_info *info = (struct ebt_log_info *)data;
> +	struct nf_loginfo li;
> +
> +	li.type = NF_LOG_TYPE_LOG;
> +	li.u.log.level = info->loglevel;
> +	li.u.log.logflags = info->bitmask;
> +
> +	nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, info->prefix);

Should be ebt_log_packet

>  }
>  
>  static struct ebt_watcher log =
> @@ -154,13 +178,32 @@ static struct ebt_watcher log =
>  	.me		= THIS_MODULE,
>  };
>  
> +static struct nf_logger ebt_log_logger = {
> +	.name 		= "ebt_log",
> +	.logfn		= &ebt_log_packet,
> +	.me		= THIS_MODULE,
> +};
> +
>  static int __init init(void)
>  {
> -	return ebt_register_watcher(&log);
> +	int ret;
> +
> +	ret = ebt_register_watcher(&log);
> +	if (ret < 0)
> +		return ret;
> +	if (nf_log_register(PF_BRIDGE, &ebt_log_logger) < 0) {
> +		printk(KERN_WARNING "ebt_log: not logging via system console "
> +		       "since somebody else already registered for PF_INET\n");
> +		/* wecannot make module load fail here, since otherwise 
> +		 * ebtables userspace would abort */
> +	}

Since we're using PF_BRIDGE instead of PF_INET now, this if construct
can be replaced by a simple call to nf_log_register.




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

  parent reply	other threads:[~2005-10-17 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-07 23:49 [PATCH] ebtables: Port ebt_[u]log.c to nf[netlink]_log Harald Welte
     [not found] ` <20051007234903.GR4450-5xaKNk1AN7bNqB9Gf7YOJg/oQhhTQFE7QQ4Iyu8u01E@public.gmane.org>
2005-10-11 19:31   ` Bart De Schuymer
     [not found]     ` <1129059110.5087.8.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2005-10-11 19:55       ` David S. Miller
     [not found]         ` <20051011.125506.46476570.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2005-10-11 20:49           ` Bart De Schuymer
2005-10-12  6:27       ` Harald Welte
     [not found]         ` <20051012062745.GB4237-d6usTx1WJblOCgDDqY8e12D2FQJk+8+b@public.gmane.org>
2005-10-12 20:10           ` Ian McDonald
2005-10-17 17:59   ` Bart De Schuymer [this message]
     [not found]     ` <1129571999.3383.6.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2005-10-18  8:58       ` Harald Welte
     [not found]         ` <20051018085853.GG20338-XKR8MNpNCaUy1wpV0ib6OjPN8QKu1tr+@public.gmane.org>
2005-10-18 15:12           ` Bart De Schuymer
     [not found]             ` <1129648337.4504.3.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2005-11-12  9:49               ` Harald Welte
     [not found]                 ` <20051112094936.GA27644-XKR8MNpNCaUy1wpV0ib6OjPN8QKu1tr+@public.gmane.org>
2005-11-14 12:09                   ` Ingo Oeser

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=1129571999.3383.6.camel@localhost.localdomain \
    --to=bdschuym-lpo8gxj9n8azioh1ieqzka@public.gmane.org \
    --cc=ebtables-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=laforge-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).