χ Fri, 04.10.2002, Χ 20:55, Maxim Sobolev ΞΑΠΙΣΑΜ:
> 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.
> 
> 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
> 
> "Vladimir B. Grebenschikov" wrote:
> > 
> > χ Fri, 04.10.2002, Χ 18:06, Maxim Sobolev ΞΑΠΙΣΑΜ:
> > > 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=8843<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=8943<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 upgraded
> > > > 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).
> > 
> > Zebra explicitly sets flags like this:
> > ioctl.c:  ifreq.ifr_flags = ifp->flags;
> > ioctl.c:  ifreq.ifr_flags |= flags;
> > 
> > and I have tried to change code:
> > 
> > ioctl.c:  ifreq.ifr_flags = ifp->flags;
> > ioctl.c:  ifreq.ifr_flags |= flags;
> > ioctl.c:  ifreq.ifr_flags &= ~(IFF_PROMISC);
> > 
> > - does not help.
> > 
> > > -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
> > > > [EMAIL PROTECTED], SWsoft, Inc.
> > >
> > > To Unsubscribe: send mail to [EMAIL PROTECTED]
> > > with "unsubscribe freebsd-net" in the body of the message
> > >
> > --
> > Vladimir B. Grebenschikov
> > [EMAIL PROTECTED], SWsoft, Inc.
> ----
> 

> Index: Makefile
> ===================================================================
> 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 @@
>  
>  PORTNAME=    zebra
>  PORTVERSION= 0.93b
> +PORTREVISION=        1
>  CATEGORIES=  net ipv6
>  MASTER_SITES=        ftp://ftp.zebra.org/pub/zebra/ \
>               ftp://ftp.ripe.net/mirrors/sites/ftp.zebra.org/pub/zebra/ \
> Index: files/patch-ioctl.c
> ===================================================================
> 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;
> + 
> ++  bzero(&ifreq, sizeof(struct ifreq));
> +   ifreq_set_name (&ifreq, ifp);
> + 
> +   ifreq.ifr_flags = ifp->flags;
> +@@ -371,6 +372,7 @@
> +   int ret;
> +   struct ifreq ifreq;
> + 
> ++  bzero(&ifreq, sizeof(struct ifreq));
> +   ifreq_set_name (&ifreq, ifp);
> + 
> +   ifreq.ifr_flags = ifp->flags;
> +@@ -473,6 +475,9 @@
>     mask.sin6_len = sizeof (struct sockaddr_in6);
>   #endif
>     memcpy (&addreq.ifra_prefixmask, &mask, sizeof (struct sockaddr_in6));
> @@ -8,5 +27,5 @@
>  +  addreq.ifra_lifetime.ia6t_vltime = 0xffffffff;
>  +  addreq.ifra_lifetime.ia6t_pltime = 0xffffffff;
>     
> -   ret = if_ioctl_ipv6 (SIOCAIFADDR_IN6, (caddr_t) &addreq);
> -   if (ret < 0)
> +   addreq.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; 
> +   addreq.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; 
-- 
Vladimir B. Grebenschikov
[EMAIL PROTECTED], SWsoft, Inc.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to