niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Why do we do if_init for AF_INET even if the interface is running?
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Xin LI
*nix forums beginner


Joined: 09 Nov 2004
Posts: 44

PostPosted: Tue Jun 13, 2006 2:49 am    Post subject: Why do we do if_init for AF_INET even if the interface is running? Reply with quote

Hi,

Is there any reason why we do if_init() for AF_INET regardless whether
the interface is already in IF_DRV_RUNNING? This seems to cause the
interface to reinitialize its link level state, which causes the network
to stop for a short while.

The proposed patch is inspired from NetBSD net/if_ethersubr.c,v 1.86
which says:

"When setting an address on an interface, for address families which
do not require changing the link-level address, only (*if_init)()
if the interface is not already RUNNING."

I think we may want this as well.

Comments?

Cheers,
--
Xin LI <delphij delphij net> http://www.delphij.net/
Back to top
Sam Leffler
*nix forums addict


Joined: 20 Jun 2002
Posts: 75

PostPosted: Tue Jun 13, 2006 4:52 am    Post subject: Re: Why do we do if_init for AF_INET even if the interface is running? Reply with quote

Xin LI wrote:
Quote:
Hi,

Is there any reason why we do if_init() for AF_INET regardless whether
the interface is already in IF_DRV_RUNNING? This seems to cause the
interface to reinitialize its link level state, which causes the network
to stop for a short while.

The proposed patch is inspired from NetBSD net/if_ethersubr.c,v 1.86
which says:

"When setting an address on an interface, for address families which
do not require changing the link-level address, only (*if_init)()
if the interface is not already RUNNING."

I think we may want this as well.

Comments?

Cheers,


------------------------------------------------------------------------

Index: if_ethersubr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.215
diff -u -r1.215 if_ethersubr.c
--- if_ethersubr.c 3 Mar 2006 17:21:08 -0000 1.215
+++ if_ethersubr.c 13 Jun 2006 01:55:31 -0000
@@ -997,7 +997,8 @@
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
- ifp->if_init(ifp->if_softc); /* before arpwhohas */
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ ifp->if_init(ifp->if_softc); /* before arpwhohas */
arp_ifinit(ifp, ifa);
break;
#endif
@@ -1027,7 +1028,8 @@
}
#endif
default:
- ifp->if_init(ifp->if_softc);
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ ifp->if_init(ifp->if_softc);
break;
}
break;

Try it; you'll find various drivers blow up in their multicast code
because they assume the init method is called. I tried to get this same
change committed last year because it causes wireless drivers to blow
chunks. I finally gave up and stuck a similar change in ieee80211_ioctl.

Sam

_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Back to top
Brooks Davis
*nix forums addict


Joined: 14 Jun 2002
Posts: 97

PostPosted: Tue Jun 13, 2006 5:03 am    Post subject: Re: Why do we do if_init for AF_INET even if the interface is running? Reply with quote

On Tue, Jun 13, 2006 at 10:49:34AM +0800, Xin LI wrote:
Quote:
Hi,

Is there any reason why we do if_init() for AF_INET regardless whether
the interface is already in IF_DRV_RUNNING? This seems to cause the
interface to reinitialize its link level state, which causes the network
to stop for a short while.

The proposed patch is inspired from NetBSD net/if_ethersubr.c,v 1.86
which says:

"When setting an address on an interface, for address families which
do not require changing the link-level address, only (*if_init)()
if the interface is not already RUNNING."

I think we may want this as well.

Comments?

As Sam says, there are hardware filters that need to be initialized.
My feeling is that you're correct that doing so via if_init is a bug
since that's way too big a hammer, but there are too many edge cases
for it to be possible to have a flag day. If we want to move to more
selective updating, the way to do it is probably some sort of flag
similar to IFF_NEEDSGIANT that tell the interface subsystem to keep the
old behavior and otherwise pass the change down to the driver to decide
what it needs to do. That way we could make the change over time and
eventually deprecate and then remove the flag.

-- Brooks

--
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Tue Dec 02, 2008 1:36 pm | All times are GMT
navigation Forum index » *nix » BSD » FreeBSD » mail-lists » Architecture
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Running php file everyday on scheduled time sachin PHP 1 Fri Jul 21, 2006 12:49 pm
No new posts Bug#379103: ITP: complearn-gui -- 3D drag-and-drop interf... Rudi Cilibrasi devel 0 Fri Jul 21, 2006 11:00 am
No new posts HPSBUX02108 SSRT061133 rev.12 - HP-UX Running Sendmail, R... Security Alert HP-UX 0 Thu Jul 20, 2006 6:43 pm
No new posts HPSBUX02108 SSRT061133 rev.12 - HP-UX Running Sendmail, R... Security Alert HP-UX 0 Thu Jul 20, 2006 5:53 pm
No new posts running a system function from c++ code Fred J. C++ 13 Thu Jul 20, 2006 2:54 am

Mortgage Calculator | Loans | Debt Help | Credit Check | Loans
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2929s ][ Queries: 16 (0.1875s) ][ GZIP on - Debug on ]