Network interface RUNNING and UP flags

Coleman Kane cokane at cokane.org
Sun Aug 8 13:00:11 PDT 2004


That patch seems to have fixed it. It seemed strange that setting an
inet address to the interface set it running, however setting the inet6
does not do this. It is possible this behavior affacts other interface
types as well?

On Fri, 2004-08-06 at 18:07, Maksim Yevmenkin wrote:
> > 2) Is there a way to set this interface flag without assigning an IPv4
> > address (or any address for that matter) first?
> > 
> > Mainly for number two, I would like to be able to run interfaces
> > bridged together without having to also give all of them addresses.
> 
> please try the attached (untested!) patch. it should set iff_running 
> flag on the interface as soon as the control device is opened.
> 
> max
> 
> ______________________________________________________________________
> --- if_tap.c.orig	Fri Aug  6 15:02:06 2004
> +++ if_tap.c	Fri Aug  6 15:04:14 2004
> @@ -336,15 +336,15 @@
>  tapopen(dev, flag, mode, td)
>  	struct cdev *dev;
>  	int		 flag;
>  	int		 mode;
>  	struct thread	*td;
>  {
>  	struct tap_softc	*tp = NULL;
> -	int			 error;
> +	int			 error, s;
>  
>  	if ((error = suser(td)) != 0)
>  		return (error);
>  
>  	if ((dev2unit(dev) & CLONE_UNITMASK) > TAPMAXUNIT)
>  		return (ENXIO);
>  
> @@ -365,14 +365,19 @@
>  		return (EBUSY);
>  	}
>  
>  	bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr));
>  	tp->tap_pid = td->td_proc->p_pid;
>  	tp->tap_flags |= TAP_OPEN;
>  	mtx_unlock(&tp->tap_mtx);
> +
> +	s = splimp();
> +	tp->tap_if.if_flags |= IFF_RUNNING;
> +	tp->tap_if.if_flags &= ~IFF_OACTIVE;
> +	splx(s);
>  
>  	TAPDEBUG("%s is open. minor = %#x\n", 
>  		tp->tap_if.if_xname, minor(dev));
>  
>  	return (0);
>  } /* tapopen */
>  



More information about the freebsd-hackers mailing list