Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] ebtables: Port ebt_[u]log.c to nf[netlink]_log
From: Bart De Schuymer @ 2005-10-17 17:59 UTC (permalink / raw)
  To: Harald Welte
  Cc: Linux Netdev List,
	ebtables-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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

^ permalink raw reply

* swerve Int'l punctual posting! Take your tablet rapidly. variant
From: santos maginn @ 2005-10-18  2:03 UTC (permalink / raw)
  To: Jacob Houser, owner-linux-xfs, tucker, netdev, lockmeter, murray



All communications are sheltered with safekeeping policy. 
Gratis replenish Rxx toward your serious chronic symptom! 

Not exceed 46hrs, it will be reached at your place. 
Tip top capsule at cheap tags.

Purchase from us, Get hold of complimentary case details review. 

I'm extremely satisfied. No suspicions to take from your URL again. Mark D
--DC. 
http://uk.geocities.com/comeonandtryb/?n

Mr. Squod tacks out, all on one side, to execute the word of command; and
the trooper, having smoked his pipe, lays it by. Jo is brought in. He is not
one of Mrs. Pardiggle's Tockahoopo Indians; he is not one of Mrs. Jellyby's
lambs, being wholly unconnected with Borrioboola-Gha; he is not softened by
distance and unfamiliarity; he is not a genuine foreign-grown savage; he is
the ordinary home-made article. Dirty, ugly, disagreeable to all the senses,
in body a common creature of the common streets, only in soul a heathen.
Homely filth begrimes him, homely parasites devour him, homely sores are in
him, homely rags are on him; native ignorance, the growth of English soil
and climate, sinks his immortal nature lower than the beasts that perish.
Stand forth, Jo, in uncompromising colours. From the sole of thy foot to the
crown of thy head, there is nothing interesting about thee. 
He shuffles slowly into Mr. George's gallery and stands huddled together in
a bundle, looking all about the floor. He seems to know that they have an
inclination to shrink from him, partly for what he is and partly for what he
has caused. He, too, shrinks from them. He is not of the same order of
things, not of the same place in creation. He is of no order and no place,
neither of the beasts nor of humanity. 

cymraeg  estin  flann sz03 elzzird  eradio

There used, in that week, to come backward and forward to our lodging to
fence with Richard a person who had formerly been a cavalry soldier; he was
a fine bluff-looking man, of a frank ggmmjj bearing, with whom Richard had
practised for some months. I heard so much about him, not only from Richard,
but from my guardian too, that I was purposely in the room with my work one
morning after breakfast when he came. 

^ permalink raw reply

* Re: [PATCH] X25: Add ITU-T facilites
From: Andrew Hendry @ 2005-10-18  6:09 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: eis, linux-x25, linux-kernel, netdev
In-Reply-To: <20051017022826.GA23167@mandriva.com>

Thanks for the feedback Arnaldo. All points should be fixed.

Adds options for ITU DTE facilities to X.25, called address extension and calling address extension

Signed-off-by: Andrew Hendry <ahendry@tusc.com.au>

diff -uprN -X dontdiff linux-2.6.13.4-vanilla/include/linux/x25.h linux-2.6.13.4/include/linux/x25.h
--- linux-2.6.13.4-vanilla/include/linux/x25.h	2005-10-11 04:54:29.000000000 +1000
+++ linux-2.6.13.4/include/linux/x25.h	2005-10-17 10:38:22.000000000 +1000
@@ -21,6 +21,8 @@
 #define SIOCX25SCUDMATCHLEN	(SIOCPROTOPRIVATE + 7)
 #define SIOCX25CALLACCPTAPPRV   (SIOCPROTOPRIVATE + 8)
 #define SIOCX25SENDCALLACCPT    (SIOCPROTOPRIVATE + 9)
+#define SIOCX25GDTEFACILITIES   (SIOCPROTOPRIVATE + 10)
+#define SIOCX25SDTEFACILITIES   (SIOCPROTOPRIVATE + 11)
 
 /*
  *	Values for {get,set}sockopt.
@@ -77,6 +79,8 @@ struct x25_subscrip_struct {
 #define	X25_MASK_PACKET_SIZE	0x04
 #define	X25_MASK_WINDOW_SIZE	0x08
 
+#define X25_MASK_CALLING_AE     0x10
+#define X25_MASK_CALLED_AE      0x20
 
 
 /*
@@ -98,6 +102,24 @@ struct x25_facilities {
 	unsigned int	reverse;
 };
 
+/* 
+*     ITU DTE facilities
+*     Only the called and calling address
+*     extension are currently implemented.
+*     The rest are in place to avoid the struct
+*     changing size if someone needs them later
++ */
+struct x25_dte_facilities {
+	unsigned int    calling_len, called_len;
+	char            calling_ae[20];
+	char            called_ae[20];
+	unsigned char   min_throughput;
+	unsigned short  delay_cumul;
+	unsigned short  delay_target;
+	unsigned short  delay_max;
+	unsigned char   expedited;
+};
+
 /*
  *	Call User Data structure.
  */
diff -uprN -X dontdiff linux-2.6.13.4-vanilla/include/net/x25.h linux-2.6.13.4/include/net/x25.h
--- linux-2.6.13.4-vanilla/include/net/x25.h	2005-10-11 04:54:29.000000000 +1000
+++ linux-2.6.13.4/include/net/x25.h	2005-10-17 17:02:44.000000000 +1000
@@ -101,9 +101,16 @@ enum {
 #define	X25_FAC_PACKET_SIZE	0x42
 #define	X25_FAC_WINDOW_SIZE	0x43
 
-#define	X25_MAX_FAC_LEN		20		/* Plenty to spare */
+#define	X25_MAX_FAC_LEN		60
 #define	X25_MAX_CUD_LEN		128
 
+#define X25_FAC_CALLING_AE      0xCB
+#define X25_FAC_CALLED_AE       0xC9
+
+#define X25_MARKER              0x00
+#define X25_DTE_SERVICES        0x0F
+#define X25_MAX_AE_LEN          32
+
 /**
  *	struct x25_route - x25 routing entry
  *	@node - entry in x25_list_lock
@@ -148,6 +155,7 @@ struct x25_sock {
 	struct timer_list	timer;
 	struct x25_causediag	causediag;
 	struct x25_facilities	facilities;
+	struct x25_dte_facilities dte_facilities;
 	struct x25_calluserdata	calluserdata;
 	unsigned long 		vc_facil_mask;	/* inc_call facilities mask */
 };
@@ -180,9 +188,9 @@ extern void x25_establish_link(struct x2
 extern void x25_terminate_link(struct x25_neigh *);
 
 /* x25_facilities.c */
-extern int  x25_parse_facilities(struct sk_buff *, struct x25_facilities *, unsigned long *);
-extern int  x25_create_facilities(unsigned char *, struct x25_facilities *, unsigned long);
-extern int  x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *);
+extern int  x25_parse_facilities(struct sk_buff *, struct x25_facilities *, struct x25_dte_facilities *, unsigned long *);
+extern int  x25_create_facilities(unsigned char *, struct x25_facilities *, struct x25_dte_facilities *, unsigned long);
+extern int  x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *, struct x25_dte_facilities *);
 extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *);
 
 /* x25_in.c */
diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/af_x25.c linux-2.6.13.4/net/x25/af_x25.c
--- linux-2.6.13.4-vanilla/net/x25/af_x25.c	2005-10-11 04:54:29.000000000 +1000
+++ linux-2.6.13.4/net/x25/af_x25.c	2005-10-17 16:49:38.000000000 +1000
@@ -513,6 +513,13 @@ static int x25_create(struct socket *soc
 	x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE;
 	x25->facilities.throughput  = X25_DEFAULT_THROUGHPUT;
 	x25->facilities.reverse     = X25_DEFAULT_REVERSE;
+	x25->dte_facilities.calling_len	= 0;
+	x25->dte_facilities.called_len	= 0;
+	memset(x25->dte_facilities.called_ae, '\0',
+		sizeof(x25->dte_facilities.called_ae));
+	memset(x25->dte_facilities.calling_ae, '\0',
+		sizeof(x25->dte_facilities.calling_ae));
+	
 	rc = 0;
 out:
 	return rc;
@@ -554,6 +561,7 @@ static struct sock *x25_make_new(struct 
 	x25->t2         = ox25->t2;
 	x25->facilities = ox25->facilities;
 	x25->qbitincl   = ox25->qbitincl;
+	x25->dte_facilities = ox25->dte_facilities;
 	x25->cudmatchlength = ox25->cudmatchlength;
 	x25->accptapprv = ox25->accptapprv;
 
@@ -833,6 +841,7 @@ int x25_rx_call_request(struct sk_buff *
 	struct x25_sock *makex25;
 	struct x25_address source_addr, dest_addr;
 	struct x25_facilities facilities;
+	struct x25_dte_facilities dte_facilities;
 	int len, rc;
 
 	/*
@@ -869,7 +878,8 @@ int x25_rx_call_request(struct sk_buff *
 	/*
 	 *	Try to reach a compromise on the requested facilities.
 	 */
-	if ((len = x25_negotiate_facilities(skb, sk, &facilities)) == -1)
+	if ((len = x25_negotiate_facilities(skb, sk, &facilities, 
+		&dte_facilities)) == -1)
 		goto out_sock_put;
 
 	/*
@@ -900,9 +910,12 @@ int x25_rx_call_request(struct sk_buff *
 	makex25->source_addr   = source_addr;
 	makex25->neighbour     = nb;
 	makex25->facilities    = facilities;
+	makex25->dte_facilities= dte_facilities;
 	makex25->vc_facil_mask = x25_sk(sk)->vc_facil_mask;
 	/* ensure no reverse facil on accept */
 	makex25->vc_facil_mask &= ~X25_MASK_REVERSE;
+	/* ensure no calling address extension on accept */
+	makex25->vc_facil_mask &= ~X25_MASK_CALLING_AE;
 	makex25->cudmatchlength = x25_sk(sk)->cudmatchlength;
 
 	/* Normally all calls are accepted immediatly */
@@ -1309,6 +1322,34 @@ static int x25_ioctl(struct socket *sock
 			break;
 		}
 
+		case SIOCX25GDTEFACILITIES: {
+			rc = copy_to_user(argp, &x25->dte_facilities,
+				sizeof(x25->dte_facilities)) ? -EFAULT : 0;
+			break;
+		}
+
+		case SIOCX25SDTEFACILITIES: {
+			struct x25_dte_facilities dtefacs;
+			rc = -EFAULT;
+			if (copy_from_user(&dtefacs, argp, sizeof(dtefacs)))
+				break;
+			rc = -EINVAL;
+			if (sk->sk_state != TCP_LISTEN &&
+			    sk->sk_state != TCP_CLOSE)
+				break;
+			if (dtefacs.calling_len > X25_MAX_AE_LEN)
+				break;
+			if (dtefacs.calling_ae == NULL)
+				break;
+			if (dtefacs.called_len > X25_MAX_AE_LEN)
+				break;
+			if (dtefacs.called_ae == NULL)
+				break;
+			x25->dte_facilities = dtefacs;
+			rc = 0;
+			break;
+		}
+
 		case SIOCX25GCALLUSERDATA: {
 			struct x25_calluserdata cud = x25->calluserdata;
 			rc = copy_to_user(argp, &cud,
diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/x25_facilities.c linux-2.6.13.4/net/x25/x25_facilities.c
--- linux-2.6.13.4-vanilla/net/x25/x25_facilities.c	2005-10-11 04:54:29.000000000 +1000
+++ linux-2.6.13.4/net/x25/x25_facilities.c	2005-10-17 15:28:10.000000000 +1000
@@ -28,11 +28,12 @@
 #include <net/x25.h>
 
 /*
- *	Parse a set of facilities into the facilities structure. Unrecognised
+ *	Parse a set of facilities into the facilities structures. Unrecognised
  *	facilities are written to the debug log file.
  */
 int x25_parse_facilities(struct sk_buff *skb,
 			 struct x25_facilities *facilities,
+			 struct x25_dte_facilities *dte_facs,
 			 unsigned long *vc_fac_mask)
 {
 	unsigned char *p = skb->data;
@@ -40,6 +41,16 @@ int x25_parse_facilities(struct sk_buff 
 
 	*vc_fac_mask = 0;
 
+	/* The kernel knows which facilities were set on an incoming call
+	 * but currently this information is not available to userspace.
+	 * Here we give userspace who read incoming call facilities
+	 * 0 length to indicate it wasn't set.
+	 */
+	dte_facs->calling_len = 0;
+	dte_facs->called_len = 0;
+	memset(dte_facs->called_ae, '\0', sizeof(dte_facs->called_ae));
+	memset(dte_facs->calling_ae, '\0', sizeof(dte_facs->calling_ae));
+
 	while (len > 0) {
 		switch (*p & X25_FAC_CLASS_MASK) {
 		case X25_FAC_CLASS_A:
@@ -74,6 +85,8 @@ int x25_parse_facilities(struct sk_buff 
 				facilities->throughput = p[1];
 				*vc_fac_mask |= X25_MASK_THROUGHPUT;
 				break;
+			case X25_MARKER:
+				break;
 			default:
 				printk(KERN_DEBUG "X.25: unknown facility "
 				       "%02X, value %02X\n",
@@ -112,9 +125,28 @@ int x25_parse_facilities(struct sk_buff 
 			len -= 4;
 			break;
 		case X25_FAC_CLASS_D:
-			printk(KERN_DEBUG "X.25: unknown facility %02X, "
-			       "length %d, values %02X, %02X, %02X, %02X\n",
-			       p[0], p[1], p[2], p[3], p[4], p[5]);
+			switch (*p) {
+			case X25_FAC_CALLING_AE:
+				if (p[1] > 33)
+					break;
+				dte_facs->calling_len = p[2];
+				memcpy(dte_facs->calling_ae, &p[3], p[1] - 1);
+				*vc_fac_mask |= X25_MASK_CALLING_AE;
+				break;
+			case X25_FAC_CALLED_AE:
+				if (p[1] > 33)
+					break;
+				dte_facs->called_len = p[2];
+				memcpy(dte_facs->called_ae, &p[3], p[1] - 1);
+				*vc_fac_mask |= X25_MASK_CALLED_AE;
+				break;
+			default:	
+				printk(KERN_DEBUG "X.25: unknown facility %02X,"
+				"length %d, values %02X, %02X, %02X, %02X\n",
+				 p[0], p[1], p[2], p[3], p[4], p[5]);
+				break;
+			}
+
 			len -= p[1] + 2;
 			p   += p[1] + 2;
 			break;
@@ -129,6 +161,7 @@ int x25_parse_facilities(struct sk_buff 
  */
 int x25_create_facilities(unsigned char *buffer,
 			  struct x25_facilities *facilities,
+			  struct x25_dte_facilities *dte_facs,
 			  unsigned long facil_mask)
 {
 	unsigned char *p = buffer + 1;
@@ -168,6 +201,34 @@ int x25_create_facilities(unsigned char 
 		*p++ = facilities->winsize_out ? : facilities->winsize_in;
 	}
 
+	if ((facil_mask & X25_MASK_CALLING_AE) || 
+	     (facil_mask & X25_MASK_CALLED_AE)) {
+		*p++ = X25_MARKER;
+		*p++ = X25_DTE_SERVICES;
+	}
+
+	if (dte_facs->calling_len && (facil_mask & X25_MASK_CALLING_AE)) {
+		unsigned bytecount = (dte_facs->calling_len % 2) ?
+                        dte_facs->calling_len / 2 + 1 :
+			dte_facs->calling_len / 2;
+		*p++ = X25_FAC_CALLING_AE;
+		*p++ = 1 + bytecount;
+		*p++ = dte_facs->calling_len;
+		memcpy(p, dte_facs->calling_ae, bytecount);
+		p+=bytecount;
+	}
+
+	if (dte_facs->called_len && (facil_mask & X25_MASK_CALLED_AE)) {
+		unsigned bytecount = (dte_facs->called_len % 2) ?
+                        dte_facs->called_len / 2 + 1 :
+			dte_facs->called_len / 2;
+		*p++ = X25_FAC_CALLED_AE;
+		*p++ = 1 + bytecount;
+		*p++ = dte_facs->called_len;
+		memcpy(p, dte_facs->called_ae, bytecount);
+		p+=bytecount;
+	}
+
 	len       = p - buffer;
 	buffer[0] = len - 1;
 
@@ -180,7 +241,8 @@ int x25_create_facilities(unsigned char 
  *	The only real problem is with reverse charging.
  */
 int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
-			     struct x25_facilities *new)
+			     struct x25_facilities *new,
+			     struct x25_dte_facilities *dte)
 {
 	struct x25_sock *x25 = x25_sk(sk);
 	struct x25_facilities *ours = &x25->facilities;
@@ -190,7 +252,7 @@ int x25_negotiate_facilities(struct sk_b
 	memset(&theirs, 0, sizeof(theirs));
 	memcpy(new, ours, sizeof(*new));
 
-	len = x25_parse_facilities(skb, &theirs, &x25->vc_facil_mask);
+	len = x25_parse_facilities(skb, &theirs, dte, &x25->vc_facil_mask);
 
 	/*
 	 *	They want reverse charging, we won't accept it.
diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/x25_in.c linux-2.6.13.4/net/x25/x25_in.c
--- linux-2.6.13.4-vanilla/net/x25/x25_in.c	2005-10-11 04:54:29.000000000 +1000
+++ linux-2.6.13.4/net/x25/x25_in.c	2005-10-17 10:38:22.000000000 +1000
@@ -106,6 +106,7 @@ static int x25_state1_machine(struct soc
 			skb_pull(skb, x25_addr_ntoa(skb->data, &source_addr, &dest_addr));
 			skb_pull(skb,
 				 x25_parse_facilities(skb, &x25->facilities,
+						      &x25->dte_facilities,
 						      &x25->vc_facil_mask));
 			/*
 			 *	Copy any Call User Data.
diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/x25_subr.c linux-2.6.13.4/net/x25/x25_subr.c
--- linux-2.6.13.4-vanilla/net/x25/x25_subr.c	2005-10-11 04:54:29.000000000 +1000
+++ linux-2.6.13.4/net/x25/x25_subr.c	2005-10-17 10:38:22.000000000 +1000
@@ -191,6 +191,7 @@ void x25_write_internal(struct sock *sk,
 			memcpy(dptr, addresses, len);
 			len     = x25_create_facilities(facilities,
 							&x25->facilities,
+							&x25->dte_facilities,
 					     x25->neighbour->global_facil_mask);
 			dptr    = skb_put(skb, len);
 			memcpy(dptr, facilities, len);
@@ -206,6 +207,7 @@ void x25_write_internal(struct sock *sk,
 			*dptr++ = 0x00;		/* Address lengths */
 			len     = x25_create_facilities(facilities,
 							&x25->facilities,
+							&x25->dte_facilities,
 							x25->vc_facil_mask);
 			dptr    = skb_put(skb, len);
 			memcpy(dptr, facilities, len);
Binary files linux-2.6.13.4-vanilla/scripts/genksyms/genksyms and linux-2.6.13.4/scripts/genksyms/genksyms differ




On Mon, 2005-10-17 at 12:28, Arnaldo Carvalho de Melo wrote:
> Em Mon, Oct 17, 2005 at 11:47:46AM +1000, Andrew Hendry escreveu:
> > Non line wrapped version..
> > Adds options for ITU DTE facilities to x.25, called address extension and
> > calling address extension.
> > 
> > Signed-off-by: Andrew Hendry <ahendry@tusc.com.au>
> 
> Some comments below, please fix them and I'll queue it up in my net-2.6.15
> git tree if Henner hasn't any problems with this, but I don't remember him
> being active maintaining X.25 for quite a while :-)
> 
> Ah, and please post networking patches to the netdev@vger.kernel.org in
> the future.
> 
> Thanks,
> 
> - Arnaldo
>  
> > diff -uprN -X dontdiff linux-2.6.13.4-vanilla/include/linux/x25.h linux-2.6.13.4/include/linux/x25.h
> > --- linux-2.6.13.4-vanilla/include/linux/x25.h	2005-09-17 11:02:12.000000000 +1000
> > +++ linux-2.6.13.4/include/linux/x25.h	2005-09-26 13:44:39.000000000 +1000
> > @@ -21,6 +21,8 @@
> >  #define SIOCX25SCUDMATCHLEN	(SIOCPROTOPRIVATE + 7)
> >  #define SIOCX25CALLACCPTAPPRV   (SIOCPROTOPRIVATE + 8)
> >  #define SIOCX25SENDCALLACCPT    (SIOCPROTOPRIVATE + 9)
> > +#define SIOCX25GDTEFACILITIES   (SIOCPROTOPRIVATE + 10)
> > +#define SIOCX25SDTEFACILITIES   (SIOCPROTOPRIVATE + 11)
> >  
> >  /*
> >   *	Values for {get,set}sockopt.
> > @@ -77,6 +79,8 @@ struct x25_subscrip_struct {
> >  #define	X25_MASK_PACKET_SIZE	0x04
> >  #define	X25_MASK_WINDOW_SIZE	0x08
> >  
> > +#define X25_MASK_CALLING_AE     0x10
> > +#define X25_MASK_CALLED_AE      0x20
> >  
> >  
> >  /*
> > @@ -98,6 +102,24 @@ struct x25_facilities {
> >  	unsigned int	reverse;
> >  };
> >  
> > +/* 
> > +*     ITU DTE facilities
> > +*     Only the called and calling address
> > +*     extension are currently implemented.
> > +*     The rest are in place to avoid the struct
> > +*     changing size if someone needs them later
> > ++ */
> > +struct x25_dte_facilities {
> > +	unsigned int    calling_len, called_len;
> > +	char            calling_ae[20];
> > +	char            called_ae[20];
> > +	unsigned char   min_throughput;
> > +	unsigned short  delay_cumul;
> > +	unsigned short  delay_target;
> > +	unsigned short  delay_max;
> > +	unsigned char   expedited;
> > +};
> > +
> >  /*
> >   *	Call User Data structure.
> >   */
> > diff -uprN -X dontdiff linux-2.6.13.4-vanilla/include/net/x25.h linux-2.6.13.4/include/net/x25.h
> > --- linux-2.6.13.4-vanilla/include/net/x25.h	2005-09-17 11:02:12.000000000 +1000
> > +++ linux-2.6.13.4/include/net/x25.h	2005-09-26 13:44:39.000000000 +1000
> > @@ -101,9 +101,19 @@ enum {
> >  #define	X25_FAC_PACKET_SIZE	0x42
> >  #define	X25_FAC_WINDOW_SIZE	0x43
> >  
> > -#define	X25_MAX_FAC_LEN		20		/* Plenty to spare */
> > +#define	X25_MAX_FAC_LEN		60
> 
> X25_MAX_FAC_LEN defined here and...
> 
> >  #define	X25_MAX_CUD_LEN		128
> >  
> > +#define X25_FAC_CALLING_AE      0xCB
> > +#define X25_FAC_CALLED_AE       0xC9
> > +
> > +#define X25_MAX_FAC_LEN         60
> 
> ...here
>                                                                                
> > +#define X25_MARKER              0x00
> > +#define X25_DTE_SERVICES        0x0F
> > +#define X25_MAX_AE_LEN          32
> > +
> > +
> >  /**
> >   *	struct x25_route - x25 routing entry
> >   *	@node - entry in x25_list_lock
> > @@ -148,6 +158,7 @@ struct x25_sock {
> >  	struct timer_list	timer;
> >  	struct x25_causediag	causediag;
> >  	struct x25_facilities	facilities;
> > +	struct x25_dte_facilities dte_facilities;
> >  	struct x25_calluserdata	calluserdata;
> >  	unsigned long 		vc_facil_mask;	/* inc_call facilities mask */
> >  };
> > @@ -180,9 +191,9 @@ extern void x25_establish_link(struct x2
> >  extern void x25_terminate_link(struct x25_neigh *);
> >  
> >  /* x25_facilities.c */
> > -extern int  x25_parse_facilities(struct sk_buff *, struct x25_facilities *, unsigned long *);
> > -extern int  x25_create_facilities(unsigned char *, struct x25_facilities *, unsigned long);
> > -extern int  x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *);
> > +extern int  x25_parse_facilities(struct sk_buff *, struct x25_facilities *, struct x25_dte_facilities *, unsigned long *);
> > +extern int  x25_create_facilities(unsigned char *, struct x25_facilities *, struct x25_dte_facilities *, unsigned long);
> > +extern int  x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *, struct x25_dte_facilities *);
> >  extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *);
> >  
> >  /* x25_in.c */
> > diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/af_x25.c linux-2.6.13.4/net/x25/af_x25.c
> > --- linux-2.6.13.4-vanilla/net/x25/af_x25.c	2005-09-17 11:02:12.000000000 +1000
> > +++ linux-2.6.13.4/net/x25/af_x25.c	2005-09-26 13:52:55.000000000 +1000
> > @@ -513,6 +513,11 @@ static int x25_create(struct socket *soc
> >  	x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE;
> >  	x25->facilities.throughput  = X25_DEFAULT_THROUGHPUT;
> >  	x25->facilities.reverse     = X25_DEFAULT_REVERSE;
> > +	x25->dte_facilities.calling_len	= 0;
> > +	x25->dte_facilities.called_len	= 0;
> > +	memset(x25->dte_facilities.called_ae,'\0',X25_MAX_AE_LEN);
> > +	memset(x25->dte_facilities.calling_ae,'\0',X25_MAX_AE_LEN);
> 
> spaces after commas please, and called_ae and calling_ae are 20 bytes,
> X25_MAX_AE_LEN is 32, I suggest you use
> sizeof(x25->dte_facilities.called_ae) instead of X25_MAX_AE_LEN
> 
> >  	rc = 0;
> >  out:
> >  	return rc;
> > @@ -554,6 +559,7 @@ static struct sock *x25_make_new(struct 
> >  	x25->t2         = ox25->t2;
> >  	x25->facilities = ox25->facilities;
> >  	x25->qbitincl   = ox25->qbitincl;
> > +	x25->dte_facilities = ox25->dte_facilities;
> >  	x25->cudmatchlength = ox25->cudmatchlength;
> >  	x25->accptapprv = ox25->accptapprv;
> >  
> > @@ -833,6 +839,7 @@ int x25_rx_call_request(struct sk_buff *
> >  	struct x25_sock *makex25;
> >  	struct x25_address source_addr, dest_addr;
> >  	struct x25_facilities facilities;
> > +	struct x25_dte_facilities dte_facilities;
> >  	int len, rc;
> >  
> >  	/*
> > @@ -869,7 +876,8 @@ int x25_rx_call_request(struct sk_buff *
> >  	/*
> >  	 *	Try to reach a compromise on the requested facilities.
> >  	 */
> > -	if ((len = x25_negotiate_facilities(skb, sk, &facilities)) == -1)
> > +	if ((len = x25_negotiate_facilities(skb, sk, &facilities, 
> > +		&dte_facilities)) == -1)
> >  		goto out_sock_put;
> >  
> >  	/*
> > @@ -900,9 +908,12 @@ int x25_rx_call_request(struct sk_buff *
> >  	makex25->source_addr   = source_addr;
> >  	makex25->neighbour     = nb;
> >  	makex25->facilities    = facilities;
> > +	makex25->dte_facilities= dte_facilities;
> >  	makex25->vc_facil_mask = x25_sk(sk)->vc_facil_mask;
> >  	/* ensure no reverse facil on accept */
> >  	makex25->vc_facil_mask &= ~X25_MASK_REVERSE;
> > +	/* ensure no calling address extension on accept */
> > +	makex25->vc_facil_mask &= ~X25_MASK_CALLING_AE;
> >  	makex25->cudmatchlength = x25_sk(sk)->cudmatchlength;
> >  
> >  	/* Normally all calls are accepted immediatly */
> > @@ -1309,6 +1320,35 @@ static int x25_ioctl(struct socket *sock
> >  			break;
> >  		}
> >  
> > +		case SIOCX25GDTEFACILITIES: {
> > +			struct x25_dte_facilities dtefacs = x25->dte_facilities;
> > +			rc = copy_to_user(argp, &dtefacs,
> > +					sizeof(dtefacs)) ? -EFAULT :0;
> 
> why not:
> 
> copy_to_user(argp, x25->dte_facilities, sizeof(*x25->dte_facilities))
> 
> avoiding the extra struct copy to the stack?
> 
> > +			break;
> > +		}
> > +		case SIOCX25SDTEFACILITIES: {
> > +			struct x25_dte_facilities dtefacs;
> > +			rc = -EFAULT;
> > +			if (copy_from_user(&dtefacs, argp, sizeof(dtefacs)))
> > +				break;
> > +			rc = -EINVAL;
> > +			if (sk->sk_state != TCP_LISTEN &&
> > +			    sk->sk_state != TCP_CLOSE)
> > +				break;
> > +			if (dtefacs.calling_len > X25_MAX_AE_LEN)
> > +				break;
> > +			if (dtefacs.calling_ae == NULL)
> > +				break;
> > +			if (dtefacs.called_len > X25_MAX_AE_LEN)
> > +				break;
> > +			if (dtefacs.called_ae == NULL)
> > +				break;
> > +			x25->dte_facilities = dtefacs;
> > +			rc = 0;
> > +			break;
> > +		}
> > +
> >  		case SIOCX25GCALLUSERDATA: {
> >  			struct x25_calluserdata cud = x25->calluserdata;
> >  			rc = copy_to_user(argp, &cud,
> > diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/x25_facilities.c linux-2.6.13.4/net/x25/x25_facilities.c
> > --- linux-2.6.13.4-vanilla/net/x25/x25_facilities.c	2005-09-17 11:02:12.000000000 +1000
> > +++ linux-2.6.13.4/net/x25/x25_facilities.c	2005-09-26 13:44:39.000000000 +1000
> > @@ -28,11 +28,12 @@
> >  #include <net/x25.h>
> >  
> >  /*
> > - *	Parse a set of facilities into the facilities structure. Unrecognised
> > + *	Parse a set of facilities into the facilities structures. Unrecognised
> >   *	facilities are written to the debug log file.
> >   */
> >  int x25_parse_facilities(struct sk_buff *skb,
> >  			 struct x25_facilities *facilities,
> > +			 struct x25_dte_facilities *dte_facs,
> >  			 unsigned long *vc_fac_mask)
> >  {
> >  	unsigned char *p = skb->data;
> > @@ -40,6 +41,16 @@ int x25_parse_facilities(struct sk_buff 
> >  
> >  	*vc_fac_mask = 0;
> >  
> > +	/* The kernel knows which facilities were set on an incoming call
> > +	 * but currently its not available to userspace.
> > +	 * Here we give userspace who read incoming call facilities
> > +	 * 0 length to indicate it wasn't set.
> > +	 */
> > +	dte_facs->calling_len = 0;
> > +	dte_facs->called_len = 0;
> > +	memset(dte_facs->called_ae,'\0',X25_MAX_AE_LEN);
> > +	memset(dte_facs->calling_ae,'\0',X25_MAX_AE_LEN);
> 
> Ditto, 20 versus 32
> 
> >  	while (len > 0) {
> >  		switch (*p & X25_FAC_CLASS_MASK) {
> >  		case X25_FAC_CLASS_A:
> > @@ -74,6 +85,8 @@ int x25_parse_facilities(struct sk_buff 
> >  				facilities->throughput = p[1];
> >  				*vc_fac_mask |= X25_MASK_THROUGHPUT;
> >  				break;
> > +			case X25_MARKER:
> > +				break;
> >  			default:
> >  				printk(KERN_DEBUG "X.25: unknown facility "
> >  				       "%02X, value %02X\n",
> > @@ -112,9 +125,28 @@ int x25_parse_facilities(struct sk_buff 
> >  			len -= 4;
> >  			break;
> >  		case X25_FAC_CLASS_D:
> > -			printk(KERN_DEBUG "X.25: unknown facility %02X, "
> > -			       "length %d, values %02X, %02X, %02X, %02X\n",
> > -			       p[0], p[1], p[2], p[3], p[4], p[5]);
> > +			switch (*p) {
> > +			case X25_FAC_CALLING_AE:
> > +				if (p[1] > 33)
> > +					break;
> > +				dte_facs->calling_len = p[2];
> > +				memcpy(dte_facs->calling_ae,&p[3],p[1]-1);
> > +				*vc_fac_mask |= X25_MASK_CALLING_AE;
> > +				break;
> > +			case X25_FAC_CALLED_AE:
> > +				if (p[1] > 33)
> > +					break;
> > +				dte_facs->called_len = p[2];
> > +				memcpy(dte_facs->called_ae,&p[3],p[1]-1);
> > +				*vc_fac_mask |= X25_MASK_CALLED_AE;
> > +				break;
> > +			default:	
> > +				printk(KERN_DEBUG "X.25: unknown facility %02X,"
> > +				"length %d, values %02X, %02X, %02X, %02X\n",
> > +				 p[0], p[1], p[2], p[3], p[4], p[5]);
> > +				break;
> > +			}
> > +
> >  			len -= p[1] + 2;
> >  			p   += p[1] + 2;
> >  			break;
> > @@ -129,6 +161,7 @@ int x25_parse_facilities(struct sk_buff 
> >   */
> >  int x25_create_facilities(unsigned char *buffer,
> >  			  struct x25_facilities *facilities,
> > +			  struct x25_dte_facilities *dte_facs,
> >  			  unsigned long facil_mask)
> >  {
> >  	unsigned char *p = buffer + 1;
> > @@ -168,6 +201,32 @@ int x25_create_facilities(unsigned char 
> >  		*p++ = facilities->winsize_out ? : facilities->winsize_in;
> >  	}
> >  
> > +	if ((facil_mask & X25_MASK_CALLING_AE) || 
> > +	     (facil_mask & X25_MASK_CALLED_AE)) {
> > +		*p++ = X25_MARKER;
> > +		*p++ = X25_DTE_SERVICES;
> > +	}
> > +
> > +	if (dte_facs->calling_len && (facil_mask & X25_MASK_CALLING_AE)) {
> > +		unsigned bytecount = (dte_facs->calling_len % 2) ?
> > +                        dte_facs->calling_len/2+1 : dte_facs->calling_len/2;
> 
> Spaces after operators such as '/' please
> 
> > +		*p++ = X25_FAC_CALLING_AE;
> > +		*p++ = 1 + bytecount;
> > +		*p++ = dte_facs->calling_len;
> > +		memcpy(p,dte_facs->calling_ae,bytecount);
> > +		p+=bytecount;
> > +	}
> 
> Ditto
> 
> > +	if (dte_facs->called_len && (facil_mask & X25_MASK_CALLED_AE)) {
> > +		unsigned bytecount = (dte_facs->called_len % 2) ?
> > +                        dte_facs->called_len/2+1 : dte_facs->called_len/2;
> > +		*p++ = X25_FAC_CALLED_AE;
> > +		*p++ = 1 + bytecount;
> > +		*p++ = dte_facs->called_len;
> > +		memcpy(p,dte_facs->called_ae,bytecount);
> > +		p+=bytecount;
> > +	}
> > +
> >  	len       = p - buffer;
> >  	buffer[0] = len - 1;
> >  
> > @@ -180,7 +239,8 @@ int x25_create_facilities(unsigned char 
> >   *	The only real problem is with reverse charging.
> >   */
> >  int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
> > -			     struct x25_facilities *new)
> > +			     struct x25_facilities *new,
> > +			     struct x25_dte_facilities *dte)
> >  {
> >  	struct x25_sock *x25 = x25_sk(sk);
> >  	struct x25_facilities *ours = &x25->facilities;
> > @@ -190,7 +250,7 @@ int x25_negotiate_facilities(struct sk_b
> >  	memset(&theirs, 0, sizeof(theirs));
> >  	memcpy(new, ours, sizeof(*new));
> >  
> > -	len = x25_parse_facilities(skb, &theirs, &x25->vc_facil_mask);
> > +	len = x25_parse_facilities(skb, &theirs, dte, &x25->vc_facil_mask);
> >  
> >  	/*
> >  	 *	They want reverse charging, we won't accept it.
> > diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/x25_in.c linux-2.6.13.4/net/x25/x25_in.c
> > --- linux-2.6.13.4-vanilla/net/x25/x25_in.c	2005-09-17 11:02:12.000000000 +1000
> > +++ linux-2.6.13.4/net/x25/x25_in.c	2005-09-26 13:44:39.000000000 +1000
> > @@ -106,6 +106,7 @@ static int x25_state1_machine(struct soc
> >  			skb_pull(skb, x25_addr_ntoa(skb->data, &source_addr, &dest_addr));
> >  			skb_pull(skb,
> >  				 x25_parse_facilities(skb, &x25->facilities,
> > +						      &x25->dte_facilities,
> >  						      &x25->vc_facil_mask));
> >  			/*
> >  			 *	Copy any Call User Data.
> > diff -uprN -X dontdiff linux-2.6.13.4-vanilla/net/x25/x25_subr.c linux-2.6.13.4/net/x25/x25_subr.c
> > --- linux-2.6.13.4-vanilla/net/x25/x25_subr.c	2005-09-17 11:02:12.000000000 +1000
> > +++ linux-2.6.13.4/net/x25/x25_subr.c	2005-09-26 13:44:39.000000000 +1000
> > @@ -191,6 +191,7 @@ void x25_write_internal(struct sock *sk,
> >  			memcpy(dptr, addresses, len);
> >  			len     = x25_create_facilities(facilities,
> >  							&x25->facilities,
> > +							&x25->dte_facilities,
> >  					     x25->neighbour->global_facil_mask);
> >  			dptr    = skb_put(skb, len);
> >  			memcpy(dptr, facilities, len);
> > @@ -206,6 +207,7 @@ void x25_write_internal(struct sock *sk,
> >  			*dptr++ = 0x00;		/* Address lengths */
> >  			len     = x25_create_facilities(facilities,
> >  							&x25->facilities,
> > +							&x25->dte_facilities,
> >  							x25->vc_facil_mask);
> >  			dptr    = skb_put(skb, len);
> >  			memcpy(dptr, facilities, len);


^ permalink raw reply

* Re: [PATCH] X25: Add ITU-T facilites
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-10-18  6:23 UTC (permalink / raw)
  To: ahendry; +Cc: acme, eis, linux-x25, linux-kernel, netdev, yoshfuji
In-Reply-To: <1129615767.3695.15.camel@localhost.localdomain>

In article <1129615767.3695.15.camel@localhost.localdomain> (at Tue, 18 Oct 2005 16:09:27 +1000), Andrew Hendry <ahendry@tusc.com.au> says:

> +/* 
> +*     ITU DTE facilities
> +*     Only the called and calling address
> +*     extension are currently implemented.
> +*     The rest are in place to avoid the struct
> +*     changing size if someone needs them later
> ++ */
> +struct x25_dte_facilities {
> +	unsigned int    calling_len, called_len;
> +	char            calling_ae[20];
> +	char            called_ae[20];
> +	unsigned char   min_throughput;
> +	unsigned short  delay_cumul;
> +	unsigned short  delay_target;
> +	unsigned short  delay_max;
> +	unsigned char   expedited;
> +};

Why don't you use fixed size members?
And we can eliminate 8bit hole.

struct x25_dte_facilities {
     u32             calling_len
     u32             called_len;
     u8              calling_ae[20];
     u8              called_ae[20];
     u8              min_throughput;
     u8              expedited;
     u16             delay_cumul;
     u16             delay_target;
     u16             delay_max;
};

--yoshfuji

^ permalink raw reply

* Re: [PATCH] ebtables: Port ebt_[u]log.c to nf[netlink]_log
From: Harald Welte @ 2005-10-18  8:58 UTC (permalink / raw)
  To: Bart De Schuymer
  Cc: Linux Netdev List,
	ebtables-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <1129571999.3383.6.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2815 bytes --]

On Mon, Oct 17, 2005 at 05:59:59PM +0000, Bart De Schuymer wrote:
> 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.

no problem, I probably hold the record of delayed responses, so I can
understand that completely ;)

> Apart from the comments below, the patch is fine by me (I tested both).

great.

> > +	nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, info->prefix);
> 
> Should be ebt_log_packet

why is that?  nf_log_packet() is a function provided by the netfilter
core in net/netfilter/.  Do you want an ebt_log_packet() wrapper function that just calls
nf_log_packet() ?

> >  {
> > -	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.

No, I think we only fix the comment (state PF_BRIDGE in the comment) but
leave it like it is.

The issues is, when (in chronological order)

1) someone starts their logging daemon (e.g. ulogd2)
2) the daemon is configured to nf_log_register() for PF_BRIDGE
3) then the ruleset is loaded, which automatically modprobe's ebt_log.ko
4) ebt_log wants to nf_log_register() for PF_BRIDGE

I think we should print some message to syslog to tell the use (once)
that logging will not be done via the system console, even though he
uses the "log" watcher (which traditionally always logged via syslog).

Comments?

-- 
- Harald Welte <laforge-Cap9r6Oaw4JrovVCs/uTlw@public.gmane.org>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: Re: [PATCH] ebtables: Port ebt_[u]log.c to nf[netlink]_log
From: Bart De Schuymer @ 2005-10-18 15:12 UTC (permalink / raw)
  To: Harald Welte
  Cc: Linux Netdev List,
	ebtables-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <20051018085853.GG20338-XKR8MNpNCaUy1wpV0ib6OjPN8QKu1tr+@public.gmane.org>

Op di, 18-10-2005 te 10:58 +0200, schreef Harald Welte:
> On Mon, Oct 17, 2005 at 05:59:59PM +0000, Bart De Schuymer wrote:
> > 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.
> 
> no problem, I probably hold the record of delayed responses, so I can
> understand that completely ;)
> 
> > Apart from the comments below, the patch is fine by me (I tested both).
> 
> great.
> 
> > > +	nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, info->prefix);
> > 
> > Should be ebt_log_packet
> 
> why is that?  nf_log_packet() is a function provided by the netfilter
> core in net/netfilter/.  Do you want an ebt_log_packet() wrapper function that just calls
> nf_log_packet() ?

I see it works with nf_log_packet() too. I just tried to mimic what
you're doing for ebt_ulog... Anyway, I'll accept your judgement on this.

> > >  {
> > > -	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.
> 
> No, I think we only fix the comment (state PF_BRIDGE in the comment) but
> leave it like it is.

OK, but please fix the typo then. Shouldn't a similar comment be in
ebt_ulog?

cheers,
Bart




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

^ permalink raw reply

* [BUG]NULL pointer dereference in ipv6_get_saddr()
From: Yan Zheng @ 2005-10-18 15:21 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

When I use command "ip -f inet6 route get fec0::1", kernel Oops occurs.
I found it's due to ip_route_output return address of ip6_null_entry, ip6_null_entry.rt6i_idev is NULL.


====================================================================================================
Unable to handle kernel NULL pointer dereference at virtual address 00000000
 printing eip:
e0fc7991
*pde = 1759f067
Oops: 0000 [#1]
Modules linked in: vmnet(U) parport_pc parport vmmon(U) iptable_nat ppp_synctty ppp_async crc_ccitt ppp_generic slhc fglrx(U) kqemu(U) autofs4 ip_conntrack_ftp ipt_REJECT ipt_state ip_conntrack iptable_filter ip_tables reiserfs dm_mod video button battery ac ipv6 uhci_hcd ehci_hcd i2c_viapro i2c_core snd_via82xx gameport snd_ac97_codec snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_mpu401_uart snd_rawmidi snd_seq_device snd soundcore via_rhine mii ext3 jbd
CPU:    0
EIP:    0060:[<e0fc7991>]    Tainted: P      VLI
EFLAGS: 00010282   (2.6.13-1.1526_FC4) 
EIP is at ipv6_get_saddr+0xd/0x17 [ipv6]
eax: 00000000   ebx: 00000000   ecx: d5786c2c   edx: d5786c80
esi: c38d1ee0   edi: e1005b20   ebp: d187f088   esp: d5786bec
ds: 007b   es: 007b   ss: 0068
Process ip (pid: 11718, threadinfo=d5786000 task=c23a9000)
Stack: badc0ded d5786c2c e0fd22a1 d5786c80 00000000 00000286 d5786c80 d5786c80 
       00000232 d5786c78 d5786c78 e0fd04cb df7458d0 00000000 dfffb920 dfffb920 
       00000030 d5786c90 d5786c78 d5786c80 00000003 00002dc6 ce7e2638 c7b5f400 
Call Trace:
 [<e0fd22a1>] rt6_fill_node+0x428/0x4d5 [ipv6]
 [<e0fd04cb>] ip6_route_output+0xf1/0x2d4 [ipv6]
 [<e0fd2675>] inet6_rtm_getroute+0x125/0x193 [ipv6]
 [<e0fd2550>] inet6_rtm_getroute+0x0/0x193 [ipv6]
 [<c038fe53>] rtnetlink_rcv+0x21b/0x3a4
 [<c03a26b7>] netlink_data_ready+0x12/0x54
 [<c03a1c05>] netlink_sendskb+0x19/0x34
 [<c03a23cc>] netlink_sendmsg+0x26d/0x318
 [<c03781e4>] sock_sendmsg+0xe4/0xff
 [<c01519c2>] autoremove_wake_function+0x0/0x37
 [<c018ca56>] anon_vma_prepare+0x466/0x4ff
 [<c01519c2>] autoremove_wake_function+0x0/0x37
 [<c025e0c4>] copy_from_user+0x4c/0x88
 [<c03799dc>] sys_sendmsg+0x11e/0x213
 [<c0165659>] audit_sockaddr+0x39/0x78
 [<c0185f55>] __handle_mm_fault+0x303/0x4b0
 [<c011e401>] do_page_fault+0x260/0x5cd
 [<c01876f9>] vma_link+0x10d/0x53f
 [<c0379f18>] sys_socketcall+0x270/0x292
 [<c0109b52>] do_syscall_trace+0xef/0x123
 [<c0104465>] syscall_call+0x7/0xb
Code: f3 e8 ff ff e9 8e fe ff ff c7 44 24 04 00 00 00 00 c7 44 24 08 ff ff ff ff e9 94 fe ff ff 53 31 db 85 c0 74 08 8b 80 88 00 00 00 <8b> 18 89 d8 5b e9 a1 fd ff ff 57 56 8b 88 f0 00 00 00 be 9d ff 
 

^ permalink raw reply

* Re: [BUG]NULL pointer dereference in ipv6_get_saddr()
From: linux-os (Dick Johnson) @ 2005-10-18 15:30 UTC (permalink / raw)
  To: Yan Zheng; +Cc: netdev, linux-kernel
In-Reply-To: <435512F5.1040502@21cn.com>


On Tue, 18 Oct 2005, Yan Zheng wrote:

> When I use command "ip -f inet6 route get fec0::1", kernel Oops occurs.
> I found it's due to ip_route_output return address of ip6_null_entry, ip6_null_entry.rt6i_idev is NULL.
>
>
> ====================================================================================================
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> printing eip:
> e0fc7991
> *pde = 1759f067
> Oops: 0000 [#1]
> Modules linked in: vmnet(U) parport_pc parport vmmon(U) iptable_nat ppp_synctty ppp_async crc_ccitt ppp_generic slhc fglrx(U) kqemu(U) autofs4 ip_conntrack_ftp ipt_REJECT ipt_state ip_conntrack iptable_filter ip_tables reiserfs dm_mod video button battery ac ipv6 uhci_hcd ehci_hcd i2c_viapro i2c_core snd_via82xx gameport snd_ac97_codec snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_mpu401_uart snd_rawmidi snd_seq_device snd soundcore via_rhine mii ext3 jbd
> CPU:    0
> EIP:    0060:[<e0fc7991>]    Tainted: P      VLI
> EFLAGS: 00010282   (2.6.13-1.1526_FC4)
> EIP is at ipv6_get_saddr+0xd/0x17 [ipv6]
> eax: 00000000   ebx: 00000000   ecx: d5786c2c   edx: d5786c80
> esi: c38d1ee0   edi: e1005b20   ebp: d187f088   esp: d5786bec
> ds: 007b   es: 007b   ss: 0068
> Process ip (pid: 11718, threadinfo=d5786000 task=c23a9000)
> Stack: badc0ded d5786c2c e0fd22a1 d5786c80 00000000 00000286 d5786c80 d5786c80
>       00000232 d5786c78 d5786c78 e0fd04cb df7458d0 00000000 dfffb920 dfffb920
>       00000030 d5786c90 d5786c78 d5786c80 00000003 00002dc6 ce7e2638 c7b5f400
> Call Trace:
> [<e0fd22a1>] rt6_fill_node+0x428/0x4d5 [ipv6]
> [<e0fd04cb>] ip6_route_output+0xf1/0x2d4 [ipv6]
> [<e0fd2675>] inet6_rtm_getroute+0x125/0x193 [ipv6]
> [<e0fd2550>] inet6_rtm_getroute+0x0/0x193 [ipv6]
> [<c038fe53>] rtnetlink_rcv+0x21b/0x3a4
> [<c03a26b7>] netlink_data_ready+0x12/0x54
> [<c03a1c05>] netlink_sendskb+0x19/0x34
> [<c03a23cc>] netlink_sendmsg+0x26d/0x318
> [<c03781e4>] sock_sendmsg+0xe4/0xff
> [<c01519c2>] autoremove_wake_function+0x0/0x37
> [<c018ca56>] anon_vma_prepare+0x466/0x4ff
> [<c01519c2>] autoremove_wake_function+0x0/0x37
> [<c025e0c4>] copy_from_user+0x4c/0x88
> [<c03799dc>] sys_sendmsg+0x11e/0x213
> [<c0165659>] audit_sockaddr+0x39/0x78
> [<c0185f55>] __handle_mm_fault+0x303/0x4b0
> [<c011e401>] do_page_fault+0x260/0x5cd
> [<c01876f9>] vma_link+0x10d/0x53f
> [<c0379f18>] sys_socketcall+0x270/0x292
> [<c0109b52>] do_syscall_trace+0xef/0x123
> [<c0104465>] syscall_call+0x7/0xb
> Code: f3 e8 ff ff e9 8e fe ff ff c7 44 24 04 00 00 00 00 c7 44 24 08 ff ff ff ff e9 94 fe ff ff 53 31 db 85 c0 74 08 8b 80 88 00 00 00 <8b> 18 89 d8 5b e9 a1 fd ff ff 57 56 8b 88 f0 00 00 00 be 9d ff
>

Same with linux-2.6.14.4

Unable to handle kernel NULL pointer dereference at virtual address 00000000
  printing eip:
f0928630
*pde = 00000000
Oops: 0000 [#1]
PREEMPT SMP

Modules linked in: nls_iso8859_1 vfat floppy snd_pcm_oss snd_mixer_oss snd_intel8x0 snd_ac97_codec snd_pcm snd_timer snd snd_page_alloc soundcore parport_pc lp parport nfsd exportfs lockd sunrpc e100 mii ipt_REJECT ipt_state ip_conntrack iptable_filter ip_tables microcode nls_cp437 msdos fat dm_mod uhci_hcd ehci_hcd video container button battery ac rtc ipv6 ext3 jbd ata_piix libata aic7xxx scsi_transport_spi sd_mod scsi_mod
CPU:    0
EIP:    0060:[<f0928630>]    Not tainted VLI
EFLAGS: 00010286   (2.6.13.4)

EIP is at ipv6_get_saddr+0x10/0x20 [ipv6]
eax: 00000000   ebx: dab29bbc   ecx: 00000000   edx: f095b760
esi: d8e69b80   edi: e3b49078   ebp: f095b760   esp: dab29ba0
ds: 007b   es: 007b   ss: 0068
Process ip (pid: 27746, threadinfo=dab28000 task=ee2f2020)
Stack: f093115b f095b760 dab29c34 dab29bbc dab29c34 dab29bb8 00000282 dab29c34
        d8e69b80 00000000 d8e69b80 f092efc4 f095b838 dab29c34 dab29c44 00000014
        dab29c44 dab29c34 00000003 d8e69b80 ffffffa6 00000000 dab29c2c f0931635

Call Trace:
  [<f093115b>] rt6_fill_node+0x43b/0x560 [ipv6]
  [<f092efc4>] ip6_route_output+0x114/0x360 [ipv6]
  [<f0931635>] inet6_rtm_getroute+0x135/0x1c0 [ipv6]
  [<c02e83a7>] rtnetlink_rcv+0x307/0x3d0
  [<c02f587b>] netlink_data_ready+0x6b/0x70
  [<c02f4c12>] netlink_sendskb+0x32/0x60
  [<c02f54ba>] netlink_sendmsg+0x20a/0x340
  [<c02f579c>] netlink_recvmsg+0x1ac/0x220
  [<c02d3a05>] sock_sendmsg+0x115/0x120
  [<c018477c>] update_atime+0x9c/0xd0
  [<c02d3a05>] sock_sendmsg+0x115/0x120
  [<c01e25ac>] copy_from_user+0x6c/0xb0
  [<c0135f10>] autoremove_wake_function+0x0/0x60
  [<c02d578f>] sys_sendmsg+0x18f/0x1f0
  [<c02d3408>] move_addr_to_kernel+0x48/0x70
  [<c0157ccd>] __handle_mm_fault+0x11d/0x1a0
  [<c015ad3e>] do_brk+0x22e/0x2e0
  [<c01e25ac>] copy_from_user+0x6c/0xb0
  [<c02d5c52>] sys_socketcall+0x262/0x280
  [<c010314b>] sysenter_past_esp+0x54/0x75
Code: c5 fe ff ff 89 14 24 e8 3f f3 ff ff eb ce 8d b6 00 00 00 00 8d bc 27 00 00 00 00 8b 54 24 04 31 c0 85 d2 74 08 8b 82 88 00 00 00 <8b> 00 89 44 24 04 e9 75 fd ff ff 90 8d 74 26 00 55 b8 34 af 95



Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.46 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

^ permalink raw reply

* Re: [PATCH] X25: Add ITU-T facilites
From: Arnaldo Carvalho de Melo @ 2005-10-18 15:37 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / ?$B5HF#1QL@
  Cc: ahendry, eis, linux-x25, linux-kernel, netdev
In-Reply-To: <20051018.152318.68554424.yoshfuji@linux-ipv6.org>

Em Tue, Oct 18, 2005 at 03:23:18PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu:
> In article <1129615767.3695.15.camel@localhost.localdomain> (at Tue, 18 Oct 2005 16:09:27 +1000), Andrew Hendry <ahendry@tusc.com.au> says:
> 
> > +/* 
> > +*     ITU DTE facilities
> > +*     Only the called and calling address
> > +*     extension are currently implemented.
> > +*     The rest are in place to avoid the struct
> > +*     changing size if someone needs them later
> > ++ */
> > +struct x25_dte_facilities {
> > +	unsigned int    calling_len, called_len;
> > +	char            calling_ae[20];
> > +	char            called_ae[20];
> > +	unsigned char   min_throughput;
> > +	unsigned short  delay_cumul;
> > +	unsigned short  delay_target;
> > +	unsigned short  delay_max;
> > +	unsigned char   expedited;
> > +};
> 
> Why don't you use fixed size members?
> And we can eliminate 8bit hole.
> 
> struct x25_dte_facilities {
>      u32             calling_len
>      u32             called_len;

I guess the two above can be 'u8' as they refer to calling_ae and called_ae
that at most will be '20'?

>      u8              calling_ae[20];
>      u8              called_ae[20];

- Arnaldo

^ permalink raw reply

* Re: [PATCH] X25: Add ITU-T facilites
From: linux-os (Dick Johnson) @ 2005-10-18 15:48 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: YOSHIFUJI Hideaki / ?$B5HF#1QL@, ahendry, eis, linux-x25,
	linux-kernel, netdev
In-Reply-To: <20051018153702.GC23167@mandriva.com>


On Tue, 18 Oct 2005, Arnaldo Carvalho de Melo wrote:

> Em Tue, Oct 18, 2005 at 03:23:18PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ escreveu:
>> In article <1129615767.3695.15.camel@localhost.localdomain> (at Tue, 18 Oct 2005 16:09:27 +1000), Andrew Hendry <ahendry@tusc.com.au> says:
>>
>>> +/*
>>> +*     ITU DTE facilities
>>> +*     Only the called and calling address
>>> +*     extension are currently implemented.
>>> +*     The rest are in place to avoid the struct
>>> +*     changing size if someone needs them later
>>> ++ */
>>> +struct x25_dte_facilities {
>>> +	unsigned int    calling_len, called_len;
>>> +	char            calling_ae[20];
>>> +	char            called_ae[20];
>>> +	unsigned char   min_throughput;
>>> +	unsigned short  delay_cumul;
>>> +	unsigned short  delay_target;
>>> +	unsigned short  delay_max;
>>> +	unsigned char   expedited;
>>> +};
>>
>> Why don't you use fixed size members?
>> And we can eliminate 8bit hole.
>>
>> struct x25_dte_facilities {
>>      u32             calling_len
>>      u32             called_len;
>
> I guess the two above can be 'u8' as they refer to calling_ae and called_ae
> that at most will be '20'?
>
>>      u8              calling_ae[20];
>>      u8              called_ae[20];
>
> - Arnaldo

At the very least put the 32-bit in the beginning and 8-bit stuff at
the end so natural alignment occurs where possible.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.46 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

^ permalink raw reply

* Re: [BUG]NULL pointer dereference in ipv6_get_saddr()
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-10-18 16:21 UTC (permalink / raw)
  To: yanzheng; +Cc: netdev, linux-kernel, yoshfuji
In-Reply-To: <435512F5.1040502@21cn.com>

In article <435512F5.1040502@21cn.com> (at Tue, 18 Oct 2005 23:21:25 +0800), Yan Zheng <yanzheng@21cn.com> says:

> When I use command "ip -f inet6 route get fec0::1", kernel Oops occurs.
> I found it's due to ip_route_output return address of ip6_null_entry, ip6_null_entry.rt6i_idev is NULL.

I think this is already fixed in head.
I don't remember if we pushed this to stable...

--yoshfuji

^ permalink raw reply

* [PATCH] ipconfig.c: fix "dhcp server takes precedence over bootp header one"
From: Maxime Bizon @ 2005-10-18 17:05 UTC (permalink / raw)
  To: davem; +Cc: netdev


Hello,

I was unable to use nfs root with a dhcp server that does not fill the
"saddr" field in the bootp header (kernel then tries RPC on 0.0.0.0).

The ipconfig code states that the dhcp server_id takes precedence over
bootp header, but I think the check is misplaced as it is done only for
DHCPOFFER.

The following patch fixes the problem.


Signed-off-by: Maxime Bizon <mbizon@freebox.fr>

--- linux-2.6.13.4/net/ipv4/ipconfig.c.orig	2005-10-18 18:11:54.000000000 +0200
+++ linux-2.6.13.4/net/ipv4/ipconfig.c	2005-10-18 18:22:18.000000000 +0200
@@ -959,13 +959,6 @@
 				printk(" by server %u.%u.%u.%u\n",
 				       NIPQUAD(ic_servaddr));
 #endif
-				/* The DHCP indicated server address takes
-				 * precedence over the bootp header one if
-				 * they are different.
-				 */
-				if ((server_id != INADDR_NONE) &&
-				    (b->server_ip != server_id))
-					b->server_ip = ic_servaddr;
 				break;
 
 			case DHCPACK:
@@ -982,6 +975,14 @@
 				goto drop_unlock;
 			};
 
+			/* The DHCP indicated server address takes
+			 * precedence over the bootp header one if
+			 * they are different.
+			 */
+			if ((server_id != INADDR_NONE) &&
+			    (b->server_ip != server_id))
+				b->server_ip = ic_servaddr;
+
 			ic_dhcp_msgtype = mt;
 
 		}

-- 
Maxime

^ permalink raw reply

* [PATCH] AX.25: Use constant instead of magic number.
From: Ralf Baechle @ 2005-10-18 20:39 UTC (permalink / raw)
  To: David S. Miller
  Cc: Arnaldo Carvalho de Melo, dann frazier, chrisw, netdev,
	linux-hams

Signed-off-by: Ralf Baechle DL5RB <ralf@linux-mips.org>

 net/rose/rose_route.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: net-git/net/rose/rose_route.c
===================================================================
--- net-git.orig/net/rose/rose_route.c
+++ net-git/net/rose/rose_route.c
@@ -727,7 +727,7 @@ int rose_rt_ioctl(unsigned int cmd, void
 		}
 		if (rose_route.mask > 10) /* Mask can't be more than 10 digits */
 			return -EINVAL;
-		if (rose_route.ndigis > 8) /* No more than 8 digipeats */
+		if (rose_route.ndigis > AX25_MAX_DIGIS)
 			return -EINVAL;
 		err = rose_add_node(&rose_route, dev);
 		dev_put(dev);

^ permalink raw reply

* [patch 2.6.14-rc4] orinoco: remove redundance skb length check before padding
From: John W. Linville @ 2005-10-19  1:30 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, proski, hermes, orinoco-devel

Checking the skb->len value before calling skb_padto is redundant.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/wireless/orinoco.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -505,11 +505,9 @@ static int orinoco_xmit(struct sk_buff *
 
 	/* Check packet length, pad short packets, round up odd length */
 	len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN);
-	if (skb->len < len) {
-		skb = skb_padto(skb, len);
-		if (skb == NULL)
-			goto fail;
-	}
+	skb = skb_padto(skb, len);
+	if (skb == NULL)
+		goto fail;
 	len -= ETH_HLEN;
 
 	eh = (struct ethhdr *)skb->data;

^ permalink raw reply

* [patch 2.6.14-rc4] bonding: cleanup comment for mode 1 IGMP xmit hack
From: John W. Linville @ 2005-10-19  1:30 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, ctindel, fubar, bonding-devel

Expand comment explaining MAC address selection for replicated IGMP
frames transmitted in bonding mode 1 (active-backup).  Also, a small
whitespace cleanup.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/bonding/bond_main.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4242,8 +4242,8 @@ out:
 }
 
 static void bond_activebackup_xmit_copy(struct sk_buff *skb,
-                                         struct bonding *bond,
-                                         struct slave *slave)
+                                        struct bonding *bond,
+                                        struct slave *slave)
 {
 	struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC);
 	struct ethhdr *eth_data;
@@ -4259,7 +4259,11 @@ static void bond_activebackup_xmit_copy(
 	skb2->mac.raw = (unsigned char *)skb2->data;
 	eth_data = eth_hdr(skb2);
 
-	/* Pick an appropriate source MAC address */
+	/* Pick an appropriate source MAC address
+	 *	-- use slave's perm MAC addr, unless used by bond
+	 *	-- otherwise, borrow active slave's perm MAC addr
+	 *	   since that will not be used
+	 */
 	hwaddr = slave->perm_hwaddr;
 	if (!memcmp(eth_data->h_source, hwaddr, ETH_ALEN))
 		hwaddr = bond->curr_active_slave->perm_hwaddr;

^ permalink raw reply

* [patch 2.6.14-rc4 0/3] sk98lin: neuter and prepare for removal
From: John W. Linville @ 2005-10-19  1:30 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, shemminger, mlindner, rroesler

These patches take steps towards removing sk98lin from the upstream
kernel.

	-- Remove sk98lin's MODULE_DEVICE_TABLE to avoid
	confusing userland tools about which driver to load;

	-- Mark sk98lin as Obsolete in the MAINTAINERS file; and,

	-- Add sk98lin to the feature-removal-schedule.txt file in the
	Documentation directory.

I accept the possibility that I may be jumping the gun on this.
However, I think it is worth opening this discussion.

Patches to follow...

^ permalink raw reply

* [patch 2.6.14-rc4] b44: alternate allocation option for DMA descriptors
From: John W. Linville @ 2005-10-19  1:30 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, pp

This is a (final?) hack to support the odd DMA allocation requirements
of the b44 hardware.  The b44 hardware has a 30-bit DMA mask.  On x86,
anything less than a 32-bit DMA mask forces allocations into the 16MB
GFP_DMA range.  The memory there is somewhat limited, often resulting
in an inability to initialize the b44 driver.

This hack uses streaming DMA allocation APIs in order to provide an
alternative in case the GFP_DMA allocation fails.  It is somewhat ugly,
but not much worse than the similar existing hacks to support SKB
allocations in the same driver.  FWIW, I have received positive
feedback on this from several Fedora users.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/b44.c |  134 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 drivers/net/b44.h |    2 
 2 files changed, 128 insertions(+), 8 deletions(-)

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -106,6 +106,29 @@ static int b44_poll(struct net_device *d
 static void b44_poll_controller(struct net_device *dev);
 #endif
 
+static int dma_desc_align_mask;
+static int dma_desc_sync_size;
+
+static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev,
+                                                dma_addr_t dma_base,
+                                                unsigned long offset,
+                                                enum dma_data_direction dir)
+{
+	dma_sync_single_range_for_device(&pdev->dev, dma_base,
+	                                 offset & dma_desc_align_mask,
+	                                 dma_desc_sync_size, dir);
+}
+
+static inline void b44_sync_dma_desc_for_cpu(struct pci_dev *pdev,
+                                             dma_addr_t dma_base,
+                                             unsigned long offset,
+                                             enum dma_data_direction dir)
+{
+	dma_sync_single_range_for_cpu(&pdev->dev, dma_base,
+	                              offset & dma_desc_align_mask,
+	                              dma_desc_sync_size, dir);
+}
+
 static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
 {
 	return readl(bp->regs + reg);
@@ -668,6 +691,11 @@ static int b44_alloc_rx_skb(struct b44 *
 	dp->ctrl = cpu_to_le32(ctrl);
 	dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset);
 
+	if (bp->flags & B44_FLAG_RX_RING_HACK)
+		b44_sync_dma_desc_for_device(bp->pdev, bp->rx_ring_dma,
+		                             dest_idx * sizeof(dp),
+		                             DMA_BIDIRECTIONAL);
+
 	return RX_PKT_BUF_SZ;
 }
 
@@ -692,6 +720,11 @@ static void b44_recycle_rx(struct b44 *b
 	pci_unmap_addr_set(dest_map, mapping,
 			   pci_unmap_addr(src_map, mapping));
 
+	if (bp->flags & B44_FLAG_RX_RING_HACK)
+		b44_sync_dma_desc_for_cpu(bp->pdev, bp->rx_ring_dma,
+		                          src_idx * sizeof(src_desc),
+		                          DMA_BIDIRECTIONAL);
+
 	ctrl = src_desc->ctrl;
 	if (dest_idx == (B44_RX_RING_SIZE - 1))
 		ctrl |= cpu_to_le32(DESC_CTRL_EOT);
@@ -700,8 +733,14 @@ static void b44_recycle_rx(struct b44 *b
 
 	dest_desc->ctrl = ctrl;
 	dest_desc->addr = src_desc->addr;
+
 	src_map->skb = NULL;
 
+	if (bp->flags & B44_FLAG_RX_RING_HACK)
+		b44_sync_dma_desc_for_device(bp->pdev, bp->rx_ring_dma,
+		                             dest_idx * sizeof(dest_desc),
+		                             DMA_BIDIRECTIONAL);
+
 	pci_dma_sync_single_for_device(bp->pdev, src_desc->addr,
 				       RX_PKT_BUF_SZ,
 				       PCI_DMA_FROMDEVICE);
@@ -959,6 +998,11 @@ static int b44_start_xmit(struct sk_buff
 	bp->tx_ring[entry].ctrl = cpu_to_le32(ctrl);
 	bp->tx_ring[entry].addr = cpu_to_le32((u32) mapping+bp->dma_offset);
 
+	if (bp->flags & B44_FLAG_TX_RING_HACK)
+		b44_sync_dma_desc_for_device(bp->pdev, bp->tx_ring_dma,
+		                             entry * sizeof(bp->tx_ring[0]),
+		                             DMA_TO_DEVICE);
+
 	entry = NEXT_TX(entry);
 
 	bp->tx_prod = entry;
@@ -1064,6 +1108,16 @@ static void b44_init_rings(struct b44 *b
 	memset(bp->rx_ring, 0, B44_RX_RING_BYTES);
 	memset(bp->tx_ring, 0, B44_TX_RING_BYTES);
 
+	if (bp->flags & B44_FLAG_RX_RING_HACK)
+		dma_sync_single_for_device(&bp->pdev->dev, bp->rx_ring_dma,
+		                           DMA_TABLE_BYTES,
+		                           PCI_DMA_BIDIRECTIONAL);
+
+	if (bp->flags & B44_FLAG_TX_RING_HACK)
+		dma_sync_single_for_device(&bp->pdev->dev, bp->tx_ring_dma,
+		                           DMA_TABLE_BYTES,
+		                           PCI_DMA_TODEVICE);
+
 	for (i = 0; i < bp->rx_pending; i++) {
 		if (b44_alloc_rx_skb(bp, -1, i) < 0)
 			break;
@@ -1085,14 +1139,28 @@ static void b44_free_consistent(struct b
 		bp->tx_buffers = NULL;
 	}
 	if (bp->rx_ring) {
-		pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
-				    bp->rx_ring, bp->rx_ring_dma);
+		if (bp->flags & B44_FLAG_RX_RING_HACK) {
+			dma_unmap_single(&bp->pdev->dev, bp->rx_ring_dma,
+				         DMA_TABLE_BYTES,
+				         DMA_BIDIRECTIONAL);
+			kfree(bp->rx_ring);
+		} else
+			pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
+					    bp->rx_ring, bp->rx_ring_dma);
 		bp->rx_ring = NULL;
+		bp->flags &= ~B44_FLAG_RX_RING_HACK;
 	}
 	if (bp->tx_ring) {
-		pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
-				    bp->tx_ring, bp->tx_ring_dma);
+		if (bp->flags & B44_FLAG_TX_RING_HACK) {
+			dma_unmap_single(&bp->pdev->dev, bp->tx_ring_dma,
+				         DMA_TABLE_BYTES,
+				         DMA_TO_DEVICE);
+			kfree(bp->tx_ring);
+		} else
+			pci_free_consistent(bp->pdev, DMA_TABLE_BYTES,
+					    bp->tx_ring, bp->tx_ring_dma);
 		bp->tx_ring = NULL;
+		bp->flags &= ~B44_FLAG_TX_RING_HACK;
 	}
 }
 
@@ -1118,12 +1186,56 @@ static int b44_alloc_consistent(struct b
 
 	size = DMA_TABLE_BYTES;
 	bp->rx_ring = pci_alloc_consistent(bp->pdev, size, &bp->rx_ring_dma);
-	if (!bp->rx_ring)
-		goto out_err;
+	if (!bp->rx_ring) {
+		/* Allocation may have failed due to pci_alloc_consistent
+		   insisting on use of GFP_DMA, which is more restrictive
+		   than necessary...  */
+		struct dma_desc *rx_ring;
+		dma_addr_t rx_ring_dma;
+
+		if (!(rx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL)))
+			goto out_err;
+
+		memset(rx_ring, 0, size);
+		rx_ring_dma = dma_map_single(&bp->pdev->dev, rx_ring,
+		                             DMA_TABLE_BYTES,
+		                             DMA_BIDIRECTIONAL);
+
+		if (rx_ring_dma + size > B44_DMA_MASK) {
+			kfree(rx_ring);
+			goto out_err;
+		}
+
+		bp->rx_ring = rx_ring;
+		bp->rx_ring_dma = rx_ring_dma;
+		bp->flags |= B44_FLAG_RX_RING_HACK;
+	}
 
 	bp->tx_ring = pci_alloc_consistent(bp->pdev, size, &bp->tx_ring_dma);
-	if (!bp->tx_ring)
-		goto out_err;
+	if (!bp->tx_ring) {
+		/* Allocation may have failed due to pci_alloc_consistent
+		   insisting on use of GFP_DMA, which is more restrictive
+		   than necessary...  */
+		struct dma_desc *tx_ring;
+		dma_addr_t tx_ring_dma;
+
+		if (!(tx_ring = (struct dma_desc *)kmalloc(size, GFP_KERNEL)))
+			goto out_err;
+
+		memset(tx_ring, 0, size);
+		tx_ring_dma = dma_map_single(&bp->pdev->dev, tx_ring,
+		                             DMA_TABLE_BYTES,
+		                             DMA_TO_DEVICE);
+
+		if (tx_ring_dma + size > B44_DMA_MASK) {
+			kfree(tx_ring);
+			goto out_err;
+		}
+
+		bp->tx_ring = tx_ring;
+		bp->tx_ring_dma = tx_ring_dma;
+		bp->flags |= B44_FLAG_TX_RING_HACK;
+	}
 
 	return 0;
 
@@ -1971,6 +2083,12 @@ static struct pci_driver b44_driver = {
 
 static int __init b44_init(void)
 {
+	unsigned int dma_desc_align_size = dma_get_cache_alignment();
+
+	/* Setup paramaters for syncing RX/TX DMA descriptors */
+	dma_desc_align_mask = ~(dma_desc_align_size - 1);
+	dma_desc_sync_size = max(dma_desc_align_size, sizeof(struct dma_desc));
+
 	return pci_module_init(&b44_driver);
 }
 
diff --git a/drivers/net/b44.h b/drivers/net/b44.h
--- a/drivers/net/b44.h
+++ b/drivers/net/b44.h
@@ -400,6 +400,8 @@ struct b44 {
 #define B44_FLAG_ADV_100HALF	0x04000000
 #define B44_FLAG_ADV_100FULL	0x08000000
 #define B44_FLAG_INTERNAL_PHY	0x10000000
+#define B44_FLAG_RX_RING_HACK	0x20000000
+#define B44_FLAG_TX_RING_HACK	0x40000000
 
 	u32			rx_offset;
 

^ permalink raw reply

* [patch 2.6.14-rc4] bonding: fix typos in bonding documentation
From: John W. Linville @ 2005-10-19  1:30 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, ctindel, fubar, bonding-devel

Fix some simple typos in the bonding.txt file.  The typos are in areas
relating to loading the bonding driver multiple times.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 Documentation/networking/bonding.txt |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -777,7 +777,7 @@ doing so is the same as described in the
 Manually" section, below.
 
 	NOTE: It has been observed that some Red Hat supplied kernels
-are apparently unable to rename modules at load time (the "-obonding1"
+are apparently unable to rename modules at load time (the "-o bond1"
 part).  Attempts to pass that option to modprobe will produce an
 "Operation not permitted" error.  This has been reported on some
 Fedora Core kernels, and has been seen on RHEL 4 as well.  On kernels
@@ -883,7 +883,8 @@ the above does not work, and the second 
 its options.  In that case, the second options line can be substituted
 as follows:
 
-install bonding1 /sbin/modprobe bonding -obond1 mode=balance-alb miimon=50
+install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
+	mode=balance-alb miimon=50
 
 	This may be repeated any number of times, specifying a new and
 unique name in place of bond1 for each subsequent instance.

^ permalink raw reply

* [patch 2.6.14-rc4 1/3] sk98lin: remove MODULE_DEVICE_TABLE to avoid conflicts w/ skge
From: John W. Linville @ 2005-10-19  1:31 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, shemminger, mlindner, rroesler
In-Reply-To: <10182005213059.12304@bilbo.tuxdriver.com>

The skge driver claims support for the identical list of hardware
supported by the in-kernel sk98lin driver.  This can confuse userland
tools which pick modules based on the PCI ID lists exported through
MODULE_DEVICE_TABLE.

This patch removes the MODULE_DEVICE_TABLE line from sk98lin.  The
driver can still be loaded manually if necessary or desireable.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/sk98lin/skge.c |    2 --
 1 files changed, 2 deletions(-)

diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -5227,8 +5227,6 @@ static struct pci_device_id skge_pci_tbl
 	{ 0 }
 };
 
-MODULE_DEVICE_TABLE(pci, skge_pci_tbl);
-
 static struct pci_driver skge_driver = {
 	.name		= "sk98lin",
 	.id_table	= skge_pci_tbl,

^ permalink raw reply

* [patch 2.6.14-rc3] 8139too: fix resume for Realtek 8100B/8139D
From: John W. Linville @ 2005-10-19  1:31 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik

Add "HasHltClk" flag for RTL-8100B/8139D hardware in order to fix
problems resuming from suspend-to-RAM.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/8139too.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -552,7 +552,8 @@ const static struct {
 
 	{ "RTL-8100B/8139D",
 	  HW_REVID(1, 1, 1, 0, 1, 0, 1),
-	  HasLWake,
+	  HasHltClk /* XXX undocumented? */
+	| HasLWake,
 	},
 
 	{ "RTL-8101",

^ permalink raw reply

* [patch 2.6.14-rc4 2/3] MAINTAINERS: mark the sk98lin driver as obsolete
From: John W. Linville @ 2005-10-19  1:31 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, shemminger, mlindner, rroesler
In-Reply-To: <10182005213100.12360@bilbo.tuxdriver.com>

The sk98lin and skge drivers cover the same set of hardware, and the
skge driver enjoys community support.  This patch marks the sk98lin
driver as obsolete.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 MAINTAINERS |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1592,7 +1592,7 @@ M: 	mlindner@syskonnect.de
 P:	Ralph Roesler
 M: 	rroesler@syskonnect.de
 W: 	http://www.syskonnect.com
-S: 	Supported
+S: 	Obsolete
 
 MAESTRO PCI SOUND DRIVERS
 P:	Zach Brown

^ permalink raw reply

* [patch 2.6.14-rc4 3/3] Documentation: add sk98lin to the feature-removal-schedule
From: John W. Linville @ 2005-10-19  1:31 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik, shemminger, mlindner, rroesler
In-Reply-To: <10182005213100.12420@bilbo.tuxdriver.com>

The sk98lin and skge drivers cover the same set of hardware, yet the
sk98lin driver is barely maintained.  This patch schedules sk98lin
for removal early next year.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 Documentation/feature-removal-schedule.txt |    9 +++++++++
 1 files changed, 9 insertions(+)

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -95,3 +95,12 @@ Why:	This interface has been obsoleted b
 	to link against API-compatible library on top of libnfnetlink_queue 
 	instead of the current 'libipq'.
 Who:	Harald Welte <laforge@netfilter.org>
+
+---------------------------
+
+What:	sk98lin driver
+When:	April 2006
+Why:	This driver has been essentially unmaintained for some time.
+	Internally it is a mess, and the original authors are unwilling to
+	correct it.  Now the skge driver covers all the same hardware.
+Who:	John W. Linville <linville@tuxdriver.com>

^ permalink raw reply

* [patch 2.6.14-rc3 1/3] sundance: remove if (1) { ... } block in sundance_probe1
From: John W. Linville @ 2005-10-19  1:31 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik
In-Reply-To: <10182005213101.12694@bilbo.tuxdriver.com>

Remove an if (1) { ... } block in sundance_probe1.  Its purpose seems
to be only to allow for delaring some extra local variables.  But, it also
adds ugly indentation without adding any meaning to the code.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/sundance.c |   48 +++++++++++++++++++++++-------------------------
 1 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -518,6 +518,7 @@ static int __devinit sundance_probe1 (st
 #else
 	int bar = 1;
 #endif
+	int phy, phy_idx = 0;
 
 
 /* when built into the kernel, we only print version if device is found */
@@ -605,33 +606,30 @@ static int __devinit sundance_probe1 (st
 			printk("%2.2x:", dev->dev_addr[i]);
 	printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq);
 
-	if (1) {
-		int phy, phy_idx = 0;
-		np->phys[0] = 1;		/* Default setting */
-		np->mii_preamble_required++;
-		for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) {
-			int mii_status = mdio_read(dev, phy, MII_BMSR);
-			if (mii_status != 0xffff  &&  mii_status != 0x0000) {
-				np->phys[phy_idx++] = phy;
-				np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE);
-				if ((mii_status & 0x0040) == 0)
-					np->mii_preamble_required++;
-				printk(KERN_INFO "%s: MII PHY found at address %d, status "
-					   "0x%4.4x advertising %4.4x.\n",
-					   dev->name, phy, mii_status, np->mii_if.advertising);
-			}
-		}
-		np->mii_preamble_required--;
-
-		if (phy_idx == 0) {
-			printk(KERN_INFO "%s: No MII transceiver found, aborting.  ASIC status %x\n",
-				   dev->name, ioread32(ioaddr + ASICCtrl));
-			goto err_out_unregister;
-		}
-
-		np->mii_if.phy_id = np->phys[0];
+	np->phys[0] = 1;		/* Default setting */
+	np->mii_preamble_required++;
+	for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) {
+		int mii_status = mdio_read(dev, phy, MII_BMSR);
+		if (mii_status != 0xffff  &&  mii_status != 0x0000) {
+			np->phys[phy_idx++] = phy;
+			np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE);
+			if ((mii_status & 0x0040) == 0)
+				np->mii_preamble_required++;
+			printk(KERN_INFO "%s: MII PHY found at address %d, status "
+				   "0x%4.4x advertising %4.4x.\n",
+				   dev->name, phy, mii_status, np->mii_if.advertising);
+		}
+	}
+	np->mii_preamble_required--;
+
+	if (phy_idx == 0) {
+		printk(KERN_INFO "%s: No MII transceiver found, aborting.  ASIC status %x\n",
+			   dev->name, ioread32(ioaddr + ASICCtrl));
+		goto err_out_unregister;
 	}
 
+	np->mii_if.phy_id = np->phys[0];
+
 	/* Parse override configuration */
 	np->an_enable = 1;
 	if (card_idx < MAX_UNITS) {

^ permalink raw reply

* [patch 2.6.14-rc3 2/3] sundance: probe PHYs from MII address 0
From: John W. Linville @ 2005-10-19  1:31 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik
In-Reply-To: <10182005213101.12750@bilbo.tuxdriver.com>

Probe for PHYs starting at MII address 0 instead of MII address 1.
This covers the entire range of MII addresses.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/sundance.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -608,7 +608,7 @@ static int __devinit sundance_probe1 (st
 
 	np->phys[0] = 1;		/* Default setting */
 	np->mii_preamble_required++;
-	for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) {
+	for (phy = 0; phy < 32 && phy_idx < MII_CNT; phy++) {
 		int mii_status = mdio_read(dev, phy, MII_BMSR);
 		if (mii_status != 0xffff  &&  mii_status != 0x0000) {
 			np->phys[phy_idx++] = phy;

^ permalink raw reply

* [patch 2.6.14-rc3] epic100: fix counting of work_done in epic_poll
From: John W. Linville @ 2005-10-19  1:31 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: jgarzik

work_done is overwritten each time through the rx_action loop in
epic_poll.  This screws-up the NAPI accounting if the loop is executed
more than once.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

 drivers/net/epic100.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -1334,7 +1334,7 @@ static void epic_rx_err(struct net_devic
 static int epic_poll(struct net_device *dev, int *budget)
 {
 	struct epic_private *ep = dev->priv;
-	int work_done, orig_budget;
+	int work_done = 0, orig_budget;
 	long ioaddr = dev->base_addr;
 
 	orig_budget = (*budget > dev->quota) ? dev->quota : *budget;
@@ -1343,7 +1343,7 @@ rx_action:
 
 	epic_tx(dev, ep);
 
-	work_done = epic_rx(dev, *budget);
+	work_done += epic_rx(dev, *budget);
 
 	epic_rx_err(dev, ep);
 

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox