Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net if_alloc_sadl(): if the interface already has a link...



details:   https://anonhg.NetBSD.org/src/rev/6f06f8c79c96
branches:  trunk
changeset: 503026:6f06f8c79c96
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jan 29 01:49:43 2001 +0000

description:
if_alloc_sadl(): if the interface already has a link name, free
it before assigning a new one.  This is useful for interfaces
that may change their link names in the course of their existence.

diffstat:

 sys/net/if.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r a23eccd3e958 -r 6f06f8c79c96 sys/net/if.c
--- a/sys/net/if.c      Mon Jan 29 01:37:56 2001 +0000
+++ b/sys/net/if.c      Mon Jan 29 01:49:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.83 2001/01/17 09:34:48 itojun Exp $   */
+/*     $NetBSD: if.c,v 1.84 2001/01/29 01:49:43 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -264,6 +264,14 @@
        struct sockaddr_dl *sdl;
        struct ifaddr *ifa;
 
+       /*
+        * If the interface already has a link name, release it
+        * now.  This is useful for interfaces that can change
+        * link types, and thus switch link names often.
+        */
+       if (ifp->if_sadl != NULL)
+               if_free_sadl(ifp);
+
        namelen = strlen(ifp->if_xname);
        masklen = offsetof(struct sockaddr_dl, sdl_data[0]) + namelen;
        socksize = masklen + ifp->if_addrlen;



Home | Main Index | Thread Index | Old Index