Skip site navigation (1)Skip section navigation (2)
Date:      06 Oct 2002 22:59:06 +0400
From:      "Vladimir B. " Grebenschikov <vova@sw.ru>
To:        Maxim Sobolev <sobomax@FreeBSD.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: zebra interface flags problem on 4.7-RC2 (IFF_PROMISC)
Message-ID:  <1033930746.916.1.camel@vbook.express.ru>
In-Reply-To: <3D9DC7F3.7B966349@FreeBSD.org>
References:  <1033739506.1060.16.camel@vbook.express.ru>  <20021004140644.GB61661@vega.vega.com> <1033741307.1060.22.camel@vbook.express.ru>  <3D9DC7F3.7B966349@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
=F7 Fri, 04.10.2002, =D7 20:55, Maxim Sobolev =CE=C1=D0=C9=D3=C1=CC:
> Closer look at zebra's code revealed that my initial guess was
> entirely correct. The problem is that it doesn't bother to zero out
> ifreq structure allocated on stack, which leads to this misbehaviour.
>=20
> Attached patch should fix the problem - unfortunately due to code
> freeze I can't commit it immediately.

Yes, it works for me, thank you.

May be you need approve commit of this patch with re@ ?
I think it is not good idea to have not working zebra in release.


> -Maxim
>=20
> "Vladimir B. Grebenschikov" wrote:
> >=20
> > =F7 Fri, 04.10.2002, =D7 18:06, Maxim Sobolev =CE=C1=D0=C9=D3=C1=CC:
> > > On Fri, Oct 04, 2002 at 05:51:46PM +0400, Vladimir B.  Grebenschikov =
wrote:
> > > >
> > > > Hi
> > > >
> > > > I have tried to install fresh zebra (from ports) on 4.7-RC2
> > > >
> > > > have a problem - zebra turns on promiscuity mode on interface,
> > > > it is completely unacceptable when interface connected to HUB (not
> > > > switch) - router begins resend all packets.
> > > >
> > > > # ifconfig fxp1
> > > > fxp1: flags=3D8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> > > >         inet 193.125.143.129 netmask 0xffffff00 broadcast
> > > > 193.125.143.255
> > > >         ether 00:a0:c9:41:a3:a3
> > > >         media: Ethernet autoselect (10baseT/UTP)
> > > >         status: active
> > > > # zebra -d
> > > > 2002/10/04 16:33:42 ZEBRA: can't get ip6forwarding value
> > > > # ifconfig fxp1
> > > > fxp1: flags=3D8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> =
mtu
> > > > 1500
> > > >         inet 193.125.143.129 netmask 0xffffff00 broadcast
> > > > 193.125.143.255
> > > >         ether 00:a0:c9:41:a3:a3
> > > >         media: Ethernet autoselect (10baseT/UTP)
> > > >         status: active
> > > >
> > > >
> > > > Nothing special in zebra config, just installed 4.7-RC2, just upgra=
ded
> > > > zebra.
> > > >
> > > > I am not sure is it Zebra-related or FreeBSD-related problem
> > > > digging into zebra code do not show any abnormal interface flags
> > > > installed.
> > >
> > > This is probably a bug in zebra - I guess that it's doesn't clear
> > > 'struct ifreq' properly before SIOCSIFFLAGS ioctl(2).
> >=20
> > Zebra explicitly sets flags like this:
> > ioctl.c:  ifreq.ifr_flags =3D ifp->flags;
> > ioctl.c:  ifreq.ifr_flags |=3D flags;
> >=20
> > and I have tried to change code:
> >=20
> > ioctl.c:  ifreq.ifr_flags =3D ifp->flags;
> > ioctl.c:  ifreq.ifr_flags |=3D flags;
> > ioctl.c:  ifreq.ifr_flags &=3D ~(IFF_PROMISC);
> >=20
> > - does not help.
> >=20
> > > -Maxim
> > >
> > > >
> > > > May be problem related to following commit:
> > > >
> > > > date: 2002/08/30 14:23:38;  author: sobomax;  state: Exp;  lines: +=
25 -4
> > > > MFC: user-setable promisc mode. The code is slightly diffrent (and
> > > > uglier)
> > > > than in HEAD, because we have had to preserve kernel ABI, so that
> > > > increasing
> > > > if_flags to 32 bits was not an option.
> > > >
> > > >
> > > > --
> > > > Vladimir B. Grebenschikov
> > > > vova@sw.ru, SWsoft, Inc.
> > >
> > > To Unsubscribe: send mail to majordomo@FreeBSD.org
> > > with "unsubscribe freebsd-net" in the body of the message
> > >
> > --
> > Vladimir B. Grebenschikov
> > vova@sw.ru, SWsoft, Inc.
> ----
>=20

> Index: Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /home/ncvs/ports/net/zebra/Makefile,v
> retrieving revision 1.64
> diff -d -u -r1.64 Makefile
> --- Makefile	13 Sep 2002 07:57:25 -0000	1.64
> +++ Makefile	4 Oct 2002 16:50:07 -0000
> @@ -7,6 +7,7 @@
> =20
>  PORTNAME=3D	zebra
>  PORTVERSION=3D	0.93b
> +PORTREVISION=3D	1
>  CATEGORIES=3D	net ipv6
>  MASTER_SITES=3D	ftp://ftp.zebra.org/pub/zebra/ \
>  		ftp://ftp.ripe.net/mirrors/sites/ftp.zebra.org/pub/zebra/ \
> Index: files/patch-ioctl.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /home/ncvs/ports/net/zebra/files/patch-ioctl.c,v
> retrieving revision 1.1
> diff -d -u -r1.1 patch-ioctl.c
> --- files/patch-ioctl.c	12 Dec 2001 18:08:55 -0000	1.1
> +++ files/patch-ioctl.c	4 Oct 2002 16:50:07 -0000
> @@ -1,6 +1,25 @@
> ---- zebra/ioctl.c.orig	Wed Dec 12 18:02:16 2001
> -+++ zebra/ioctl.c	Wed Dec 12 18:02:30 2001
> -@@ -478,6 +478,9 @@
> +
> +$FreeBSD$
> +
> +--- zebra/ioctl.c.orig	Tue Oct 23 11:31:29 2001
> ++++ zebra/ioctl.c	Fri Oct  4 19:45:04 2002
> +@@ -349,6 +349,7 @@
> +   int ret;
> +   struct ifreq ifreq;
> +=20
> ++  bzero(&ifreq, sizeof(struct ifreq));
> +   ifreq_set_name (&ifreq, ifp);
> +=20
> +   ifreq.ifr_flags =3D ifp->flags;
> +@@ -371,6 +372,7 @@
> +   int ret;
> +   struct ifreq ifreq;
> +=20
> ++  bzero(&ifreq, sizeof(struct ifreq));
> +   ifreq_set_name (&ifreq, ifp);
> +=20
> +   ifreq.ifr_flags =3D ifp->flags;
> +@@ -473,6 +475,9 @@
>     mask.sin6_len =3D sizeof (struct sockaddr_in6);
>   #endif
>     memcpy (&addreq.ifra_prefixmask, &mask, sizeof (struct sockaddr_in6))=
;
> @@ -8,5 +27,5 @@
>  +  addreq.ifra_lifetime.ia6t_vltime =3D 0xffffffff;
>  +  addreq.ifra_lifetime.ia6t_pltime =3D 0xffffffff;
>    =20
> -   ret =3D if_ioctl_ipv6 (SIOCAIFADDR_IN6, (caddr_t) &addreq);
> -   if (ret < 0)
> +   addreq.ifra_lifetime.ia6t_pltime =3D ND6_INFINITE_LIFETIME;=20
> +   addreq.ifra_lifetime.ia6t_vltime =3D ND6_INFINITE_LIFETIME;=20
--=20
Vladimir B. Grebenschikov
vova@sw.ru, SWsoft, Inc.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1033930746.916.1.camel>