svn commit: r287723 - in stable/10: sbin/ifconfig share/man/man4 sys/net

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sat Sep 12 20:36:39 2015
New Revision: 287723
URL: https://svnweb.freebsd.org/changeset/base/287723

Log:
  MFC 272159,272161,272386,272446,272547,272548,273210:
  
  - Make lagg protos a enum.
  
  - When reconfiguring protocol on a lagg, first set it to LAGG_PROTO_NONE,
then drop lock, run the attach routines, and then set it to specific
proto. This removes tons of WITNESS warnings.
  
  - Make lagg protocol attach handlers not failing and allocate memory
with M_WAITOK.
  
  - Virtualize lagg(4) cloner.  This change fixes a panic when tearing down
if_lagg(4) interfaces which were cloned in a vnet jail.
  
Sysctl nodes which are dynamically generated for each cloned interface
(net.link.lagg.N.*) have been removed, and use_flowid and flowid_shift
ifconfig(8) parameters have been added instead.  Flags and per-interface
statistics counters are displayed in "ifconfig -v".
  
  - Separate option handling from SIOC[SG]LAGG to SIOC[SG]LAGGOPTS for
backward compatibility with old ifconfig(8).
  
  - Move L2 addr configuration for the primary port to a taskqueue.  This fixes
LOR of softc rmlock in iflladdr_event handlers.
  
  - Call if_delmulti_ifma() after LACP_UNLOCK().  This fixes another LOR.
  
  - Fix a panic in lacp_transit_expire().
  
  - Fix a panic in lagg_input() upon shutting down a port.
  
  - Use printb() for boolean flags in ro_opts and actor_state for LACP.
  
  - Fix lladdr configuration which could prevent LACP mode from working.
  
  - Fix LORs when a laggport interface has an IPv6 LLA.

Modified:
  stable/10/sbin/ifconfig/ifconfig.8
  stable/10/sbin/ifconfig/iflagg.c
  stable/10/share/man/man4/lagg.4
  stable/10/sys/net/ieee8023ad_lacp.c
  stable/10/sys/net/ieee8023ad_lacp.h
  stable/10/sys/net/if_lagg.c
  stable/10/sys/net/if_lagg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/ifconfig/ifconfig.8
==
--- stable/10/sbin/ifconfig/ifconfig.8  Sat Sep 12 20:14:54 2015
(r287722)
+++ stable/10/sbin/ifconfig/ifconfig.8  Sat Sep 12 20:36:39 2015
(r287723)
@@ -28,7 +28,7 @@
 .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd July 24, 2015
+.Dd September 12, 2015
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2393,9 +2393,16 @@ Remove the interface named by
 from the aggregation interface.
 .It Cm laggproto Ar proto
 Set the aggregation protocol.
-The default is failover.
-The available options are failover, fec, lacp, loadbalance, roundrobin and
-none.
+The default is
+.Li failover .
+The available options are
+.Li failover ,
+.Li lacp ,
+.Li loadbalance ,
+.Li roundrobin ,
+.Li broadcast
+and
+.Li none .
 .It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
 Set the packet layers to hash for aggregation protocols which load balance.
 The default is
@@ -2410,7 +2417,34 @@ src/dst address for IPv4 or IPv6.
 .It Cm l4
 src/dst port for TCP/UDP/SCTP.
 .El
-.Pp
+.It Cm use_flowid
+Enable local hash computation for RSS hash on the interface.
+The
+.Li loadbalance
+and
+.Li lacp
+modes will use the RSS hash from the network card if available
+to avoid computing one, this may give poor traffic distribution
+if the hash is invalid or uses less of the protocol header information.
+.Cm use_flowid
+disables use of RSS hash from the network card.
+The default value can be set via the
+.Va net.link.lagg.default_use_flowid
+.Xr sysctl 8
+variable.
+.Li 0
+means
+.Dq disabled
+and
+.Li 1
+means
+.Dq enabled .
+.It Cm -use_flowid
+Disable local hash computation for RSS hash on the interface.
+.It Cm flowid_shift Ar number
+Set a shift parameter for RSS local hash computation.
+Hash is calculated by using flowid bits in a packet header mbuf
+which are shifted by the number of this parameter.
 .El
 .Pp
 The following parameters are specific to IP tunnel interfaces,

Modified: stable/10/sbin/ifconfig/iflagg.c
==
--- stable/10/sbin/ifconfig/iflagg.cSat Sep 12 20:14:54 2015
(r287722)
+++ stable/10/sbin/ifconfig/iflagg.cSat Sep 12 20:36:39 2015
(r287723)
@@ -17,6 +17,7 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -68,7 +69,7 @@ setlaggproto(const char *val, int d, int
bzero(&ra, sizeof(ra));
ra.ra_proto = LAGG_PROTO_MAX;
 
-   for (i = 0; i < (sizeof(lpr) / sizeof(lpr[0])); i++) {
+   for (i = 0; i < nitems(lpr); i++) {
if (strcmp(val, lpr[i].lpr_name) == 0) {
ra.ra_proto = lpr[i].lpr_proto;
break;
@@ -83,6 +84,48 @@ setlaggproto(const char *val, int d, int
 }
 
 static void
+setlaggflowidshift(const char *val, int d, int s, const struct afswtch *afp)
+{
+   struct lagg_reqopts ro;
+
+   bzero(&ro, sizeof(ro));
+   ro.ro_opts = LAGG_OPT_FLOWIDSHIFT;
+   strlcpy(ro.ro_ifname

svn commit: r287729 - stable/10/lib/libc/net

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 01:31:17 2015
New Revision: 287729
URL: https://svnweb.freebsd.org/changeset/base/287729

Log:
  MFC 287595:
  
  - Fix SIGSEGV when sa == NULL.  NULL check in getnameinfo_inet()
did not work as expected.
  
  - Simplify afdl table lookup.

Modified:
  stable/10/lib/libc/net/getnameinfo.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/net/getnameinfo.c
==
--- stable/10/lib/libc/net/getnameinfo.cSun Sep 13 00:08:04 2015
(r287728)
+++ stable/10/lib/libc/net/getnameinfo.cSun Sep 13 01:31:17 2015
(r287729)
@@ -78,6 +78,8 @@ getnameinfo(const struct sockaddr *sa, s
 char *host, size_t hostlen, char *serv, size_t servlen,
 int flags)
 {
+   if (sa == NULL)
+   return (EAI_FAIL);
 
switch (sa->sa_family) {
case AF_INET:
@@ -124,25 +126,19 @@ getnameinfo_inet(const struct sockaddr *
struct servent *sp;
struct hostent *hp;
u_short port;
-   int family, i;
const char *addr;
u_int32_t v4a;
int h_error;
char numserv[512];
char numaddr[512];
 
-   if (sa == NULL)
-   return EAI_FAIL;
-
-   family = sa->sa_family;
-   for (i = 0; afdl[i].a_af; i++)
-   if (afdl[i].a_af == family) {
-   afd = &afdl[i];
-   goto found;
-   }
-   return EAI_FAMILY;
+   for (afd = &afdl[0]; afd->a_af > 0; afd++) {
+   if (afd->a_af == sa->sa_family)
+   break;
+   }
+   if (afd->a_af == 0)
+   return (EAI_FAMILY);
 
- found:
if (salen != afd->a_socklen)
return EAI_FAIL;
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r287730 - in stable/10: sbin/ifconfig share/man/man4 sys/net

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 01:35:40 2015
New Revision: 287730
URL: https://svnweb.freebsd.org/changeset/base/287730

Log:
  MFC 287607:
  
  - Remove GIF_{SEND,ACCEPT}_REVETHIP.
  - Simplify EADDRNOTAVAIL and EAFNOSUPPORT conditions.

Modified:
  stable/10/sbin/ifconfig/ifgif.c
  stable/10/share/man/man4/gif.4
  stable/10/sys/net/if_gif.c
  stable/10/sys/net/if_gif.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/ifconfig/ifgif.c
==
--- stable/10/sbin/ifconfig/ifgif.c Sun Sep 13 01:31:17 2015
(r287729)
+++ stable/10/sbin/ifconfig/ifgif.c Sun Sep 13 01:35:40 2015
(r287730)
@@ -51,7 +51,7 @@ static const char rcsid[] =
 
 #include "ifconfig.h"
 
-#defineGIFBITS 
"\020\1ACCEPT_REV_ETHIP_VER\2IGNORE_SOURCE\5SEND_REV_ETHIP_VER"
+#defineGIFBITS "\020\2IGNORE_SOURCE"
 
 static voidgif_status(int);
 
@@ -70,8 +70,7 @@ gif_status(int s)
 }
 
 static void
-setgifopts(const char *val,
-   int d, int s, const struct afswtch *afp)
+setgifopts(const char *val, int d, int s, const struct afswtch *afp)
 {
int opts;
 
@@ -93,12 +92,8 @@ setgifopts(const char *val,
 }
 
 static struct cmd gif_cmds[] = {
-   DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP,setgifopts),
-   DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP,   setgifopts),
DEF_CMD("ignore_source",GIF_IGNORE_SOURCE,  setgifopts),
DEF_CMD("-ignore_source",   -GIF_IGNORE_SOURCE, setgifopts),
-   DEF_CMD("send_rev_ethip_ver",   GIF_SEND_REVETHIP,  setgifopts),
-   DEF_CMD("-send_rev_ethip_ver",  -GIF_SEND_REVETHIP, setgifopts),
 };
 
 static struct afswtch af_gif = {
@@ -110,11 +105,9 @@ static struct afswtch af_gif = {
 static __constructor void
 gif_ctor(void)
 {
-#defineN(a)(sizeof(a) / sizeof(a[0]))
size_t i;
 
-   for (i = 0; i < N(gif_cmds); i++)
+   for (i = 0; i < nitems(gif_cmds); i++)
cmd_register(&gif_cmds[i]);
af_register(&af_gif);
-#undef N
 }

Modified: stable/10/share/man/man4/gif.4
==
--- stable/10/share/man/man4/gif.4  Sun Sep 13 01:31:17 2015
(r287729)
+++ stable/10/share/man/man4/gif.4  Sun Sep 13 01:35:40 2015
(r287730)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 14, 2014
+.Dd September 10, 2015
 .Dt GIF 4
 .Os
 .Sh NAME
@@ -246,32 +246,3 @@ had a multi-destination behavior, config
 .Dv IFF_LINK0
 flag.
 The behavior is obsolete and is no longer supported.
-.Pp
-On
-.Fx
-6.1, 6.2, 6.3, 7.0, 7.1, and 7.2
-the
-.Nm
-sends and receives incorrect EtherIP packets with reversed version
-field when
-.Xr if_bridge 4
-is used together.  As a workaround on this interoperability issue, the
-following two
-.Xr ifconfig 8
-flags can be used:
-.Bl -tag -width "accept_rev_ethip_ver" -offset indent
-.It accept_rev_ethip_ver
-accepts both correct EtherIP packets and ones with reversed version
-field, if enabled.  If disabled, the
-.Nm
-accepts the correct packets only.  This flag is enabled by default.
-.It send_rev_ethip_ver
-sends EtherIP packets with reversed version field intentionally, if
-enabled.  If disabled, the
-.Nm
-sends the correct packets only.  This flag is disabled by default.
-.El
-.Pp
-If interoperability with the older
-.Fx
-machines is needed, both of these two flags must be enabled.

Modified: stable/10/sys/net/if_gif.c
==
--- stable/10/sys/net/if_gif.c  Sun Sep 13 01:31:17 2015(r287729)
+++ stable/10/sys/net/if_gif.c  Sun Sep 13 01:35:40 2015(r287730)
@@ -419,13 +419,8 @@ gif_transmit(struct ifnet *ifp, struct m
}
eth = mtod(m, struct etherip_header *);
eth->eip_resvh = 0;
-   if ((sc->gif_options & GIF_SEND_REVETHIP) != 0) {
-   eth->eip_ver = 0;
-   eth->eip_resvl = ETHERIP_VERSION;
-   } else {
-   eth->eip_ver = ETHERIP_VERSION;
-   eth->eip_resvl = 0;
-   }
+   eth->eip_ver = ETHERIP_VERSION;
+   eth->eip_resvl = 0;
break;
default:
error = EAFNOSUPPORT;
@@ -633,19 +628,10 @@ gif_input(struct mbuf *m, struct ifnet *
if (m == NULL)
goto drop;
eip = mtod(m, struct etherip_header *);
-   /*
-* GIF_ACCEPT_REVETHIP (enabled by default) intentionally
-* accepts an EtherIP packet with revered version field in
-* the header.  This is a knob for backward compatibility
-* with FreeBSD 7.2R or prior.
-*/
if (eip->eip_ver != ETHERIP_VERSION) {
-   if ((gif_opti

svn commit: r287731 - stable/10/sys/netinet6

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 01:39:37 2015
New Revision: 287731
URL: https://svnweb.freebsd.org/changeset/base/287731

Log:
  MFC 287608:
  
  Remove IN6_IFF_NOPFX.  This flag was no longer used.

Modified:
  stable/10/sys/netinet6/in6_ifattach.c
  stable/10/sys/netinet6/in6_var.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet6/in6_ifattach.c
==
--- stable/10/sys/netinet6/in6_ifattach.c   Sun Sep 13 01:35:40 2015
(r287730)
+++ stable/10/sys/netinet6/in6_ifattach.c   Sun Sep 13 01:39:37 2015
(r287731)
@@ -598,9 +598,6 @@ in6_ifattach_loopback(struct ifnet *ifp)
/* we don't need to perform DAD on loopback interfaces. */
ifra.ifra_flags |= IN6_IFF_NODAD;
 
-   /* skip registration to the prefix list. XXX should be temporary. */
-   ifra.ifra_flags |= IN6_IFF_NOPFX;
-
/*
 * We are sure that this is a newly assigned address, so we can set
 * NULL to the 3rd arg.

Modified: stable/10/sys/netinet6/in6_var.h
==
--- stable/10/sys/netinet6/in6_var.hSun Sep 13 01:35:40 2015
(r287730)
+++ stable/10/sys/netinet6/in6_var.hSun Sep 13 01:39:37 2015
(r287731)
@@ -504,9 +504,6 @@ struct  in6_rrenumreq {
 #define IN6_IFF_AUTOCONF   0x40/* autoconfigurable address. */
 #define IN6_IFF_TEMPORARY  0x80/* temporary (anonymous) address. */
 #defineIN6_IFF_PREFER_SOURCE   0x0100  /* preferred address for SAS */
-#define IN6_IFF_NOPFX  0x8000  /* skip kernel prefix management.
-* XXX: this should be temporary.
-*/
 
 /* do not input/output */
 #define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r287732 - stable/10/sys/netinet6

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 01:44:30 2015
New Revision: 287732
URL: https://svnweb.freebsd.org/changeset/base/287732

Log:
  MFC 287609:
  
  Do not add IN6_IFF_TENTATIVE when ND6_IFF_NO_DAD.

Modified:
  stable/10/sys/netinet6/in6.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet6/in6.c
==
--- stable/10/sys/netinet6/in6.cSun Sep 13 01:39:37 2015
(r287731)
+++ stable/10/sys/netinet6/in6.cSun Sep 13 01:44:30 2015
(r287732)
@@ -1254,11 +1254,13 @@ in6_update_ifa(struct ifnet *ifp, struct
 * source address.
 */
ia->ia6_flags &= ~IN6_IFF_DUPLICATED;   /* safety */
-   if (hostIsNew && in6if_do_dad(ifp))
-   ia->ia6_flags |= IN6_IFF_TENTATIVE;
 
-   /* DAD should be performed after ND6_IFF_IFDISABLED is cleared. */
-   if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)
+   /*
+* DAD should be performed for an new address or addresses on
+* an interface with ND6_IFF_IFDISABLED.
+*/
+   if (in6if_do_dad(ifp) &&
+   (hostIsNew || (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)))
ia->ia6_flags |= IN6_IFF_TENTATIVE;
 
/*
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r287733 - in stable/10: sys/netinet6 usr.sbin/ndp

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 01:59:50 2015
New Revision: 287733
URL: https://svnweb.freebsd.org/changeset/base/287733

Log:
  MFC 287095, 287610, 287611, 287617:
  
  Remove obsolete API (SIOCGDRLST_IN6 and SIOCGPRLST_IN6) support.

Modified:
  stable/10/sys/netinet6/in6.c
  stable/10/sys/netinet6/in6_var.h
  stable/10/sys/netinet6/nd6.c
  stable/10/usr.sbin/ndp/ndp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet6/in6.c
==
--- stable/10/sys/netinet6/in6.cSun Sep 13 01:44:30 2015
(r287732)
+++ stable/10/sys/netinet6/in6.cSun Sep 13 01:59:50 2015
(r287733)
@@ -323,8 +323,6 @@ in6_control(struct socket *so, u_long cm
/* FALLTHROUGH */
case OSIOCGIFINFO_IN6:
case SIOCGIFINFO_IN6:
-   case SIOCGDRLST_IN6:
-   case SIOCGPRLST_IN6:
case SIOCGNBRINFO_IN6:
case SIOCGDEFIFACE_IN6:
return (nd6_ioctl(cmd, data, ifp));

Modified: stable/10/sys/netinet6/in6_var.h
==
--- stable/10/sys/netinet6/in6_var.hSun Sep 13 01:44:30 2015
(r287732)
+++ stable/10/sys/netinet6/in6_var.hSun Sep 13 01:59:50 2015
(r287733)
@@ -447,11 +447,6 @@ struct in6_rrenumreq {
 
 #define SIOCGIFAFLAG_IN6   _IOWR('i', 73, struct in6_ifreq)
 
-#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist)
-#ifdef _KERNEL
-/* XXX: SIOCGPRLST_IN6 is exposed in KAME but in6_oprlist is not. */
-#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_oprlist)
-#endif
 #ifdef _KERNEL
 #define OSIOCGIFINFO_IN6   _IOWR('i', 76, struct in6_ondireq)
 #endif

Modified: stable/10/sys/netinet6/nd6.c
==
--- stable/10/sys/netinet6/nd6.cSun Sep 13 01:44:30 2015
(r287732)
+++ stable/10/sys/netinet6/nd6.cSun Sep 13 01:59:50 2015
(r287733)
@@ -1246,99 +1246,14 @@ nd6_rtrequest(int req, struct rtentry *r
 int
 nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
 {
-   struct in6_drlist *drl = (struct in6_drlist *)data;
-   struct in6_oprlist *oprl = (struct in6_oprlist *)data;
struct in6_ndireq *ndi = (struct in6_ndireq *)data;
struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data;
struct in6_ndifreq *ndif = (struct in6_ndifreq *)data;
-   struct nd_defrouter *dr;
-   struct nd_prefix *pr;
-   int i = 0, error = 0;
+   int error = 0;
 
if (ifp->if_afdata[AF_INET6] == NULL)
return (EPFNOSUPPORT);
switch (cmd) {
-   case SIOCGDRLST_IN6:
-   /*
-* obsolete API, use sysctl under net.inet6.icmp6
-*/
-   bzero(drl, sizeof(*drl));
-   TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) {
-   if (i >= DRLSTSIZ)
-   break;
-   drl->defrouter[i].rtaddr = dr->rtaddr;
-   in6_clearscope(&drl->defrouter[i].rtaddr);
-
-   drl->defrouter[i].flags = dr->flags;
-   drl->defrouter[i].rtlifetime = dr->rtlifetime;
-   drl->defrouter[i].expire = dr->expire +
-   (time_second - time_uptime);
-   drl->defrouter[i].if_index = dr->ifp->if_index;
-   i++;
-   }
-   break;
-   case SIOCGPRLST_IN6:
-   /*
-* obsolete API, use sysctl under net.inet6.icmp6
-*
-* XXX the structure in6_prlist was changed in backward-
-* incompatible manner.  in6_oprlist is used for SIOCGPRLST_IN6,
-* in6_prlist is used for nd6_sysctl() - fill_prlist().
-*/
-   /*
-* XXX meaning of fields, especialy "raflags", is very
-* differnet between RA prefix list and RR/static prefix list.
-* how about separating ioctls into two?
-*/
-   bzero(oprl, sizeof(*oprl));
-   LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) {
-   struct nd_pfxrouter *pfr;
-   int j;
-
-   if (i >= PRLSTSIZ)
-   break;
-   oprl->prefix[i].prefix = pr->ndpr_prefix.sin6_addr;
-   oprl->prefix[i].raflags = pr->ndpr_raf;
-   oprl->prefix[i].prefixlen = pr->ndpr_plen;
-   oprl->prefix[i].vltime = pr->ndpr_vltime;
-   oprl->prefix[i].pltime = pr->ndpr_pltime;
-   oprl->prefix[i].if_index = pr->ndpr_ifp->if_index;
-   if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME)
-   oprl->prefix[i].expire = 0;
- 

svn commit: r287734 - stable/10/sys/netinet6

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 02:09:06 2015
New Revision: 287734
URL: https://svnweb.freebsd.org/changeset/base/287734

Log:
  MFC 287094:
  
  - Deprecate IN6_IFF_NODAD.  It was used to prevent DAD on a loopback
interface but in6if_do_dad() already had a check for IFF_LOOPBACK.
  
  - Remove in6if_do_dad() check in in6_broadcast_ifa().  An address
which needs DAD always has IN6_IFF_TENTATIVE there.
  
  - in6if_do_dad() now returns EAGAIN when the interface is not ready
since DAD callout handler ignores such an interface.
  
  - In DAD callout handler, mark an address as IN6_IFF_TENTATIVE
when the interface has ND6_IFF_IFDISABLED.  And Do IFF_UP and
IFF_DRV_RUNNING check consistently when DAD is required.
  
  - draft-ietf-6man-enhanced-dad is now published as RFC 7527.
  
  - Fix some typos.

Modified:
  stable/10/sys/netinet6/in6.c
  stable/10/sys/netinet6/in6_ifattach.c
  stable/10/sys/netinet6/in6_var.h
  stable/10/sys/netinet6/nd6_nbr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet6/in6.c
==
--- stable/10/sys/netinet6/in6.cSun Sep 13 01:59:50 2015
(r287733)
+++ stable/10/sys/netinet6/in6.cSun Sep 13 02:09:06 2015
(r287734)
@@ -1280,13 +1280,8 @@ in6_update_ifa(struct ifnet *ifp, struct
goto cleanup;
}
 
-   /*
-* Perform DAD, if needed.
-* XXX It may be of use, if we can administratively disable DAD.
-*/
-   if (in6if_do_dad(ifp) && ((ifra->ifra_flags & IN6_IFF_NODAD) == 0) &&
-   (ia->ia6_flags & IN6_IFF_TENTATIVE))
-   {
+   /* Perform DAD, if the address is TENTATIVE. */
+   if ((ia->ia6_flags & IN6_IFF_TENTATIVE)) {
int mindelay, maxdelay;
 
delay = 0;
@@ -1619,6 +1614,10 @@ in6_purgeif(struct ifnet *ifp)
  * in the future.
  * RFC2373 defines interface id to be 64bit, but it allows non-RFC2374
  * address encoding scheme. (see figure on page 8)
+ * Notifies other subsystems about address change/arrival:
+ * 1) Notifies device handler on the first IPv6 address assignment
+ * 2) Handle routing table changes for P2P links and route
+ * 3) Handle routing table changes for address host route
  */
 static int
 in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data,
@@ -2389,13 +2388,13 @@ in6if_do_dad(struct ifnet *ifp)
 * However, some interfaces can be up before the RUNNING
 * status.  Additionaly, users may try to assign addresses
 * before the interface becomes up (or running).
-* We simply skip DAD in such a case as a work around.
-* XXX: we should rather mark "tentative" on such addresses,
-* and do DAD after the interface becomes ready.
+* This function returns EAGAIN in that case.
+* The caller should mark "tentative" on the address instead of
+* performing DAD immediately.
 */
if (!((ifp->if_flags & IFF_UP) &&
(ifp->if_drv_flags & IFF_DRV_RUNNING)))
-   return (0);
+   return (EAGAIN);
 
return (1);
}

Modified: stable/10/sys/netinet6/in6_ifattach.c
==
--- stable/10/sys/netinet6/in6_ifattach.c   Sun Sep 13 01:59:50 2015
(r287733)
+++ stable/10/sys/netinet6/in6_ifattach.c   Sun Sep 13 02:09:06 2015
(r287734)
@@ -595,9 +595,6 @@ in6_ifattach_loopback(struct ifnet *ifp)
ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;
ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
 
-   /* we don't need to perform DAD on loopback interfaces. */
-   ifra.ifra_flags |= IN6_IFF_NODAD;
-
/*
 * We are sure that this is a newly assigned address, so we can set
 * NULL to the 3rd arg.

Modified: stable/10/sys/netinet6/in6_var.h
==
--- stable/10/sys/netinet6/in6_var.hSun Sep 13 01:59:50 2015
(r287733)
+++ stable/10/sys/netinet6/in6_var.hSun Sep 13 02:09:06 2015
(r287734)
@@ -494,7 +494,7 @@ struct  in6_rrenumreq {
 #define IN6_IFF_DETACHED   0x08/* may be detached from the link */
 #define IN6_IFF_DEPRECATED 0x10/* deprecated address */
 #define IN6_IFF_NODAD  0x20/* don't perform DAD on this address
-* (used only at first SIOC* call)
+* (obsolete)
 */
 #define IN6_IFF_AUTOCONF   0x40/* autoconfigurable address. */
 #define IN6_IFF_TEMPORARY  0x80/* temporary (anonymous) address. */

Modified: stable/10/sys/netinet6/nd6_nbr.c

svn commit: r287735 - stable/10/usr.sbin/ndp

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 03:09:21 2015
New Revision: 287735
URL: https://svnweb.freebsd.org/changeset/base/287735

Log:
  MFC 259169, 259176, 287097:
  
  - Ansify function definitions.
  
  - Change the type of addr argument in dump() function to be able
disambiguate link-local addresses from different zones.
  
  - Add static and remove unused variables.

Modified:
  stable/10/usr.sbin/ndp/ndp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ndp/ndp.c
==
--- stable/10/usr.sbin/ndp/ndp.cSun Sep 13 02:09:06 2015
(r287734)
+++ stable/10/usr.sbin/ndp/ndp.cSun Sep 13 03:09:21 2015
(r287735)
@@ -127,28 +127,26 @@ static int32_t thiszone;  /* time differe
 static int s = -1;
 static int repeat = 0;
 
-char ntop_buf[INET6_ADDRSTRLEN];   /* inet_ntop() */
-char host_buf[NI_MAXHOST]; /* getnameinfo() */
-char ifix_buf[IFNAMSIZ];   /* if_indextoname() */
+static char host_buf[NI_MAXHOST];  /* getnameinfo() */
+static char ifix_buf[IFNAMSIZ];/* if_indextoname() */
 
-int main(int, char **);
 static int file(char *);
-void getsocket(void);
-int set(int, char **);
-void get(char *);
-int delete(char *);
-void dump(struct in6_addr *, int);
+static void getsocket(void);
+static int set(int, char **);
+static void get(char *);
+static int delete(char *);
+static void dump(struct sockaddr_in6 *, int);
 static struct in6_nbrinfo *getnbrinfo(struct in6_addr *, int, int);
 static char *ether_str(struct sockaddr_dl *);
-int ndp_ether_aton(char *, u_char *);
-void usage(void);
-int rtmsg(int);
-void ifinfo(char *, int, char **);
-void rtrlist(void);
-void plist(void);
-void pfx_flush(void);
-void rtr_flush(void);
-void harmonize_rtr(void);
+static int ndp_ether_aton(char *, u_char *);
+static void usage(void);
+static int rtmsg(int);
+static void ifinfo(char *, int, char **);
+static void rtrlist(void);
+static void plist(void);
+static void pfx_flush(void);
+static void rtr_flush(void);
+static void harmonize_rtr(void);
 #ifdef SIOCSDEFIFACE_IN6   /* XXX: check SIOCGDEFIFACE_IN6 as well? */
 static void getdefif(void);
 static void setdefif(char *);
@@ -163,15 +161,11 @@ static char *rtpref_str[] = {
"low"   /* 11 */
 };
 
-int mode = 0;
-char *arg = NULL;
-
 int
-main(argc, argv)
-   int argc;
-   char **argv;
+main(int argc, char **argv)
 {
-   int ch;
+   int ch, mode = 0;
+   char *arg = NULL;
 
pid = getpid();
thiszone = gmt2local(0);
@@ -320,8 +314,7 @@ main(argc, argv)
  * Process a file to set standard ndp entries
  */
 static int
-file(name)
-   char *name;
+file(char *name)
 {
FILE *fp;
int i, retval;
@@ -355,7 +348,7 @@ file(name)
return (retval);
 }
 
-void
+static void
 getsocket()
 {
if (s < 0) {
@@ -367,23 +360,32 @@ getsocket()
}
 }
 
-struct sockaddr_in6 so_mask = {sizeof(so_mask), AF_INET6 };
-struct sockaddr_in6 blank_sin = {sizeof(blank_sin), AF_INET6 }, sin_m;
-struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m;
-time_t expire_time;
-intflags, found_entry;
-struct {
+static struct sockaddr_in6 so_mask = {
+   .sin6_len = sizeof(so_mask),
+   .sin6_family = AF_INET6
+};
+static struct sockaddr_in6 blank_sin = {
+   .sin6_len = sizeof(blank_sin),
+   .sin6_family = AF_INET6
+};
+static struct sockaddr_in6 sin_m;
+static struct sockaddr_dl blank_sdl = {
+   .sdl_len = sizeof(blank_sdl),
+   .sdl_family = AF_LINK
+};
+static struct sockaddr_dl sdl_m;
+static time_t expire_time;
+static int flags, found_entry;
+static struct {
struct  rt_msghdr m_rtm;
charm_space[512];
-}  m_rtmsg;
+} m_rtmsg;
 
 /*
  * Set an individual neighbor cache entry
  */
-int
-set(argc, argv)
-   int argc;
-   char **argv;
+static int
+set(int argc, char **argv)
 {
register struct sockaddr_in6 *sin = &sin_m;
register struct sockaddr_dl *sdl;
@@ -457,9 +459,8 @@ overwrite:
 /*
  * Display an individual neighbor cache entry
  */
-void
-get(host)
-   char *host;
+static void
+get(char *host)
 {
struct sockaddr_in6 *sin = &sin_m;
struct addrinfo hints, *res;
@@ -475,7 +476,9 @@ get(host)
return;
}
sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr;
-   dump(&sin->sin6_addr, 0);
+   sin->sin6_scope_id =
+   ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id;
+   dump(sin, 0);
if (found_entry == 0) {
getnameinfo((struct sockaddr *)sin, sin->sin6_len, host_buf,
sizeof(host_buf), NULL ,0,
@@ -488,9 +491,8 @@ get(host)
 /*
  * Delete a neighbor cache entry
  */
-int
-delete(host)
-   char *host;
+static int
+delete(char *host)
 {
struct sockaddr_in6 *sin = &sin_m;
register struct rt_msghdr *rtm = &m_

svn commit: r287736 - stable/10/lib/libc/net

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 03:15:37 2015
New Revision: 287736
URL: https://svnweb.freebsd.org/changeset/base/287736

Log:
  MFC 287349,287404:
  
  - Print sdl->sdl_data when sdl->sdl_nlen > 0 && sdl->sdl_alen == 0
as link_ntoa(3) does.
  
  - snprintf() returns at most size-1 of the chars printed into
the buffer.  (n == hostlen) also means the buffer length was
too short.

Modified:
  stable/10/lib/libc/net/getnameinfo.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/net/getnameinfo.c
==
--- stable/10/lib/libc/net/getnameinfo.cSun Sep 13 03:09:21 2015
(r287735)
+++ stable/10/lib/libc/net/getnameinfo.cSun Sep 13 03:15:37 2015
(r287736)
@@ -390,11 +390,22 @@ getnameinfo_link(const struct sockaddr *
 
if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 && sdl->sdl_slen == 0) {
n = snprintf(host, hostlen, "link#%d", sdl->sdl_index);
-   if (n > hostlen) {
+   if (n >= hostlen) {
*host = '\0';
-   return EAI_MEMORY;
+   return (EAI_MEMORY);
+   }
+   return (0);
+   }
+
+   if (sdl->sdl_nlen > 0 && sdl->sdl_alen == 0) {
+   n = sdl->sdl_nlen;
+   if (n >= hostlen) {
+   *host = '\0';
+   return (EAI_MEMORY);
}
-   return 0;
+   memcpy(host, sdl->sdl_data, sdl->sdl_nlen);
+   host[n] = '\0';
+   return (0);
}
 
switch (sdl->sdl_type) {
@@ -437,10 +448,7 @@ getnameinfo_link(const struct sockaddr *
 }
 
 static int
-hexname(cp, len, host, hostlen)
-   const u_int8_t *cp;
-   char *host;
-   size_t len, hostlen;
+hexname(const u_int8_t *cp, size_t len, char *host, size_t hostlen)
 {
int i, n;
char *outp = host;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r287737 - stable/10/etc/rc.d

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 03:59:29 2015
New Revision: 287737
URL: https://svnweb.freebsd.org/changeset/base/287737

Log:
  MFC 287613:
  
  Update only static routes when an interface is specified.  This fixed
  a bad side-effect reported in PR 202144.
  
  PR:   202144

Modified:
  stable/10/etc/rc.d/netif
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/netif
==
--- stable/10/etc/rc.d/netifSun Sep 13 03:15:37 2015(r287736)
+++ stable/10/etc/rc.d/netifSun Sep 13 03:59:29 2015(r287737)
@@ -85,7 +85,7 @@ network_start()
fi
if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then
for _if in $cmdifn; do
-   /etc/rc.d/routing start any $_if
+   /etc/rc.d/routing static any $_if
done
fi
 }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r287738 - stable/10/etc/rc.d

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 04:02:52 2015
New Revision: 287738
URL: https://svnweb.freebsd.org/changeset/base/287738

Log:
  MFC 287614:
  
  - Add uid check.
  - Report delay<0 as a warning.

Modified:
  stable/10/etc/rc.d/bgfsck
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/bgfsck
==
--- stable/10/etc/rc.d/bgfsck   Sun Sep 13 03:59:29 2015(r287737)
+++ stable/10/etc/rc.d/bgfsck   Sun Sep 13 04:02:52 2015(r287738)
@@ -12,17 +12,24 @@
 name="background-fsck"
 rcvar="background_fsck"
 start_cmd="bgfsck_start"
+start_precmd="bgfsck_start_precmd"
 stop_cmd=":"
 
+bgfsck_start_precmd()
+{
+   if [ $($ID -u) != 0 ]; then
+   err 1 "Must be root."
+   fi
+}
+
 bgfsck_start()
 {
-   if [ -z "${rc_force}" ]; then
-   background_fsck_delay=${background_fsck_delay:-0}
-   else
+   : ${background_fsck_delay=0}
+   if [ -n "${rc_force}" ]; then
background_fsck_delay=0
fi
if [ ${background_fsck_delay} -lt 0 ]; then
-   echo "Background file system checks delayed indefinitely"
+   warn "Background file system checks delayed indefinitely"
return 0
fi
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r287739 - stable/10/etc/rc.d

2015-09-12 Thread Hiroki Sato
Author: hrs
Date: Sun Sep 13 04:05:27 2015
New Revision: 287739
URL: https://svnweb.freebsd.org/changeset/base/287739

Log:
  MFC 287615:
  
  Use read to parse a line instead of set.

Modified:
  stable/10/etc/rc.d/jail
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/jail
==
--- stable/10/etc/rc.d/jail Sun Sep 13 04:02:52 2015(r287738)
+++ stable/10/etc/rc.d/jail Sun Sep 13 04:05:27 2015(r287739)
@@ -419,7 +419,7 @@ jail_status()
 
 jail_start()
 {
-   local _j _jid _jl
+   local _j _jid _jl _id _name
 
if [ $# = 0 ]; then
return
@@ -432,10 +432,9 @@ jail_start()
command_args="-f $jail_conf -c"
_tmp=`mktemp -t jail` || exit 3
if $command $rc_flags $command_args >> $_tmp 2>&1; then
-   $jail_jls jid name | while read IN; do
-   set -- $IN
-   echo -n " $2"
-   echo $1 > /var/run/jail_$2.id
+   $jail_jls jid name | while read _id _name; do
+   echo -n " $_name"
+   echo $_id > /var/run/jail_${_name}.id
done
else
tail -1 $_tmp
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"