summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
committersjg <sjg@FreeBSD.org>2014-08-19 06:50:54 +0000
commitd7cd1d425cc1ea9451fa235e3af9b6625c3e0de2 (patch)
treeb04f4bd7cd887f50e7d98af35f46b9834ff86c80 /sbin/ifconfig
parent3c8e37b1d04827f33c0c9a7594bd1b1ef7cdb3d3 (diff)
parent4fbde208c6460d576f64d6dc3cdc6cab085a4283 (diff)
downloadFreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.zip
FreeBSD-src-d7cd1d425cc1ea9451fa235e3af9b6625c3e0de2.tar.gz
Merge head from 7/28
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/af_inet6.c22
-rw-r--r--sbin/ifconfig/ifconfig.856
2 files changed, 53 insertions, 25 deletions
diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c
index b4db0f1..d2e65e4 100644
--- a/sbin/ifconfig/af_inet6.c
+++ b/sbin/ifconfig/af_inet6.c
@@ -42,6 +42,7 @@ static const char rcsid[] =
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <time.h>
#include <ifaddrs.h>
#include <arpa/inet.h>
@@ -98,20 +99,21 @@ static void
setip6lifetime(const char *cmd, const char *val, int s,
const struct afswtch *afp)
{
- time_t newval, t;
+ struct timespec now;
+ time_t newval;
char *ep;
- t = time(NULL);
+ clock_gettime(CLOCK_MONOTONIC_FAST, &now);
newval = (time_t)strtoul(val, &ep, 0);
if (val == ep)
errx(1, "invalid %s", cmd);
if (afp->af_af != AF_INET6)
errx(1, "%s not allowed for the AF", cmd);
if (strcmp(cmd, "vltime") == 0) {
- in6_addreq.ifra_lifetime.ia6t_expire = t + newval;
+ in6_addreq.ifra_lifetime.ia6t_expire = now.tv_sec + newval;
in6_addreq.ifra_lifetime.ia6t_vltime = newval;
} else if (strcmp(cmd, "pltime") == 0) {
- in6_addreq.ifra_lifetime.ia6t_preferred = t + newval;
+ in6_addreq.ifra_lifetime.ia6t_preferred = now.tv_sec + newval;
in6_addreq.ifra_lifetime.ia6t_pltime = newval;
}
}
@@ -172,9 +174,11 @@ in6_status(int s __unused, const struct ifaddrs *ifa)
int s6;
u_int32_t flags6;
struct in6_addrlifetime lifetime;
- time_t t = time(NULL);
+ struct timespec now;
int error;
+ clock_gettime(CLOCK_MONOTONIC_FAST, &now);
+
memset(&null_sin, 0, sizeof(null_sin));
sin = (struct sockaddr_in6 *)ifa->ifa_addr;
@@ -258,15 +262,15 @@ in6_status(int s __unused, const struct ifaddrs *ifa)
if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) {
printf("pltime ");
if (lifetime.ia6t_preferred) {
- printf("%s ", lifetime.ia6t_preferred < t
- ? "0" : sec2str(lifetime.ia6t_preferred - t));
+ printf("%s ", lifetime.ia6t_preferred < now.tv_sec
+ ? "0" : sec2str(lifetime.ia6t_preferred - now.tv_sec));
} else
printf("infty ");
printf("vltime ");
if (lifetime.ia6t_expire) {
- printf("%s ", lifetime.ia6t_expire < t
- ? "0" : sec2str(lifetime.ia6t_expire - t));
+ printf("%s ", lifetime.ia6t_expire < now.tv_sec
+ ? "0" : sec2str(lifetime.ia6t_expire - now.tv_sec));
} else
printf("infty ");
}
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 8116cb7..5bf590d 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd October 21, 2013
+.Dd June 5, 2014
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -141,13 +141,13 @@ The link-level
.Pq Dq link
address
is specified as a series of colon-separated hex digits.
-This can be used to
-e.g.,\& set a new MAC address on an ethernet interface, though the
-mechanism used is not ethernet-specific.
+This can be used to, for example,
+set a new MAC address on an Ethernet interface, though the
+mechanism used is not Ethernet specific.
If the interface is already
up when this option is used, it will be briefly brought down and
then brought back up again in order to ensure that the receive
-filter in the underlying ethernet hardware is properly reprogrammed.
+filter in the underlying Ethernet hardware is properly reprogrammed.
.It Ar address_family
Specify the
address family
@@ -169,6 +169,18 @@ and
.Dq lladdr
are synonyms for
.Dq link .
+When using the
+.Fl l
+flag, the
+.Dq ether
+address family has special meaning and is no longer synonymous with
+.Dq link
+or
+.Dq lladdr .
+Specifying
+.Fl l Dq ether
+will list only Ethernet interfaces, excluding all other interface types,
+including the loopback interface.
.It Ar dest_address
Specify the address of the correspondent on the other end
of a point to point link.
@@ -649,7 +661,8 @@ Clear a flag
.Cm defaultif .
.It Cm ifdisabled
Set a flag to disable all of IPv6 network communications on the
-specified interface. Note that if there are already configured IPv6
+specified interface.
+Note that if there are already configured IPv6
addresses on that interface, all of them are marked as
.Dq tentative
and DAD will be performed when this flag is cleared.
@@ -666,9 +679,11 @@ Set a flag to enable Neighbor Unreachability Detection.
Clear a flag
.Cm nud .
.It Cm no_prefer_iface
-Set a flag to not prefer address on the interface as candidates of the
-source address for outgoing packets, even when the interface is
-outgoing interface.
+Set a flag to not honor rule 5 of source address selection in RFC 3484.
+In practice this means the address on the outgoing interface will not be
+preferred, effectively yielding the decision to the address selection
+policy table, configurable with
+.Xr ip6addrctl 8 .
.It Cm -no_prefer_iface
Clear a flag
.Cm no_prefer_iface .
@@ -1075,7 +1090,8 @@ specifies the number of beacon intervals between DTIM
and must be in the range 1 to 15.
By default DTIM is 1 (i.e., DTIM occurs at each beacon).
.It Cm quiet
-Enable the use of quiet IE. Hostap will use this to silence other
+Enable the use of quiet IE.
+Hostap will use this to silence other
stations to reduce interference for radar detection when
operating on 5GHz frequency and doth support is enabled.
Use
@@ -1090,9 +1106,11 @@ scheduled quiet intervals defined by Quiet element.
Set the QUIET
.Ar count
to the number of TBTTs until the beacon interval during which the
-next quiet interval shall start. A value of 1 indicates the quiet
+next quiet interval shall start.
+A value of 1 indicates the quiet
interval will start during the beacon interval starting at the next
-TBTT. A value 0 is reserved.
+TBTT.
+A value 0 is reserved.
.It Cm quiet_offset Ar offset
Set the QUIET
.Ar offset
@@ -2317,7 +2335,6 @@ src/dst address for IPv4 or IPv6.
.It Cm l4
src/dst port for TCP/UDP/SCTP.
.El
-.Pp
.El
.Pp
The following parameters are specific to IP tunnel interfaces,
@@ -2342,7 +2359,8 @@ Another name for the
parameter.
.It Cm accept_rev_ethip_ver
Set a flag to accept both correct EtherIP packets and ones
-with reversed version field. Enabled by default.
+with reversed version field.
+Enabled by default.
This is for backward compatibility with
.Fx 6.1 ,
6.2, 6.3, 7.0, and 7.1.
@@ -2351,7 +2369,8 @@ Clear a flag
.Cm accept_rev_ethip_ver .
.It Cm send_rev_ethip_ver
Set a flag to send EtherIP packets with reversed version
-field intentionally. Disabled by default.
+field intentionally.
+Disabled by default.
This is for backward compatibility with
.Fx 6.1 ,
6.2, 6.3, 7.0, and 7.1.
@@ -2434,7 +2453,7 @@ pseudo-interface.
The
.Xr vlan 4
interface is assigned a
-copy of the parent interface's flags and the parent's ethernet address.
+copy of the parent interface's flags and the parent's Ethernet address.
The
.Cm vlandev
and
@@ -2554,6 +2573,11 @@ The
.Fl l
flag may be used to list all available interfaces on the system, with
no other additional information.
+If an
+.Ar address_family
+is specified, only interfaces of that type will be listed.
+.Fl l Dq ether
+will list only Ethernet adapters, excluding the loopback interface.
Use of this flag is mutually exclusive
with all other flags and commands, except for
.Fl d
OpenPOWER on IntegriCloud