Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net PR/49437: jmcneill: revert broken changes that broke...
details: https://anonhg.NetBSD.org/src/rev/11114d4dce4f
branches: trunk
changeset: 334673:11114d4dce4f
user: christos <christos%NetBSD.org@localhost>
date: Mon Dec 01 00:27:05 2014 +0000
description:
PR/49437: jmcneill: revert broken changes that broke SIOCGIFCONF (mdnsd uses it)
diffstat:
sys/net/if.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diffs (63 lines):
diff -r 9f13972dd5ce -r 11114d4dce4f sys/net/if.c
--- a/sys/net/if.c Sun Nov 30 23:43:30 2014 +0000
+++ b/sys/net/if.c Mon Dec 01 00:27:05 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.300 2014/11/28 08:29:00 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.301 2014/12/01 00:27:05 christos 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.300 2014/11/28 08:29:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.301 2014/12/01 00:27:05 christos Exp $");
#include "opt_inet.h"
@@ -2115,12 +2115,13 @@
struct ifconf *ifc = (struct ifconf *)data;
struct ifnet *ifp;
struct ifaddr *ifa;
- struct ifreq ifr, *ifrp = NULL;
- int space = 0, error = 0;
+ struct ifreq ifr, *ifrp;
+ int space, error = 0;
const int sz = (int)sizeof(struct ifreq);
- const bool docopy = ifc->ifc_req != NULL;
- if (docopy)
+ if ((ifrp = ifc->ifc_req) == NULL)
+ space = 0;
+ else
space = ifc->ifc_len;
IFNET_FOREACH(ifp) {
(void)strncpy(ifr.ifr_name, ifp->if_xname,
@@ -2130,7 +2131,7 @@
if (IFADDR_EMPTY(ifp)) {
/* Interface with no addresses - send zero sockaddr. */
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
- if (!docopy) {
+ if (ifrp == NULL) {
space += sz;
continue;
}
@@ -2148,7 +2149,7 @@
/* all sockaddrs must fit in sockaddr_storage */
KASSERT(sa->sa_len <= sizeof(ifr.ifr_ifru));
- if (!docopy) {
+ if (ifrp == NULL) {
space += sz;
continue;
}
@@ -2161,7 +2162,7 @@
}
}
}
- if (docopy) {
+ if (ifrp != NULL) {
KASSERT(0 <= space && space <= ifc->ifc_len);
ifc->ifc_len -= space;
} else {
Home |
Main Index |
Thread Index |
Old Index