svn commit: r308717 - stable/10/usr.sbin/rtadvd

2016-11-15 Thread Hiroki Sato
Author: hrs
Date: Wed Nov 16 03:54:41 2016
New Revision: 308717
URL: https://svnweb.freebsd.org/changeset/base/308717

Log:
  MFC r308348:
  
Add link-layer address option in RA even for IFT_L2VLAN and IFT_BRIDGE.
  
Reported by:  philip

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

Modified: stable/10/usr.sbin/rtadvd/if.c
==
--- stable/10/usr.sbin/rtadvd/if.c  Wed Nov 16 03:54:30 2016
(r308716)
+++ stable/10/usr.sbin/rtadvd/if.c  Wed Nov 16 03:54:41 2016
(r308717)
@@ -115,6 +115,8 @@ lladdropt_length(struct sockaddr_dl *sdl
 {
switch (sdl->sdl_type) {
case IFT_ETHER:
+   case IFT_L2VLAN:
+   case IFT_BRIDGE:
return (ROUNDUP8(ETHER_ADDR_LEN + 2));
default:
return (0);
@@ -130,6 +132,8 @@ lladdropt_fill(struct sockaddr_dl *sdl, 
 
switch (sdl->sdl_type) {
case IFT_ETHER:
+   case IFT_L2VLAN:
+   case IFT_BRIDGE:
ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3;
addr = (char *)(ndopt + 1);
memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN);
___
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: r308715 - stable/10/usr.sbin/traceroute6

2016-11-15 Thread Hiroki Sato
Author: hrs
Date: Wed Nov 16 03:51:15 2016
New Revision: 308715
URL: https://svnweb.freebsd.org/changeset/base/308715

Log:
  MFC r308347:
  
Fix an infinite loop at an non-responding hop when other echo replies
are kept arriving in the waittime time window.
  
Submitted by: Denny Page
PR:   210286

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

Modified: stable/10/usr.sbin/traceroute6/traceroute6.c
==
--- stable/10/usr.sbin/traceroute6/traceroute6.cWed Nov 16 03:51:05 
2016(r308714)
+++ stable/10/usr.sbin/traceroute6/traceroute6.cWed Nov 16 03:51:15 
2016(r308715)
@@ -955,6 +955,9 @@ main(argc, argv)
break;
}
break;
+   } else if (deltaT(, ) > waittime * 1000) {
+   cc = 0;
+   break;
}
}
if (cc == 0)
___
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: r296451 - stable/10/release/doc/share/xml

2016-03-07 Thread Hiroki Sato
Author: hrs
Date: Mon Mar  7 10:59:28 2016
New Revision: 296451
URL: https://svnweb.freebsd.org/changeset/base/296451

Log:
  Trim old entries.

Modified:
  stable/10/release/doc/share/xml/errata.xml
  stable/10/release/doc/share/xml/security.xml

Modified: stable/10/release/doc/share/xml/errata.xml
==
--- stable/10/release/doc/share/xml/errata.xml  Mon Mar  7 10:56:38 2016
(r296450)
+++ stable/10/release/doc/share/xml/errata.xml  Mon Mar  7 10:59:28 2016
(r296451)
@@ -19,98 +19,7 @@
 
 
   
-   FreeBSD-EN-15:11.toolchain
-   18August2015
-   Fix  syntax errors when upgrading
-   from 9.x and earlier.
-  
-
-  
-   FreeBSD-EN-15:12.netstat
-   18August2015
-   Fix incorrect  data handling on
-   32-bit systems.
-  
-
-  
-   FreeBSD-EN-15:13.vidcontrol
-   18August2015
-   Allow size argument to  for
-   .
-  
-
-  
-   FreeBSD-EN-15:15.pkg
-   25August2015
-   Insufficient check of supported 
- signature methods.
-  
-
-  
-   FreeBSD-EN-15:16.pw
-   16September2015
-   Fix  regression when creating numeric
-   users or groups.
-  
-
-  
-   FreeBSD-EN-15:17.libc
-   16September2015
-   Fix libc handling of signals for multi-threaded
-   processes.
-  
-
-  
-   FreeBSD-EN-15:18.pkg
-   16September2015
-   Implement pubkey support for
-bootstrap.
-  
-
-  
-   FreeBSD-EN-15:19.kqueue
-   4November2015
-write events never fire for files
-   larger than 2GB.
-  
-
-  
-   FreeBSD-EN-15:20.vm
-   4November2015
-   Applications exiting due to segmentation
-   violation on a correct memory address.
-  
-
-  
-   FreeBSD-EN-16:01.filemon
-   14January2016
-   bmake and
-stability issues.
-  
-
-  
-   FreeBSD-EN-16:02.pf
-   14January2016
-   Invalid TCP checksum issue.
-  
-
-  
-   FreeBSD-EN-16:03.yplib
-   14January2016
-   YP/NIS library
-   bug.
+   
   
 
   

Modified: stable/10/release/doc/share/xml/security.xml
==
--- stable/10/release/doc/share/xml/security.xmlMon Mar  7 10:56:38 
2016(r296450)
+++ stable/10/release/doc/share/xml/security.xmlMon Mar  7 10:59:28 
2016(r296451)
@@ -19,116 +19,7 @@
 
 
   
-   FreeBSD-SA-15:20.expat
-   18August2015
-   Fix multiple integer overflows in
-   .
-  
-
-  
-   FreeBSD-SA-15:22.openssh
-   25August2015
-   Multiple vulnerabilities
-  
-
-  
-   FreeBSD-SA-15:24.rpcbind
-   29September2015
-   Remote denial of service
-  
-
-  
-   FreeBSD-SA-15:25.ntp
-   26October2015
-   Multiple vulnerabilities
-  
-
-  
-   FreeBSD-SA-15:26.openssl
-   5December2015
-   Multiple vulnerabilities
-  
-
-  
-   FreeBSD-SA-16:01.sctp
-   14January2016
-   ICMPv6 error message vulnerability
-  
-
-  
-   FreeBSD-SA-16:02.ntp
-   14January2016
-   Panic threshold bypass
-   vulnerability
-  
-
-  
-   FreeBSD-SA-16:03.linux
-   14January2016
-   Incorrect futex
-   handling
-  
-
-  
-   FreeBSD-SA-16:04.linux
-   14January2016
-system call
-   vulnerability
-  
-
-  
-   FreeBSD-SA-16:05.tcp
-   14January2016
-   MD5 signature denial of service
-  
-
-  
-   FreeBSD-SA-16:06.bsnmpd
-   14January2016
-   Insecure default configuration file
- permissions
-  
-
-  
-   FreeBSD-SA-16:07.openssh
-   14January2016
-   OpenSSH client
-   information leak
-  
-
-  
-   FreeBSD-SA-16:09.ntp
-   27January2016
-   Multiple vulnerabilities.
-  
-
-  
-   FreeBSD-SA-16:10.linux
-   27January2016
-system call
-   vulnerability.
-  
-
-  
-   FreeBSD-SA-16:11.openssl
-   30January2016
-   SSLv2 cipher suite downgrade
-   vulnerability.
+   
   
 
   
___
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: r296450 - in stable/10/release/doc: en_US.ISO8859-1/errata en_US.ISO8859-1/hardware en_US.ISO8859-1/readme en_US.ISO8859-1/relnotes share/xml

2016-03-07 Thread Hiroki Sato
Author: hrs
Date: Mon Mar  7 10:56:38 2016
New Revision: 296450
URL: https://svnweb.freebsd.org/changeset/base/296450

Log:
  - Use FPI and catalog resolution instead of system entities.  This change
fixes build with a non-standard DOC_PREFIX, but it is still a temporal
measure because some of them should be done by using XInclude,
not by entity reference.
  
  - Trim old entries and bump version numbers.

Modified:
  stable/10/release/doc/en_US.ISO8859-1/errata/article.xml
  stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml
  stable/10/release/doc/en_US.ISO8859-1/readme/article.xml
  stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
  stable/10/release/doc/share/xml/catalog.xml
  stable/10/release/doc/share/xml/release.ent

Modified: stable/10/release/doc/en_US.ISO8859-1/errata/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/errata/article.xmlMon Mar  7 
10:56:21 2016(r296449)
+++ stable/10/release/doc/en_US.ISO8859-1/errata/article.xmlMon Mar  7 
10:56:38 2016(r296450)
@@ -4,8 +4,10 @@
 http://www.FreeBSD.org/release/XML/release.ent;>
 %release;
-
-
+http://www.FreeBSD.org/release/XML/share/xml/security.xml;>
+http://www.FreeBSD.org/release/XML/share/xml/errata.xml;>
 ]>
 
 http://docbook.org/ns/docbook;

Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml  Mon Mar  7 
10:56:21 2016(r296449)
+++ stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml  Mon Mar  7 
10:56:38 2016(r296450)
@@ -1,6 +1,6 @@
 
 http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd; [
 
 %release;
 

Modified: stable/10/release/doc/en_US.ISO8859-1/readme/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/readme/article.xmlMon Mar  7 
10:56:21 2016(r296449)
+++ stable/10/release/doc/en_US.ISO8859-1/readme/article.xmlMon Mar  7 
10:56:38 2016(r296450)
@@ -1,6 +1,6 @@
 
 http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd; [
 
  %release;
 ]>

Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Mon Mar  7 
10:56:21 2016(r296449)
+++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml  Mon Mar  7 
10:56:38 2016(r296450)
@@ -1,14 +1,19 @@
 
 
+ "http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd; [
+http://www.FreeBSD.org/release/XML/share/xml/release.ent;>
  %release;
-
+http://www.FreeBSD.org/release/XML/share/xml/sponsor.ent;>
  %sponsor;
-
+http://www.FreeBSD.org/release/XML/share/xml/vendor.ent;>
  %vendor;
-
-
+http://www.FreeBSD.org/release/XML/share/xml/security.xml;>
+http://www.FreeBSD.org/release/XML/share/xml/errata.xml;>
 ]>
 http://docbook.org/ns/docbook;
   xmlns:xlink="http://www.w3.org/1999/xlink; version="5.0">
@@ -26,7 +31,7 @@
 
 
 
-  2015
+  2016
   mailto:d...@freebsd.org;>The  Documentation
Project
 
@@ -166,42 +171,13 @@
 
   Userland Application Changes
 
-  The  utility has been
-   updated to include a new flag, -l, which
-   ensures a clean environment in the target jail when used.
-   Additionally,  will run a shell within the target
-   jail when run no commands are specified.
-
-  The  utility has been
-   updated to include support for NTFS
-   filesystems in both MBR and
-   GPT partitioning schemes.
-
-  The
-utility now enables deterministic mode
-   (-D) by default.  This behavior can be
-   disabled by specifying the -U flag.
-
-  The  utility has been
-   updated to use the PCI ID database from the misc/pciids package, if present,
-   falling back to the PCI ID database in the  base
-   system.
-
-  A
-   new utility, , has been added, which is used
-   to manage  devices.
+  
 
 
 
   Contributed Software
 
-  The  library has been
-   updated to properly skip a sparse file entry in a 
-   file, which would previously produce errors.
-
-  Timezone data files have been updated to
-   version 2015f.
+  
 
 
 
@@ -247,10 +223,7 @@
 
   Kernel Bug Fixes
 
-  The  system call has been
-   updated to handle write events to files larger than 2
-   gigabytes.
+  
 
 
 
@@ -262,10 +235,7 @@
 
   System Tuning and Controls
 
-  The  driver has been
-   updated to allow tuning pulses per second captured in the
-   CTS line during runtime, whereas previously only the DCD line
-   could be used without rebuilding the kernel.
+  
 
   
 
@@ -284,12 +254,7 @@
 
   

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

2015-11-03 Thread Hiroki Sato
Author: hrs
Date: Wed Nov  4 01:00:42 2015
New Revision: 290348
URL: https://svnweb.freebsd.org/changeset/base/290348

Log:
  MFC r288600:
  
- Schedule DAD for IN6_IFF_TENTATIVE addresses in nd6_timer().  This
  catches cases that DAD probes cannot be sent because of
  IFF_UP && !IFF_DRV_RUNNING.
  
- nd6_dad_starttimer() now calls nd6_dad_ns_output(), instead of
  calling it before nd6_dad_starttimer().
  
- Do not release an entry in dadq when a duplicate entry is being
  added.

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

Modified: stable/10/sys/netinet6/nd6.c
==
--- stable/10/sys/netinet6/nd6.cWed Nov  4 00:21:02 2015
(r290347)
+++ stable/10/sys/netinet6/nd6.cWed Nov  4 01:00:42 2015
(r290348)
@@ -687,8 +687,31 @@ nd6_timer(void *arg)
goto addrloop;
}
}
+   } else if ((ia6->ia6_flags & IN6_IFF_TENTATIVE) != 0) {
+   /*
+* Schedule DAD for a tentative address.  This happens
+* if the interface was down or not running
+* when the address was configured.
+*/
+   int delay;
+
+   delay = arc4random() %
+   (MAX_RTR_SOLICITATION_DELAY * hz);
+   nd6_dad_start((struct ifaddr *)ia6, delay);
} else {
/*
+* Check status of the interface.  If it is down,
+* mark the address as tentative for future DAD.
+*/
+   if ((ia6->ia_ifp->if_flags & IFF_UP) == 0 ||
+   (ia6->ia_ifp->if_drv_flags & IFF_DRV_RUNNING)
+   == 0 ||
+   (ND_IFINFO(ia6->ia_ifp)->flags &
+   ND6_IFF_IFDISABLED) != 0) {
+   ia6->ia6_flags &= ~IN6_IFF_DUPLICATED;
+   ia6->ia6_flags |= IN6_IFF_TENTATIVE;
+   }
+   /*
 * A new RA might have made a deprecated address
 * preferred.
 */
@@ -1341,7 +1364,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
/* Mark all IPv6 address as tentative. */
 
ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED;
-   if ((ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) {
+   if (V_ip6_dad_count > 0 &&
+   (ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) {
IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, >if_addrhead,
ifa_link) {

Modified: stable/10/sys/netinet6/nd6_nbr.c
==
--- stable/10/sys/netinet6/nd6_nbr.cWed Nov  4 00:21:02 2015
(r290347)
+++ stable/10/sys/netinet6/nd6_nbr.cWed Nov  4 01:00:42 2015
(r290348)
@@ -86,11 +86,11 @@ static struct dadq *nd6_dad_find(struct 
 static void nd6_dad_add(struct dadq *dp);
 static void nd6_dad_del(struct dadq *dp);
 static void nd6_dad_rele(struct dadq *);
-static void nd6_dad_starttimer(struct dadq *, int);
+static void nd6_dad_starttimer(struct dadq *, int, int);
 static void nd6_dad_stoptimer(struct dadq *);
 static void nd6_dad_timer(struct dadq *);
 static void nd6_dad_duplicated(struct ifaddr *, struct dadq *);
-static void nd6_dad_ns_output(struct dadq *, struct ifaddr *);
+static void nd6_dad_ns_output(struct dadq *);
 static void nd6_dad_ns_input(struct ifaddr *, struct nd_opt_nonce *);
 static void nd6_dad_na_input(struct ifaddr *);
 static void nd6_na_output_fib(struct ifnet *, const struct in6_addr *,
@@ -1242,9 +1242,11 @@ nd6_dad_find(struct ifaddr *ifa, struct 
 }
 
 static void
-nd6_dad_starttimer(struct dadq *dp, int ticks)
+nd6_dad_starttimer(struct dadq *dp, int ticks, int send_ns)
 {
 
+   if (send_ns != 0)
+   nd6_dad_ns_output(dp);
callout_reset(>dad_timer_ch, ticks,
(void (*)(void *))nd6_dad_timer, (void *)dp);
 }
@@ -1283,6 +1285,7 @@ nd6_dad_start(struct ifaddr *ifa, int de
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
struct dadq *dp;
char ip6buf[INET6_ADDRSTRLEN];
+   int send_ns;
 
/*
 * If we don't need DAD, don't do it.
@@ -1319,8 +1322,10 @@ nd6_dad_start(struct ifaddr *ifa, int de
return;
}
if ((dp = nd6_dad_find(ifa, NULL)) != NULL) {
-   /* DAD already in progress */
-   nd6_dad_rele(dp);
+   /*
+ 

svn commit: r290347 - stable/10/sys/net

2015-11-03 Thread Hiroki Sato
Author: hrs
Date: Wed Nov  4 00:21:02 2015
New Revision: 290347
URL: https://svnweb.freebsd.org/changeset/base/290347

Log:
  MFC r288575:
  
   Add IFCAP_LINKSTATE support.

Modified:
  stable/10/sys/net/if_gif.c
  stable/10/sys/net/if_gre.c
  stable/10/sys/net/if_me.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if_gif.c
==
--- stable/10/sys/net/if_gif.c  Tue Nov  3 22:24:02 2015(r290346)
+++ stable/10/sys/net/if_gif.c  Wed Nov  4 00:21:02 2015(r290347)
@@ -196,6 +196,8 @@ gif_clone_create(struct if_clone *ifc, i
GIF2IFP(sc)->if_transmit  = gif_transmit;
GIF2IFP(sc)->if_qflush  = gif_qflush;
GIF2IFP(sc)->if_output = gif_output;
+   GIF2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE;
+   GIF2IFP(sc)->if_capenable |= IFCAP_LINKSTATE;
if_attach(GIF2IFP(sc));
bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int32_t));
if (ng_gif_attach_p != NULL)
@@ -1038,10 +1040,13 @@ gif_set_tunnel(struct ifnet *ifp, struct
 #if defined(INET) || defined(INET6)
 bad:
 #endif
-   if (error == 0 && sc->gif_family != 0)
+   if (error == 0 && sc->gif_family != 0) {
ifp->if_drv_flags |= IFF_DRV_RUNNING;
-   else
+   if_link_state_change(ifp, LINK_STATE_UP);
+   } else {
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_DOWN);
+   }
return (error);
 }
 
@@ -1063,4 +1068,5 @@ gif_delete_tunnel(struct ifnet *ifp)
free(sc->gif_hdr, M_GIF);
}
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_DOWN);
 }

Modified: stable/10/sys/net/if_gre.c
==
--- stable/10/sys/net/if_gre.c  Tue Nov  3 22:24:02 2015(r290346)
+++ stable/10/sys/net/if_gre.c  Wed Nov  4 00:21:02 2015(r290347)
@@ -179,6 +179,8 @@ gre_clone_create(struct if_clone *ifc, i
GRE2IFP(sc)->if_ioctl = gre_ioctl;
GRE2IFP(sc)->if_transmit = gre_transmit;
GRE2IFP(sc)->if_qflush = gre_qflush;
+   GRE2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE;
+   GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE;
if_attach(GRE2IFP(sc));
bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t));
GRE_LIST_LOCK();
@@ -648,8 +650,10 @@ gre_set_tunnel(struct ifnet *ifp, struct
break;
 #endif
}
-   if (error == 0)
+   if (error == 0) {
ifp->if_drv_flags |= IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_UP);
+   }
return (error);
 }
 
@@ -668,6 +672,7 @@ gre_delete_tunnel(struct ifnet *ifp)
free(sc->gre_hdr, M_GRE);
}
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_DOWN);
 }
 
 int

Modified: stable/10/sys/net/if_me.c
==
--- stable/10/sys/net/if_me.c   Tue Nov  3 22:24:02 2015(r290346)
+++ stable/10/sys/net/if_me.c   Wed Nov  4 00:21:02 2015(r290347)
@@ -193,6 +193,8 @@ me_clone_create(struct if_clone *ifc, in
ME2IFP(sc)->if_ioctl = me_ioctl;
ME2IFP(sc)->if_transmit = me_transmit;
ME2IFP(sc)->if_qflush = me_qflush;
+   ME2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE;
+   ME2IFP(sc)->if_capenable |= IFCAP_LINKSTATE;
if_attach(ME2IFP(sc));
bpfattach(ME2IFP(sc), DLT_NULL, sizeof(u_int32_t));
ME_LIST_LOCK();
@@ -377,8 +379,10 @@ me_set_tunnel(struct ifnet *ifp, struct 
if (sc->me_ecookie == NULL)
sc->me_ecookie = encap_attach_func(AF_INET, IPPROTO_MOBILE,
me_encapcheck, _mobile_protosw, sc);
-   if (sc->me_ecookie != NULL)
+   if (sc->me_ecookie != NULL) {
ifp->if_drv_flags |= IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_UP);
+   }
return (0);
 }
 
@@ -396,6 +400,7 @@ me_delete_tunnel(struct ifnet *ifp)
sc->me_dst.s_addr = 0;
ME_WUNLOCK(sc);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_DOWN);
 }
 
 static uint16_t
___
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: r288072 - stable/10/sys/net

2015-09-21 Thread Hiroki Sato
Author: hrs
Date: Mon Sep 21 18:32:43 2015
New Revision: 288072
URL: https://svnweb.freebsd.org/changeset/base/288072

Log:
  Fix a panic in SIOCSLAGG and SIOCGLAGGOPTS.  This was caused by a
  wrongly-MFC'd patch in r287723.
  
  Pointy hat to:hrs

Modified:
  stable/10/sys/net/if_lagg.c

Modified: stable/10/sys/net/if_lagg.c
==
--- stable/10/sys/net/if_lagg.c Mon Sep 21 17:31:11 2015(r288071)
+++ stable/10/sys/net/if_lagg.c Mon Sep 21 18:32:43 2015(r288072)
@@ -1063,7 +1063,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
sc->sc_detach(sc);
else
LAGG_WUNLOCK(sc);
-   }
+   } else
+   LAGG_WUNLOCK(sc);
proto->ti_attach(sc);
LAGG_WLOCK(sc);
sc->sc_proto = proto->ti_proto;
@@ -1187,9 +1188,6 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
break;
}
}
-   proto->ti_attach(sc);
-   LAGG_WLOCK(sc);
-   sc->sc_proto = proto->ti_proto;
LAGG_WUNLOCK(sc);
break;
case SIOCGLAGGFLAGS:
___
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: 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 = _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 = _m;
struct addrinfo hints, *res;
@@ -475,7 +476,9 @@ get(host)
return;
}
sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr;
-   dump(>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 = _m;
register struct rt_msghdr *rtm = _rtmsg.m_rtm;
@@ 

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"


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: 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(_cmds[i]);
af_register(_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_options & 

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: 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: 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 = [i];
-   goto found;
-   }
-   return EAI_FAMILY;
+   for (afd = [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: 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, _nd_defrouter, dr_entry) {
-   if (i >= DRLSTSIZ)
-   break;
-   drl->defrouter[i].rtaddr = dr->rtaddr;
-   in6_clearscope(>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, _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: r287594 - stable/10/sys/net

2015-09-09 Thread Hiroki Sato
Author: hrs
Date: Wed Sep  9 08:52:39 2015
New Revision: 287594
URL: https://svnweb.freebsd.org/changeset/base/287594

Log:
  MFC r272889 and r287402:
  
  - Virtualize if_epair(4).  An if_xname check for both "a" and "b" interfaces
is added to return EEXIST when only "b" interface exists---this can happen
when epairb is moved to a vnet jail and then "ifconfig epair create"
is invoked there.
  
  - Fix a panic which was reproducible by an infinite loop of
"ifconfig epair0 create && ifconfig epair0a destroy".
This was caused by an uninitialized function pointer in
softc->media.

Modified:
  stable/10/sys/net/if_epair.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if_epair.c
==
--- stable/10/sys/net/if_epair.cWed Sep  9 08:40:17 2015
(r287593)
+++ stable/10/sys/net/if_epair.cWed Sep  9 08:52:39 2015
(r287594)
@@ -100,7 +100,7 @@ static int epair_clone_destroy(struct if
 
 static const char epairname[] = "epair";
 
-/* Netisr realted definitions and sysctl. */
+/* Netisr related definitions and sysctl. */
 static struct netisr_handler epair_nh = {
.nh_name= epairname,
.nh_proto   = NETISR_EPAIR,
@@ -171,7 +171,8 @@ STAILQ_HEAD(eid_list, epair_ifp_drain);
 static MALLOC_DEFINE(M_EPAIR, epairname,
 "Pair of virtual cross-over connected Ethernet-like interfaces");
 
-static struct if_clone *epair_cloner;
+static VNET_DEFINE(struct if_clone *, epair_cloner);
+#defineV_epair_cloner  VNET(epair_cloner)
 
 /*
  * DPCPU area and functions.
@@ -759,10 +760,17 @@ epair_clone_create(struct if_clone *ifc,
ifc_free_unit(ifc, unit);
return (ENOSPC);
}
-   *dp = 'a';
+   *dp = 'b';
/* Must not change dp so we can replace 'a' by 'b' later. */
*(dp+1) = '\0';
 
+   /* Check if 'a' and 'b' interfaces already exist. */ 
+   if (ifunit(name) != NULL)
+   return (EEXIST);
+   *dp = 'a';
+   if (ifunit(name) != NULL)
+   return (EEXIST);
+
/* Allocate memory for both [ab] interfaces */
sca = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO);
EPAIR_REFCOUNT_INIT(>refcount, 1);
@@ -800,6 +808,14 @@ epair_clone_create(struct if_clone *ifc,
netisr_get_cpuid(sca->ifp->if_index % netisr_get_cpucount());
scb->cpuid =
netisr_get_cpuid(scb->ifp->if_index % netisr_get_cpucount());
+
+   /* Initialise pseudo media types. */
+   ifmedia_init(>media, 0, epair_media_change, epair_media_status);
+   ifmedia_add(>media, IFM_ETHER | IFM_10G_T, 0, NULL);
+   ifmedia_set(>media, IFM_ETHER | IFM_10G_T);
+   ifmedia_init(>media, 0, epair_media_change, epair_media_status);
+   ifmedia_add(>media, IFM_ETHER | IFM_10G_T, 0, NULL);
+   ifmedia_set(>media, IFM_ETHER | IFM_10G_T);

/* Finish initialization of interface a. */
ifp = sca->ifp;
@@ -858,14 +874,6 @@ epair_clone_create(struct if_clone *ifc,
strlcpy(name, sca->ifp->if_xname, len);
DPRINTF("name='%s/%db' created sca=%p scb=%p\n", name, unit, sca, scb);
 
-   /* Initialise pseudo media types. */
-   ifmedia_init(>media, 0, epair_media_change, epair_media_status);
-   ifmedia_add(>media, IFM_ETHER | IFM_10G_T, 0, NULL);
-   ifmedia_set(>media, IFM_ETHER | IFM_10G_T);
-   ifmedia_init(>media, 0, epair_media_change, epair_media_status);
-   ifmedia_add(>media, IFM_ETHER | IFM_10G_T, 0, NULL);
-   ifmedia_set(>media, IFM_ETHER | IFM_10G_T);
-
/* Tell the world, that we are ready to rock. */
sca->ifp->if_drv_flags |= IFF_DRV_RUNNING;
scb->ifp->if_drv_flags |= IFF_DRV_RUNNING;
@@ -943,6 +951,25 @@ epair_clone_destroy(struct if_clone *ifc
return (0);
 }
 
+static void
+vnet_epair_init(const void *unused __unused)
+{
+
+   V_epair_cloner = if_clone_advanced(epairname, 0,
+   epair_clone_match, epair_clone_create, epair_clone_destroy);
+}
+VNET_SYSINIT(vnet_epair_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
+vnet_epair_init, NULL);
+
+static void
+vnet_epair_uninit(const void *unused __unused)
+{
+
+   if_clone_detach(V_epair_cloner);
+}
+VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
+vnet_epair_uninit, NULL);
+
 static int
 epair_modevent(module_t mod, int type, void *data)
 {
@@ -956,13 +983,10 @@ epair_modevent(module_t mod, int type, v
if (TUNABLE_INT_FETCH("net.link.epair.netisr_maxqlen", ))
epair_nh.nh_qlimit = qlimit;
netisr_register(_nh);
-   epair_cloner = if_clone_advanced(epairname, 0,
-   epair_clone_match, epair_clone_create, epair_clone_destroy);
if (bootverbose)
printf("%s initialized.\n", epairname);

svn commit: r285820 - stable/10/sbin/ping6

2015-07-23 Thread Hiroki Sato
Author: hrs
Date: Thu Jul 23 19:52:03 2015
New Revision: 285820
URL: https://svnweb.freebsd.org/changeset/base/285820

Log:
  MFC r271910, r273211:
  
  * Add -x waittime and -X timeout options for feature parity.  These are
equivalent to -W and -t options of ping(8).  Different letters are used
because both have already been used for another purposes in ping6(8).
  
  * Fix a problem that reply packets are not received when -i T option is set
and (T  RTT).
  
   - Use select(2) for timeout instead of interval timer. Remove poll(2) 
support.
   - Use sigaction(2) instead of signal(3).
   - Exit in SIGINT handler when two signals are received and doing reverse DNS
 lookup as ping(8) does.
   - Remove redundant variables used for getaddrinfo(3).
  
  Approved by:  re (gjb)

Modified:
  stable/10/sbin/ping6/Makefile
  stable/10/sbin/ping6/ping6.8
  stable/10/sbin/ping6/ping6.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/ping6/Makefile
==
--- stable/10/sbin/ping6/Makefile   Thu Jul 23 19:13:41 2015
(r285819)
+++ stable/10/sbin/ping6/Makefile   Thu Jul 23 19:52:03 2015
(r285820)
@@ -4,7 +4,7 @@ PROG=   ping6
 MAN=   ping6.8
 
 CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS \
-   -DHAVE_POLL_H -DHAVE_ARC4RANDOM
+   -DHAVE_ARC4RANDOM
 WARNS?=2
 
 BINOWN=root

Modified: stable/10/sbin/ping6/ping6.8
==
--- stable/10/sbin/ping6/ping6.8Thu Jul 23 19:13:41 2015
(r285819)
+++ stable/10/sbin/ping6/ping6.8Thu Jul 23 19:52:03 2015
(r285820)
@@ -29,7 +29,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 5, 2013
+.Dd September 22, 2014
 .Dt PING6 8
 .Os
 .Sh NAME
@@ -65,6 +65,12 @@ packets to network hosts
 .Op Fl i Ar wait
 .Ek
 .Bk -words
+.Op Fl x Ar waittime
+.Ek
+.Bk -words
+.Op Fl X Ar timeout
+.Ek
+.Bk -words
 .Op Fl l Ar preload
 .Ek
 .Bk -words
@@ -191,6 +197,15 @@ The default is to wait for one second be
 This option is incompatible with the
 .Fl f
 option.
+.It Fl x Ar waittime
+Time in milliseconds to wait for a reply for each packet sent.
+If a reply arrives later,
+the packet is not printed as replied,
+but considered as replied when calculating statistics.
+.It Fl X Ar timeout
+Specify a timeout,
+in seconds,
+before ping exits regardless of how many packets have been received.
 .It Fl l Ar preload
 If
 .Ar preload

Modified: stable/10/sbin/ping6/ping6.c
==
--- stable/10/sbin/ping6/ping6.cThu Jul 23 19:13:41 2015
(r285819)
+++ stable/10/sbin/ping6/ping6.cThu Jul 23 19:52:03 2015
(r285820)
@@ -125,10 +125,8 @@ __FBSDID($FreeBSD$);
 #include stdio.h
 #include stdlib.h
 #include string.h
+#include sysexits.h
 #include unistd.h
-#ifdef HAVE_POLL_H
-#include poll.h
-#endif
 
 #ifdef IPSEC
 #include netipsec/ah.h
@@ -154,6 +152,8 @@ struct tv32 {
 #defineDEFDATALEN  ICMP6ECHOTMLEN
 #define MAXDATALEN MAXPACKETLEN - IP6LEN - ICMP6ECHOLEN
 #defineNROUTES 9   /* number of record route slots 
*/
+#defineMAXWAIT 1   /* max ms to wait for response 
*/
+#defineMAXALARM(60 * 60)   /* max seconds for alarm 
timeout */
 
 #defineA(bit)  rcvd_tbl[(bit)3]  /* identify byte in 
array */
 #defineB(bit)  (1  ((bit)  0x07))   /* identify bit in byte 
*/
@@ -190,6 +190,7 @@ struct tv32 {
 #define F_MISSED   0x80
 #define F_DONTFRAG 0x100
 #define F_NOUSERDATA   (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
+#defineF_WAITTIME  0x200
 u_int options;
 
 #define IN6LEN sizeof(struct in6_addr)
@@ -207,7 +208,6 @@ u_int options;
 int mx_dup_ck = MAX_DUP_CHK;
 char rcvd_tbl[MAX_DUP_CHK / 8];
 
-struct addrinfo *res = NULL;
 struct sockaddr_in6 dst;   /* who to ping6 */
 struct sockaddr_in6 src;   /* src addr of this packet */
 socklen_t srclen;
@@ -223,12 +223,6 @@ u_int8_t nonce[8]; /* nonce field for n
 int hoplimit = -1; /* hoplimit */
 int pathmtu = 0;   /* path MTU for the destination.  0 = unspec. */
 u_char *packet = NULL;
-#ifdef HAVE_POLL_H
-struct pollfd fdmaskp[1];
-#else
-fd_set *fdmaskp = NULL;
-int fdmasks;
-#endif
 
 /* counters */
 long nmissedmax;   /* max value of ntransmitted - nreceived - 1 */
@@ -236,7 +230,9 @@ long npackets;  /* max packets to trans
 long nreceived;/* # of packets we got back */
 long nrepeats; /* number of duplicates */
 long ntransmitted; /* sequence # for outbound packets = #sent */
-struct timeval interval = {1, 0}; /* interval between packets */
+int interval = 1000;   /* interval between packets in ms */
+int waittime = 

svn commit: r285821 - stable/10/etc

2015-07-23 Thread Hiroki Sato
Author: hrs
Date: Thu Jul 23 19:53:49 2015
New Revision: 285821
URL: https://svnweb.freebsd.org/changeset/base/285821

Log:
  MFC r273201, r273301:
  
  Add support of /{udp,tcp,proto} suffix into $firewall_myservices, which
  interpreted the listed items as port numbers of TCP services.
  
  A service with no suffix still works and recognized as a TCP service for
  backward compatibility.  It should be updated with /tcp suffix.
  
  Approved by:  re (gjb)

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

Modified: stable/10/etc/rc.firewall
==
--- stable/10/etc/rc.firewall   Thu Jul 23 19:52:03 2015(r285820)
+++ stable/10/etc/rc.firewall   Thu Jul 23 19:53:49 2015(r285821)
@@ -422,8 +422,8 @@ case ${firewall_type} in
 
 [Ww][Oo][Rr][Kk][Ss][Tt][Aa][Tt][Ii][Oo][Nn])
# Configuration:
-   #  firewall_myservices: List of TCP ports on which this host
-   #offers services.
+   #  firewall_myservices: List of ports/protocols on which this
+   #host offers services.
#  firewall_allowservices:  List of IPv4 and/or IPv6 addresses
#that have access to
#$firewall_myservices.
@@ -487,7 +487,25 @@ case ${firewall_type} in
#
for i in ${firewall_allowservices} ; do
  for j in ${firewall_myservices} ; do
-   ${fwcmd} add pass tcp from $i to me $j
+   case $j in
+   [0-9A-Za-z]*/[Pp][Rr][Oo][Tt][Oo])
+ ${fwcmd} add pass ${j%/[Pp][Rr][Oo][Tt][Oo]} from $i to me
+   ;;
+   [0-9A-Za-z]*/[Tt][Cc][Pp])
+ ${fwcmd} add pass tcp from $i to me ${j%/[Tt][Cc][Pp]}
+   ;;
+   [0-9A-Za-z]*/[Uu][Dd][Pp])
+ ${fwcmd} add pass udp from $i to me ${j%/[Uu][Dd][Pp]}
+   ;;
+   *[0-9A-Za-z])
+ echo Consider using ${j}/tcp in firewall_myservices. \
+/dev/stderr
+ ${fwcmd} add pass tcp from $i to me $j
+   ;;
+   *)
+ echo Invalid port in firewall_myservices: $j  /dev/stderr
+   ;;
+   esac
  done
done
 
___
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: r285823 - stable/10/etc/defaults

2015-07-23 Thread Hiroki Sato
Author: hrs
Date: Thu Jul 23 19:55:46 2015
New Revision: 285823
URL: https://svnweb.freebsd.org/changeset/base/285823

Log:
  MFC r274841
  
  Remove examples of gif_interfaces and gifconfig.  These have already been
  marked as deprecated in rc.conf(5) manual page but these examples
  were still here.
  
  Approved by:  re (gjb)

Modified:
  stable/10/etc/defaults/rc.conf
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/defaults/rc.conf
==
--- stable/10/etc/defaults/rc.conf  Thu Jul 23 19:54:42 2015
(r285822)
+++ stable/10/etc/defaults/rc.conf  Thu Jul 23 19:55:46 2015
(r285823)
@@ -231,11 +231,6 @@ cloned_interfaces=   # List of cloned n
 sppp_interfaces= # List of sppp interfaces.
 #sppp_interfaces=...0# example: sppp over ...
 #spppconfig_...0=authproto=chap myauthname=foo myauthsecret='top secret' 
hisauthname=some-gw hisauthsecret='another secret'
-gif_interfaces=  # List of GIF tunnels.
-#gif_interfaces=gif0 gif1# Examples typically for a router.
-   # Choose correct tunnel addrs.
-#gifconfig_gif0=10.1.1.1 10.1.2.1# Examples typically for a router.
-#gifconfig_gif1=10.1.1.2 10.1.2.2# Examples typically for a router.
 fec_interfaces=  # List of Fast EtherChannels.
 #fec_interfaces=fec0 fec1
 #fecconfig_fec0=fxp0 dc0 # Examples typically for two NICs
___
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: r285824 - stable/10/sys/net

2015-07-23 Thread Hiroki Sato
Author: hrs
Date: Thu Jul 23 19:57:47 2015
New Revision: 285824
URL: https://svnweb.freebsd.org/changeset/base/285824

Log:
  MFC r279538:
  
  Fix group membership of cloned interfaces when one is moved by
  if_vmove().
  
  In if_vmove(), if_detach_internal() and if_attach_internal() were
  called in series to detach and reattach the interface.  When
  detaching, if_delgroup() was called and the interface leaves all of
  the group membership.  And then upon attachment, if_addgroup(ifp,
  IFG_ALL) was called and it joined only all group again.
  
  This had a problem. Normally, a cloned interface automatically joins
  a group whose name is ifc_name of the cloner in addition to all
  upon creation.  However, if_vmove() removed the membership and did
  not restore upon attachment.
  
  Approved by:  re (gjb)

Modified:
  stable/10/sys/net/if.c
  stable/10/sys/net/if_clone.c
  stable/10/sys/net/if_clone.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if.c
==
--- stable/10/sys/net/if.c  Thu Jul 23 19:55:46 2015(r285823)
+++ stable/10/sys/net/if.c  Thu Jul 23 19:57:47 2015(r285824)
@@ -175,8 +175,8 @@ static void do_link_state_change(void *,
 static int if_getgroup(struct ifgroupreq *, struct ifnet *);
 static int if_getgroupmembers(struct ifgroupreq *);
 static voidif_delgroups(struct ifnet *);
-static voidif_attach_internal(struct ifnet *, int);
-static voidif_detach_internal(struct ifnet *, int);
+static voidif_attach_internal(struct ifnet *, int, struct if_clone *);
+static voidif_detach_internal(struct ifnet *, int, struct if_clone **);
 
 #ifdef INET6
 /*
@@ -571,6 +571,15 @@ ifq_delete(struct ifaltq *ifq)
  * tasks, given that we are moving from one vnet to another an ifnet which
  * has already been fully initialized.
  *
+ * Note that if_detach_internal() removes group membership unconditionally
+ * even when vmove flag is set, and if_attach_internal() adds only IFG_ALL.
+ * Thus, when if_vmove() is applied to a cloned interface, group membership
+ * is lost while a cloned one always joins a group whose name is
+ * ifc-ifc_name.  To recover this after if_detach_internal() and
+ * if_attach_internal(), the cloner should be specified to
+ * if_attach_internal() via ifc.  If it is non-NULL, if_attach_internal()
+ * attempts to join a group whose name is ifc-ifc_name.
+ *
  * XXX:
  *  - The decision to return void and thus require this function to
  *succeed is questionable.
@@ -581,7 +590,7 @@ void
 if_attach(struct ifnet *ifp)
 {
 
-   if_attach_internal(ifp, 0);
+   if_attach_internal(ifp, 0, NULL);
 }
 
 /*
@@ -636,7 +645,7 @@ if_hw_tsomax_update(struct ifnet *ifp, s
 }
 
 static void
-if_attach_internal(struct ifnet *ifp, int vmove)
+if_attach_internal(struct ifnet *ifp, int vmove, struct if_clone *ifc)
 {
unsigned socksize, ifasize;
int namelen, masklen;
@@ -655,6 +664,10 @@ if_attach_internal(struct ifnet *ifp, in
 
if_addgroup(ifp, IFG_ALL);
 
+   /* Restore group membership for cloned interfaces. */
+   if (vmove  ifc != NULL)
+   if_clone_addgroup(ifp, ifc);
+
getmicrotime(ifp-if_lastchange);
ifp-if_data.ifi_epoch = time_uptime;
ifp-if_data.ifi_datalen = sizeof(struct if_data);
@@ -877,12 +890,12 @@ if_detach(struct ifnet *ifp)
 {
 
CURVNET_SET_QUIET(ifp-if_vnet);
-   if_detach_internal(ifp, 0);
+   if_detach_internal(ifp, 0, NULL);
CURVNET_RESTORE();
 }
 
 static void
-if_detach_internal(struct ifnet *ifp, int vmove)
+if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp)
 {
struct ifaddr *ifa;
struct radix_node_head  *rnh;
@@ -911,6 +924,10 @@ if_detach_internal(struct ifnet *ifp, in
return; /* XXX this should panic as well? */
}
 
+   /* Check if this is a cloned interface or not. */
+   if (vmove  ifcp != NULL)
+   *ifcp = if_clone_findifc(ifp);
+
/*
 * Remove/wait for pending events.
 */
@@ -1016,12 +1033,13 @@ void
 if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
 {
u_short idx;
+   struct if_clone *ifc;
 
/*
 * Detach from current vnet, but preserve LLADDR info, do not
 * mark as dead etc. so that the ifnet can be reattached later.
 */
-   if_detach_internal(ifp, 1);
+   if_detach_internal(ifp, 1, ifc);
 
/*
 * Unlink the ifnet from ifindex_table[] in current vnet, and shrink
@@ -1055,7 +1073,7 @@ if_vmove(struct ifnet *ifp, struct vnet 
ifnet_setbyindex_locked(ifp-if_index, ifp);
IFNET_WUNLOCK();
 
-   if_attach_internal(ifp, 1);
+   if_attach_internal(ifp, 1, ifc);
 
CURVNET_RESTORE();
 }

Modified: stable/10/sys/net/if_clone.c
==
--- 

svn commit: r285825 - in stable/10: sbin/ifconfig sys/netinet6

2015-07-23 Thread Hiroki Sato
Author: hrs
Date: Thu Jul 23 19:58:56 2015
New Revision: 285825
URL: https://svnweb.freebsd.org/changeset/base/285825

Log:
  MFC r282805:
  
  - Remove ND6_IFF_IGNORELOOP.  This functionality was useless in practice
because a link where looped back NS messages are permanently observed
does not work with either NDP or ARP for IPv4.
  
  - draft-ietf-6man-enhanced-dad is now RFC 7527.
  
  Approved by:  re (gjb)

Modified:
  stable/10/sbin/ifconfig/af_inet6.c
  stable/10/sbin/ifconfig/ifconfig.8
  stable/10/sys/netinet6/nd6.h
  stable/10/sys/netinet6/nd6_nbr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/ifconfig/af_inet6.c
==
--- stable/10/sbin/ifconfig/af_inet6.c  Thu Jul 23 19:57:47 2015
(r285824)
+++ stable/10/sbin/ifconfig/af_inet6.c  Thu Jul 23 19:58:56 2015
(r285825)
@@ -485,8 +485,6 @@ static struct cmd inet6_cmds[] = {
DEF_CMD(-no_prefer_iface,-ND6_IFF_NO_PREFER_IFACE,setnd6flags),
DEF_CMD(no_dad,   ND6_IFF_NO_DAD, setnd6flags),
DEF_CMD(-no_dad,  -ND6_IFF_NO_DAD,setnd6flags),
-   DEF_CMD(ignoreloop,   ND6_IFF_IGNORELOOP, setnd6flags),
-   DEF_CMD(-ignoreloop,  -ND6_IFF_IGNORELOOP,setnd6flags),
DEF_CMD_ARG(pltime,   setip6pltime),
DEF_CMD_ARG(vltime,   setip6vltime),
DEF_CMD(eui64,0,  setip6eui64),

Modified: stable/10/sbin/ifconfig/ifconfig.8
==
--- stable/10/sbin/ifconfig/ifconfig.8  Thu Jul 23 19:57:47 2015
(r285824)
+++ stable/10/sbin/ifconfig/ifconfig.8  Thu Jul 23 19:58:56 2015
(r285825)
@@ -28,7 +28,7 @@
 .\ From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\ $FreeBSD$
 .\
-.Dd May 15, 2015
+.Dd July 24, 2015
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -749,15 +749,6 @@ Set a flag to disable Duplicate Address 
 .It Cm -no_dad
 Clear a flag
 .Cm no_dad .
-.It Cm ignoreloop
-Set a flag to disable loopback detection in Enhanced Duplicate Address
-Detection Algorithm.
-When this flag is set,
-Duplicate Address Detection will stop in a finite number of probings
-even if a loopback configuration is detected.
-.It Cm -ignoreloop
-Clear a flag
-.Cm ignoreloop .
 .El
 .Pp
 The following parameters are specific for IPv6 addresses.

Modified: stable/10/sys/netinet6/nd6.h
==
--- stable/10/sys/netinet6/nd6.hThu Jul 23 19:57:47 2015
(r285824)
+++ stable/10/sys/netinet6/nd6.hThu Jul 23 19:58:56 2015
(r285825)
@@ -87,8 +87,7 @@ struct nd_ifinfo {
 #define ND6_IFF_AUTO_LINKLOCAL 0x20
 #defineND6_IFF_NO_RADR 0x40
 #define ND6_IFF_NO_PREFER_IFACE0x80 /* XXX: not related to ND. */
-#define ND6_IFF_IGNORELOOP 0x100
-#define ND6_IFF_NO_DAD 0x200
+#define ND6_IFF_NO_DAD 0x100
 
 #defineND6_CREATE  LLE_CREATE
 #defineND6_EXCLUSIVE   LLE_EXCLUSIVE

Modified: stable/10/sys/netinet6/nd6_nbr.c
==
--- stable/10/sys/netinet6/nd6_nbr.cThu Jul 23 19:57:47 2015
(r285824)
+++ stable/10/sys/netinet6/nd6_nbr.cThu Jul 23 19:58:56 2015
(r285825)
@@ -1450,10 +1450,9 @@ nd6_dad_timer(struct dadq *dp)
dp-dad_ns_lcount  0 
dp-dad_ns_lcount  dp-dad_loopbackprobe) {
/*
-* A looped back probe is detected,
-* Sec. 4.1 in draft-ietf-6man-enhanced-dad-13
-* requires transmission of additional probes until
-* the loopback condition becomes clear.
+* Sec. 4.1 in RFC 7527 requires transmission of
+* additional probes until the loopback condition
+* becomes clear when a looped back probe is detected.
 */
log(LOG_ERR, %s: a looped back NS message is 
detected during DAD for %s.  
@@ -1462,16 +1461,6 @@ nd6_dad_timer(struct dadq *dp)
ip6_sprintf(ip6buf, IFA_IN6(ifa)));
dp-dad_loopbackprobe = dp-dad_ns_lcount;
/*
-* An interface with IGNORELOOP is one which a
-* loopback is permanently expected while regular
-* traffic works.  In that case, stop DAD after
-* MAX_MULTICAST_SOLICIT number of NS messages
-* regardless of the number of received loopback NS
-* by increasing dad_loopbackprobe in advance.
-*/
-   if 

svn commit: r285826 - stable/10/usr.bin/sockstat

2015-07-23 Thread Hiroki Sato
Author: hrs
Date: Thu Jul 23 20:00:20 2015
New Revision: 285826
URL: https://svnweb.freebsd.org/changeset/base/285826

Log:
  MFC r284636:
  
  - Add SOCK_SEQPACKET support in UNIX-domain socket.
  - Display zoneid using % notation in an IPv6 address.
  - Use nitems().
  - Use sstos{in,in6,un} macros to simplify casts.
  - style(9).
  
  Approved by:  re (gjb)

Modified:
  stable/10/usr.bin/sockstat/sockstat.1
  stable/10/usr.bin/sockstat/sockstat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/sockstat/sockstat.1
==
--- stable/10/usr.bin/sockstat/sockstat.1   Thu Jul 23 19:58:56 2015
(r285825)
+++ stable/10/usr.bin/sockstat/sockstat.1   Thu Jul 23 20:00:20 2015
(r285826)
@@ -27,7 +27,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 13, 2015
+.Dd June 20, 2015
 .Dt SOCKSTAT 1
 .Os
 .Sh NAME
@@ -119,7 +119,9 @@ The process ID of the command which hold
 The file descriptor number of the socket.
 .It Li PROTO
 The transport protocol associated with the socket for Internet
-sockets, or the type of socket (stream or datagram) for
+sockets, or the type of socket
+.Pq stream, datagram, or seqpacket
+for
 .Ux
 sockets.
 .It Li LOCAL ADDRESS

Modified: stable/10/usr.bin/sockstat/sockstat.c
==
--- stable/10/usr.bin/sockstat/sockstat.c   Thu Jul 23 19:58:56 2015
(r285825)
+++ stable/10/usr.bin/sockstat/sockstat.c   Thu Jul 23 20:00:20 2015
(r285826)
@@ -60,6 +60,11 @@ __FBSDID($FreeBSD$);
 #include string.h
 #include unistd.h
 
+#definesstosin(ss) ((struct sockaddr_in *)(ss))
+#definesstosin6(ss)((struct sockaddr_in6 *)(ss))
+#definesstosun(ss) ((struct sockaddr_un *)(ss))
+#definesstosa(ss)  ((struct sockaddr *)(ss))
+
 static int  opt_4; /* Show IPv4 sockets */
 static int  opt_6; /* Show IPv6 sockets */
 static int  opt_c; /* Show connected sockets */
@@ -73,8 +78,7 @@ static int opt_v; /* Verbose mode */
  * Default protocols to use if no -P was defined.
  */
 static const char *default_protos[] = {sctp, tcp, udp, divert };
-static size_t default_numprotos =
-sizeof(default_protos) / sizeof(default_protos[0]);
+static size_t default_numprotos = nitems(default_protos);
 
 static int *protos;/* protocols to use */
 static size_t   numprotos; /* allocated size of protos[] */
@@ -140,7 +144,8 @@ get_proto_type(const char *proto)
 }
 
 
-static void init_protos(int num)
+static void
+init_protos(int num)
 {
int proto_count = 0;
 
@@ -163,7 +168,6 @@ static int
 parse_protos(char *protospec)
 {
char *prot;
-   char *tmp = protospec;
int proto_type, proto_index;
 
if (protospec == NULL)
@@ -171,7 +175,7 @@ parse_protos(char *protospec)
 
init_protos(0);
proto_index = 0;
-   while ((prot = strsep(tmp, ,)) != NULL) {
+   while ((prot = strsep(protospec, ,)) != NULL) {
if (strlen(prot) == 0)
continue;
proto_type = get_proto_type(prot);
@@ -228,26 +232,32 @@ parse_ports(const char *portspec)
 }
 
 static void
-sockaddr(struct sockaddr_storage *sa, int af, void *addr, int port)
+sockaddr(struct sockaddr_storage *ss, int af, void *addr, int port)
 {
struct sockaddr_in *sin4;
struct sockaddr_in6 *sin6;
 
-   bzero(sa, sizeof *sa);
+   bzero(ss, sizeof(*ss));
switch (af) {
case AF_INET:
-   sin4 = (struct sockaddr_in *)sa;
-   sin4-sin_len = sizeof *sin4;
+   sin4 = sstosin(ss);
+   sin4-sin_len = sizeof(*sin4);
sin4-sin_family = af;
sin4-sin_port = port;
sin4-sin_addr = *(struct in_addr *)addr;
break;
case AF_INET6:
-   sin6 = (struct sockaddr_in6 *)sa;
-   sin6-sin6_len = sizeof *sin6;
+   sin6 = sstosin6(ss);
+   sin6-sin6_len = sizeof(*sin6);
sin6-sin6_family = af;
sin6-sin6_port = port;
sin6-sin6_addr = *(struct in6_addr *)addr;
+#defines6_addr16   __u6_addr.__u6_addr16
+   if (IN6_IS_ADDR_LINKLOCAL(sin6-sin6_addr)) {
+   sin6-sin6_scope_id =
+   ntohs(sin6-sin6_addr.s6_addr16[1]);
+   sin6-sin6_addr.s6_addr16[1] = 0;
+   }
break;
default:
abort();
@@ -587,7 +597,7 @@ gather_inet(int proto)
switch (proto) {
case IPPROTO_TCP:
xtp = (struct xtcpcb *)xig;
-   if (xtp-xt_len != sizeof *xtp) {
+   if (xtp-xt_len != sizeof(*xtp)) {
warnx(struct xtcpcb size 

svn commit: r285827 - stable/10/usr.sbin/jail

2015-07-23 Thread Hiroki Sato
Author: hrs
Date: Thu Jul 23 20:01:56 2015
New Revision: 285827
URL: https://svnweb.freebsd.org/changeset/base/285827

Log:
  MFC r285261, r285279:
  
  - Fix offset calculation in variable substitution
in jail.conf.  The following did not work correctly:
  
   A=A_${B}_C_${D}
   B=B
   D=_${E}_F
   E=E
  
  - Implement PF_IMMUTABLE flag and apply it to name and jid in
jail.conf parameters.  This flag disallows redefinition of the parameter.
  
name and/or jid are automatically defined in jail.conf by using
the jail names at the front of jail parameter definitions.  However,
one could override them by using a variable with the same name like
$name = foo.  This confused the parser and could end up with SIGSEGV.
  
Note that this change also affects a case when all of parameters are
defined in the command line arguments, not in jail.conf.  Specifically,
jail -c name=j1 name=j2 no longer works.  This should be harmless.
  
  Approved by:  re (gjb)

Modified:
  stable/10/usr.sbin/jail/config.c
  stable/10/usr.sbin/jail/jailp.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/jail/config.c
==
--- stable/10/usr.sbin/jail/config.cThu Jul 23 20:00:20 2015
(r285826)
+++ stable/10/usr.sbin/jail/config.cThu Jul 23 20:01:56 2015
(r285827)
@@ -111,8 +111,8 @@ static const struct ipspec intparams[] =
 #ifdef INET6
 [KP_IP6_ADDR] ={ip6.addr,0},
 #endif
-[KP_JID] = {jid, 0},
-[KP_NAME] ={name,0},
+[KP_JID] = {jid, PF_IMMUTABLE},
+[KP_NAME] ={name,PF_IMMUTABLE},
 [KP_PATH] ={path,0},
 [KP_PERSIST] = {persist, 0},
 [KP_SECURELEVEL] = {securelevel, 0},
@@ -130,9 +130,8 @@ load_config(void)
struct cfjail *j, *tj, *wj;
struct cfparam *p, *vp, *tp;
struct cfstring *s, *vs, *ns;
-   struct cfvar *v;
+   struct cfvar *v, *vv;
char *ep;
-   size_t varoff;
int did_self, jseq, pgen;
 
if (!strcmp(cfname, -)) {
@@ -191,7 +190,6 @@ load_config(void)
p-gen = ++pgen;
find_vars:
TAILQ_FOREACH(s, p-val, tq) {
-   varoff = 0;
while ((v = STAILQ_FIRST(s-vars))) {
TAILQ_FOREACH(vp, j-params, tq)
if (!strcmp(vp-name, v-name))
@@ -233,11 +231,13 @@ load_config(void)
goto bad_var;
}
s-s = erealloc(s-s, s-len + vs-len + 1);
-   memmove(s-s + v-pos + varoff + vs-len,
-   s-s + v-pos + varoff,
-   s-len - (v-pos + varoff) + 1);
-   memcpy(s-s + v-pos + varoff, vs-s, vs-len);
-   varoff += vs-len;
+   memmove(s-s + v-pos + vs-len,
+   s-s + v-pos,
+   s-len - v-pos + 1);
+   memcpy(s-s + v-pos, vs-s, vs-len);
+   vv = v;
+   while ((vv = STAILQ_NEXT(vv, tq)))
+   vv-pos += vs-len;
s-len += vs-len;
while ((vs = TAILQ_NEXT(vs, tq))) {
ns = emalloc(sizeof(struct cfstring));
@@ -362,6 +362,11 @@ add_param(struct cfjail *j, const struct
break;
if (dp != NULL) {
/* Found it - append or replace. */
+   if (dp-flags  PF_IMMUTABLE) {
+   jail_warnx(j, cannot redefine variable \%s\.,
+   dp-name);
+   return;
+   }
if (strcmp(dp-name, name)) {
free(dp-name);
dp-name = estrdup(name);

Modified: stable/10/usr.sbin/jail/jailp.h
==
--- stable/10/usr.sbin/jail/jailp.h Thu Jul 23 20:00:20 2015
(r285826)
+++ stable/10/usr.sbin/jail/jailp.h Thu Jul 23 20:01:56 2015
(r285827)
@@ -51,6 +51,7 @@
 #define PF_INT 0x20/* Integer parameter */
 #define PF_CONV0x40/* Parameter duplicated in converted 
form */
 #define PF_REV 0x80/* Run commands in reverse order on stopping */
+#definePF_IMMUTABLE0x100   /* Immutable parameter */
 
 #define JF_START   0x0001  /* -c */
 

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

2015-05-11 Thread Hiroki Sato
Author: hrs
Date: Tue May 12 03:49:18 2015
New Revision: 282807
URL: https://svnweb.freebsd.org/changeset/base/282807

Log:
  MFC r274223 (by glebius):
  
Remove VNET_SYSCTL_ARG(). The generic sysctl(9) code handles that.
  
  A panic could occur by sysctl -a when using VIMAGE-enabled stable/10
  kernel after r262734 because of this missing MFC.

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

Modified: stable/10/sys/netinet6/in6_proto.c
==
--- stable/10/sys/netinet6/in6_proto.c  Tue May 12 03:35:45 2015
(r282806)
+++ stable/10/sys/netinet6/in6_proto.c  Tue May 12 03:49:18 2015
(r282807)
@@ -474,8 +474,6 @@ sysctl_ip6_temppltime(SYSCTL_HANDLER_ARG
int error = 0;
int old;
 
-   VNET_SYSCTL_ARG(req, arg1);
-
error = SYSCTL_OUT(req, arg1, sizeof(int));
if (error || !req-newptr)
return (error);
@@ -495,8 +493,6 @@ sysctl_ip6_tempvltime(SYSCTL_HANDLER_ARG
int error = 0;
int old;
 
-   VNET_SYSCTL_ARG(req, arg1);
-
error = SYSCTL_OUT(req, arg1, sizeof(int));
if (error || !req-newptr)
return (error);
___
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