Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix a bug that SIOCZIFDATA clears if_lastchage by zero.



details:   https://anonhg.NetBSD.org/src/rev/dd312b0e567f
branches:  trunk
changeset: 782386:dd312b0e567f
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Nov 01 06:36:30 2012 +0000

description:
Fix a bug that SIOCZIFDATA clears if_lastchage by zero.
Update if_lastchange with getnanotime().

diffstat:

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

diffs (33 lines):

diff -r 3600d2235369 -r dd312b0e567f sys/net/if.c
--- a/sys/net/if.c      Thu Nov 01 06:06:14 2012 +0000
+++ b/sys/net/if.c      Thu Nov 01 06:36:30 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.260 2012/02/03 03:35:30 christos Exp $        */
+/*     $NetBSD: if.c,v 1.261 2012/11/01 06:36:30 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.260 2012/02/03 03:35:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.261 2012/11/01 06:36:30 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -1614,6 +1614,14 @@
                 */
                memset(&ifp->if_data.ifi_ipackets, 0, sizeof(ifp->if_data) -
                    offsetof(struct if_data, ifi_ipackets));
+               /*
+                * The memset() clears to the bottm of if_data. In the area,
+                * if_lastchange is included. Please be careful if new entry
+                * will be added into if_data or rewite this.
+                *
+                * And also, update if_lastchnage.
+                */
+               getnanotime(&ifp->if_lastchange);
                break;
        case SIOCSIFMTU:
                ifr = data;



Home | Main Index | Thread Index | Old Index