Source-Changes-HG archive

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

[src/trunk]: src/sys/net Add RTM_CHGADDR to signal that an address on the int...



details:   https://anonhg.NetBSD.org/src/rev/b9c437273cfe
branches:  trunk
changeset: 758662:b9c437273cfe
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Nov 12 16:30:26 2010 +0000

description:
Add RTM_CHGADDR to signal that an address on the interface has changed.
This is mainly used for notifying userland about active link address changes.

diffstat:

 sys/net/link_proto.c |   5 +++--
 sys/net/route.h      |   3 ++-
 sys/net/rtsock.c     |  19 +++++++++++++------
 3 files changed, 18 insertions(+), 9 deletions(-)

diffs (98 lines):

diff -r beda3c68c734 -r b9c437273cfe sys/net/link_proto.c
--- a/sys/net/link_proto.c      Fri Nov 12 16:09:57 2010 +0000
+++ b/sys/net/link_proto.c      Fri Nov 12 16:30:26 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: link_proto.c,v 1.5 2008/11/07 00:20:13 dyoung Exp $    */
+/*     $NetBSD: link_proto.c,v 1.6 2010/11/12 16:30:26 roy Exp $       */
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.5 2008/11/07 00:20:13 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.6 2010/11/12 16:30:26 roy Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -189,6 +189,7 @@
 
                        if (!isactive && mkactive) {
                                if_activate_sadl(ifp, ifa, nsdl);
+                               rt_newaddrmsg(RTM_CHANGE, ifa, 0, NULL);
                                error = ENETRESET;
                        }
                        break;
diff -r beda3c68c734 -r b9c437273cfe sys/net/route.h
--- a/sys/net/route.h   Fri Nov 12 16:09:57 2010 +0000
+++ b/sys/net/route.h   Fri Nov 12 16:30:26 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.75 2010/06/26 14:24:28 kefren Exp $        */
+/*     $NetBSD: route.h,v 1.76 2010/11/12 16:30:26 roy Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -223,6 +223,7 @@
                                 * address has changed
                                 */
 #define RTM_IFINFO     0x14    /* iface/link going up/down etc. */
+#define RTM_CHGADDR    0x15    /* address has changed on iface */
 
 #define RTV_MTU                0x1     /* init or lock _mtu */
 #define RTV_HOPCOUNT   0x2     /* init or lock _hopcount */
diff -r beda3c68c734 -r b9c437273cfe sys/net/rtsock.c
--- a/sys/net/rtsock.c  Fri Nov 12 16:09:57 2010 +0000
+++ b/sys/net/rtsock.c  Fri Nov 12 16:30:26 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.130 2010/06/28 17:26:11 kefren Exp $      */
+/*     $NetBSD: rtsock.c,v 1.131 2010/11/12 16:30:26 roy Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.130 2010/06/28 17:26:11 kefren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.131 2010/11/12 16:30:26 roy Exp $");
 
 #include "opt_inet.h"
 #include "opt_mpls.h"
@@ -589,6 +589,7 @@
 
        case RTM_DELADDR:
        case RTM_NEWADDR:
+       case RTM_CHGADDR:
                len = sizeof(struct ifa_msghdr);
                break;
 
@@ -680,6 +681,7 @@
 
        case RTM_DELADDR:
        case RTM_NEWADDR:
+       case RTM_CHGADDR:
                len = sizeof(struct ifa_msghdr);
                break;
 #ifdef COMPAT_14
@@ -837,11 +839,16 @@
                case cmdpass(RTM_ADD, 1):
                case cmdpass(RTM_CHANGE, 1):
                case cmdpass(RTM_DELETE, 2):
-                       if (cmd == RTM_ADD)
+                       switch (cmd) {
+                       case RTM_DELETE:
+                               ncmd = RTM_DELADDR;
+                               break;
+                       case RTM_CHANGE:
+                               ncmd = RTM_CHGADDR;
+                               break;
+                       default:
                                ncmd = RTM_NEWADDR;
-                       else
-                               ncmd = RTM_DELADDR;
-
+                       }
                        info.rti_info[RTAX_IFA] = sa = ifa->ifa_addr;
                        info.rti_info[RTAX_IFP] = ifp->if_dl->ifa_addr;
                        info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;



Home | Main Index | Thread Index | Old Index