svn commit: r269243 - in head: share/man/man9 sys/net sys/netinet sys/netinet6

Gleb Smirnoff glebius at FreeBSD.org
Tue Jul 29 15:01:31 UTC 2014


Author: glebius
Date: Tue Jul 29 15:01:29 2014
New Revision: 269243
URL: http://svnweb.freebsd.org/changeset/base/269243

Log:
  Garbage collect couple of unused fields from struct ifaddr:
  - ifa_claim_addr() unused since removal of NetAtalk
  - ifa_metric seems to be never utilized, always a copy of if_metric

Modified:
  head/share/man/man9/ifnet.9
  head/sys/net/if.c
  head/sys/net/if.h
  head/sys/net/if_var.h
  head/sys/net/rtsock.c
  head/sys/netinet/in.c
  head/sys/netinet6/in6.c

Modified: head/share/man/man9/ifnet.9
==============================================================================
--- head/share/man/man9/ifnet.9	Tue Jul 29 14:54:23 2014	(r269242)
+++ head/share/man/man9/ifnet.9	Tue Jul 29 15:01:29 2014	(r269243)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 5, 2013
+.Dd July 29, 2014
 .Dt IFNET 9
 .Os
 .Sh NAME
@@ -1084,10 +1084,6 @@ address in the route table.
 .It Va ifa_refcnt
 .Pq Vt short
 The reference count.
-.It Va ifa_metric
-.Pq Vt int
-A metric associated with this interface address, for the use of some
-external routing protocol.
 .El
 .Pp
 References to

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Tue Jul 29 14:54:23 2014	(r269242)
+++ head/sys/net/if.c	Tue Jul 29 15:01:29 2014	(r269243)
@@ -1747,19 +1747,6 @@ next:				continue;
 				}
 			} else {
 				/*
-				 * if we have a special address handler,
-				 * then use it instead of the generic one.
-				 */
-				if (ifa->ifa_claim_addr) {
-					if ((*ifa->ifa_claim_addr)(ifa, addr)) {
-						ifa_ref(ifa);
-						IF_ADDR_RUNLOCK(ifp);
-						goto done;
-					}
-					continue;
-				}
-
-				/*
 				 * Scan all the bits in the ifa's address.
 				 * If a bit dissagrees with what we are
 				 * looking for, mask it with the netmask

Modified: head/sys/net/if.h
==============================================================================
--- head/sys/net/if.h	Tue Jul 29 14:54:23 2014	(r269242)
+++ head/sys/net/if.h	Tue Jul 29 15:01:29 2014	(r269243)
@@ -304,7 +304,7 @@ struct ifa_msghdr {
 	int	ifam_addrs;	/* like rtm_addrs */
 	int	ifam_flags;	/* value of ifa_flags */
 	u_short	ifam_index;	/* index for associated ifp */
-	int	ifam_metric;	/* value of ifa_metric */
+	int	ifam_metric;	/* value of ifa_ifp->if_metric */
 };
 
 /*
@@ -329,7 +329,7 @@ struct ifa_msghdrl {
 	u_short _ifam_spare1;	/* spare space to grow if_index, see if_var.h */
 	u_short	ifam_len;	/* length of ifa_msghdrl incl. if_data */
 	u_short	ifam_data_off;	/* offset of if_data from beginning */
-	int	ifam_metric;	/* value of ifa_metric */
+	int	ifam_metric;	/* value of ifa_ifp->if_metric */
 	struct	if_data ifam_data;/* statistics and other data about if or
 				 * address */
 };

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Tue Jul 29 14:54:23 2014	(r269242)
+++ head/sys/net/if_var.h	Tue Jul 29 15:01:29 2014	(r269243)
@@ -366,9 +366,6 @@ struct ifaddr {
 		(int, struct rtentry *, struct rt_addrinfo *);
 	u_short	ifa_flags;		/* mostly rt_flags for cloning */
 	u_int	ifa_refcnt;		/* references to this structure */
-	int	ifa_metric;		/* cost of going out this interface */
-	int (*ifa_claim_addr)		/* check if an addr goes to this if */
-		(struct ifaddr *, struct sockaddr *);
 
 	counter_u64_t	ifa_ipackets;
 	counter_u64_t	ifa_opackets;	 

Modified: head/sys/net/rtsock.c
==============================================================================
--- head/sys/net/rtsock.c	Tue Jul 29 14:54:23 2014	(r269242)
+++ head/sys/net/rtsock.c	Tue Jul 29 15:01:29 2014	(r269243)
@@ -1289,7 +1289,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *i
 		return (ENOBUFS);
 	ifam = mtod(m, struct ifa_msghdr *);
 	ifam->ifam_index = ifp->if_index;
-	ifam->ifam_metric = ifa->ifa_metric;
+	ifam->ifam_metric = ifa->ifa_ifp->if_metric;
 	ifam->ifam_flags = ifa->ifa_flags;
 	ifam->ifam_addrs = info.rti_addrs;
 
@@ -1638,7 +1638,7 @@ sysctl_iflist_ifaml(struct ifaddr *ifa, 
 		ifam32->ifam_len = sizeof(*ifam32);
 		ifam32->ifam_data_off =
 		    offsetof(struct ifa_msghdrl32, ifam_data);
-		ifam32->ifam_metric = ifa->ifa_metric;
+		ifam32->ifam_metric = ifa->ifa_ifp->if_metric;
 		ifd = &ifam32->ifam_data;
 	} else
 #endif
@@ -1649,7 +1649,7 @@ sysctl_iflist_ifaml(struct ifaddr *ifa, 
 		ifam->_ifam_spare1 = 0;
 		ifam->ifam_len = sizeof(*ifam);
 		ifam->ifam_data_off = offsetof(struct ifa_msghdrl, ifam_data);
-		ifam->ifam_metric = ifa->ifa_metric;
+		ifam->ifam_metric = ifa->ifa_ifp->if_metric;
 		ifd = &ifam->ifam_data;
 	}
 
@@ -1677,7 +1677,7 @@ sysctl_iflist_ifam(struct ifaddr *ifa, s
 	ifam->ifam_addrs = info->rti_addrs;
 	ifam->ifam_flags = ifa->ifa_flags;
 	ifam->ifam_index = ifa->ifa_ifp->if_index;
-	ifam->ifam_metric = ifa->ifa_metric;
+	ifam->ifam_metric = ifa->ifa_ifp->if_metric;
 
 	return (SYSCTL_OUT(w->w_req, w->w_tmem, len));
 }

Modified: head/sys/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c	Tue Jul 29 14:54:23 2014	(r269242)
+++ head/sys/netinet/in.c	Tue Jul 29 15:01:29 2014	(r269243)
@@ -363,7 +363,6 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat
 	ifa->ifa_netmask = (struct sockaddr *)&ia->ia_sockmask;
 
 	ia->ia_ifp = ifp;
-	ia->ia_ifa.ifa_metric = ifp->if_metric;
 	ia->ia_addr = *addr;
 	if (mask->sin_len != 0) {
 		ia->ia_sockmask = *mask;

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Tue Jul 29 14:54:23 2014	(r269242)
+++ head/sys/netinet6/in6.c	Tue Jul 29 15:01:29 2014	(r269243)
@@ -1249,9 +1249,6 @@ in6_update_ifa_internal(struct ifnet *if
 		ia->ia6_lifetime.ia6t_preferred = time_uptime;
 	}
 
-	/* Update metric */
-	ia->ia_ifa.ifa_metric = ifp->if_metric;
-
 	/*
 	 * configure address flags.
 	 */


More information about the svn-src-head mailing list