diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-04-04 09:36:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-04-04 14:46:23 +0200 |
commit | de8a76da2f374792594ce03a203b3f30e4889f6f (patch) | |
tree | 12b5e1e59358005c3c522955c08aee4795e4829c /freebsd/sbin | |
parent | Enable bridging by default (diff) | |
download | rtems-libbsd-de8a76da2f374792594ce03a203b3f30e4889f6f.tar.bz2 |
Update to FreeBSD head 2017-04-04
Git mirror commit 642b174daddbd0efd9bb5f242c43f4ab4db6869f.
Diffstat (limited to 'freebsd/sbin')
-rw-r--r-- | freebsd/sbin/dhclient/clparse.c | 4 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/dhclient.c | 31 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/af_inet.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/af_inet6.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/af_link.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/ifbridge.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/ifclone.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/ifconfig.c | 6 | ||||
-rw-r--r-- | freebsd/sbin/ifconfig/ifieee80211.c | 96 | ||||
-rw-r--r-- | freebsd/sbin/ping/ping.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/ping6/ping6.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/route/route.c | 10 | ||||
-rw-r--r-- | freebsd/sbin/sysctl/sysctl.c | 2 |
13 files changed, 128 insertions, 35 deletions
diff --git a/freebsd/sbin/dhclient/clparse.c b/freebsd/sbin/dhclient/clparse.c index 10df53b3..1bb0f957 100644 --- a/freebsd/sbin/dhclient/clparse.c +++ b/freebsd/sbin/dhclient/clparse.c @@ -514,6 +514,7 @@ parse_client_lease_statement(FILE *cfile, int is_static) token = peek_token(&val, cfile); if (token == EOF) { parse_warn("unterminated lease declaration."); + free_client_lease(lease); return; } if (token == RBRACE) @@ -715,6 +716,7 @@ parse_option_decl(FILE *cfile, struct option_data *options) parse_warn("expecting identifier after '.'"); if (token != SEMI) skip_to_semi(cfile); + free(vendor); return (NULL); } @@ -727,6 +729,7 @@ parse_option_decl(FILE *cfile, struct option_data *options) if (!universe) { parse_warn("no vendor named %s.", vendor); skip_to_semi(cfile); + free(vendor); return (NULL); } } else { @@ -748,6 +751,7 @@ parse_option_decl(FILE *cfile, struct option_data *options) parse_warn("no option named %s for vendor %s", val, vendor); skip_to_semi(cfile); + free(vendor); return (NULL); } diff --git a/freebsd/sbin/dhclient/dhclient.c b/freebsd/sbin/dhclient/dhclient.c index 46ffaffc..56d7cbf7 100644 --- a/freebsd/sbin/dhclient/dhclient.c +++ b/freebsd/sbin/dhclient/dhclient.c @@ -758,7 +758,11 @@ dhcpack(struct packet *packet) cancel_timeout(send_request, ip); /* Figure out the lease time. */ - if (ip->client->new->options[DHO_DHCP_LEASE_TIME].data) + if (ip->client->config->default_actions[DHO_DHCP_LEASE_TIME] == + ACTION_SUPERSEDE) + ip->client->new->expiry = getULong( + ip->client->config->defaults[DHO_DHCP_LEASE_TIME].data); + else if (ip->client->new->options[DHO_DHCP_LEASE_TIME].data) ip->client->new->expiry = getULong( ip->client->new->options[DHO_DHCP_LEASE_TIME].data); else @@ -771,21 +775,34 @@ dhcpack(struct packet *packet) if (ip->client->new->expiry < 60) ip->client->new->expiry = 60; - /* Take the server-provided renewal time if there is one; - otherwise figure it out according to the spec. */ - if (ip->client->new->options[DHO_DHCP_RENEWAL_TIME].len) + /* Unless overridden in the config, take the server-provided renewal + * time if there is one; otherwise figure it out according to the spec. + * Also make sure the renewal time does not exceed the expiry time. + */ + if (ip->client->config->default_actions[DHO_DHCP_RENEWAL_TIME] == + ACTION_SUPERSEDE) + ip->client->new->renewal = getULong( + ip->client->config->defaults[DHO_DHCP_RENEWAL_TIME].data); + else if (ip->client->new->options[DHO_DHCP_RENEWAL_TIME].len) ip->client->new->renewal = getULong( ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data); else ip->client->new->renewal = ip->client->new->expiry / 2; + if (ip->client->new->renewal > ip->client->new->expiry / 2) + ip->client->new->renewal = ip->client->new->expiry / 2; /* Same deal with the rebind time. */ - if (ip->client->new->options[DHO_DHCP_REBINDING_TIME].len) + if (ip->client->config->default_actions[DHO_DHCP_REBINDING_TIME] == + ACTION_SUPERSEDE) + ip->client->new->rebind = getULong( + ip->client->config->defaults[DHO_DHCP_REBINDING_TIME].data); + else if (ip->client->new->options[DHO_DHCP_REBINDING_TIME].len) ip->client->new->rebind = getULong( ip->client->new->options[DHO_DHCP_REBINDING_TIME].data); else - ip->client->new->rebind = ip->client->new->renewal + - ip->client->new->renewal / 2 + ip->client->new->renewal / 4; + ip->client->new->rebind = ip->client->new->renewal * 7 / 4; + if (ip->client->new->rebind > ip->client->new->renewal * 7 / 4) + ip->client->new->rebind = ip->client->new->renewal * 7 / 4; ip->client->new->expiry += cur_time; /* Lease lengths can never be negative. */ diff --git a/freebsd/sbin/ifconfig/af_inet.c b/freebsd/sbin/ifconfig/af_inet.c index 040da216..6b12cc22 100644 --- a/freebsd/sbin/ifconfig/af_inet.c +++ b/freebsd/sbin/ifconfig/af_inet.c @@ -16,7 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/freebsd/sbin/ifconfig/af_inet6.c b/freebsd/sbin/ifconfig/af_inet6.c index d3d58ade..f8f3b8ec 100644 --- a/freebsd/sbin/ifconfig/af_inet6.c +++ b/freebsd/sbin/ifconfig/af_inet6.c @@ -16,7 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/freebsd/sbin/ifconfig/af_link.c b/freebsd/sbin/ifconfig/af_link.c index 5fa2545d..0be5d388 100644 --- a/freebsd/sbin/ifconfig/af_link.c +++ b/freebsd/sbin/ifconfig/af_link.c @@ -16,7 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/freebsd/sbin/ifconfig/ifbridge.c b/freebsd/sbin/ifconfig/ifbridge.c index 26412a02..9e116912 100644 --- a/freebsd/sbin/ifconfig/ifbridge.c +++ b/freebsd/sbin/ifconfig/ifbridge.c @@ -221,7 +221,7 @@ bridge_interfaces(int s, const char *prefix) } printf("\n"); } - + free(pad); free(inbuf); } diff --git a/freebsd/sbin/ifconfig/ifclone.c b/freebsd/sbin/ifconfig/ifclone.c index 6dcd344c..c31da169 100644 --- a/freebsd/sbin/ifconfig/ifclone.c +++ b/freebsd/sbin/ifconfig/ifclone.c @@ -16,7 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/freebsd/sbin/ifconfig/ifconfig.c b/freebsd/sbin/ifconfig/ifconfig.c index 5f328994..521c37b8 100644 --- a/freebsd/sbin/ifconfig/ifconfig.c +++ b/freebsd/sbin/ifconfig/ifconfig.c @@ -16,7 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -1221,7 +1221,7 @@ unsetifdescr(const char *val, int value, int s, const struct afswtch *afp) "\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ "\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \ "\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \ -"\26RXCSUM_IPV6\27TXCSUM_IPV6" +"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT" /* * Print the status of the interface. If an address family was @@ -1535,6 +1535,8 @@ static struct cmd basic_cmds[] = { DEF_CMD("-wol_mcast", -IFCAP_WOL_MCAST, setifcap), DEF_CMD("wol_magic", IFCAP_WOL_MAGIC, setifcap), DEF_CMD("-wol_magic", -IFCAP_WOL_MAGIC, setifcap), + DEF_CMD("txrtlmt", IFCAP_TXRTLMT, setifcap), + DEF_CMD("-txrtlmt", -IFCAP_TXRTLMT, setifcap), DEF_CMD("normal", -IFF_LINK0, setifflags), DEF_CMD("compress", IFF_LINK0, setifflags), DEF_CMD("noicmp", IFF_LINK1, setifflags), diff --git a/freebsd/sbin/ifconfig/ifieee80211.c b/freebsd/sbin/ifconfig/ifieee80211.c index 3dcd926e..fd3e539b 100644 --- a/freebsd/sbin/ifconfig/ifieee80211.c +++ b/freebsd/sbin/ifconfig/ifieee80211.c @@ -1155,6 +1155,7 @@ set80211chanlist(const char *val, int d, int s, const struct afswtch *rafp) cp = tp; } set80211(s, IEEE80211_IOC_CHANLIST, 0, sizeof(chanlist), &chanlist); + free(temp); } static void @@ -1769,6 +1770,7 @@ set80211shortgi(const char *val, int d, int s, const struct afswtch *rafp) 0, NULL); } +/* XXX 11ac density/size is different */ static void set80211ampdu(const char *val, int d, int s, const struct afswtch *rafp) { @@ -1799,6 +1801,21 @@ set80211stbc(const char *val, int d, int s, const struct afswtch *rafp) set80211(s, IEEE80211_IOC_STBC, stbc, 0, NULL); } +static void +set80211ldpc(const char *val, int d, int s, const struct afswtch *rafp) +{ + int ldpc; + + if (get80211val(s, IEEE80211_IOC_LDPC, &ldpc) < 0) + errx(-1, "cannot set LDPC setting"); + if (d < 0) { + d = -d; + ldpc &= ~d; + } else + ldpc |= d; + set80211(s, IEEE80211_IOC_LDPC, ldpc, 0, NULL); +} + static DECL_CMD_FUNC(set80211ampdulimit, val, d) { @@ -1827,6 +1844,7 @@ DECL_CMD_FUNC(set80211ampdulimit, val, d) set80211(s, IEEE80211_IOC_AMPDU_LIMIT, v, 0, NULL); } +/* XXX 11ac density/size is different */ static DECL_CMD_FUNC(set80211ampdudensity, val, d) { @@ -3156,6 +3174,14 @@ printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen) uint16_t tlv_type = BE_READ_2(ie); uint16_t tlv_len = BE_READ_2(ie + 2); + /* some devices broadcast invalid WPS frames */ + if (tlv_len > len) { + printf("bad frame length tlv_type=0x%02x " + "tlv_len=%d len=%d", tlv_type, tlv_len, + len); + break; + } + ie += 4, len -= 4; switch (tlv_type) { @@ -3446,13 +3472,30 @@ printies(const u_int8_t *vp, int ielen, int maxcols) static void printmimo(const struct ieee80211_mimo_info *mi) { - /* NB: don't muddy display unless there's something to show */ - if (mi->rssi[0] != 0 || mi->rssi[1] != 0 || mi->rssi[2] != 0) { - /* XXX ignore EVM for now */ - printf(" (rssi %.1f:%.1f:%.1f nf %d:%d:%d)", - mi->rssi[0] / 2.0, mi->rssi[1] / 2.0, mi->rssi[2] / 2.0, - mi->noise[0], mi->noise[1], mi->noise[2]); + int i; + int r = 0; + + for (i = 0; i < IEEE80211_MAX_CHAINS; i++) { + if (mi->ch[i].rssi != 0) { + r = 1; + break; + } } + + /* NB: don't muddy display unless there's something to show */ + if (r == 0) + return; + + /* XXX TODO: ignore EVM; secondary channels for now */ + printf(" (rssi %.1f:%.1f:%.1f:%.1f nf %d:%d:%d:%d)", + mi->ch[0].rssi[0] / 2.0, + mi->ch[1].rssi[0] / 2.0, + mi->ch[2].rssi[0] / 2.0, + mi->ch[3].rssi[0] / 2.0, + mi->ch[0].noise[0], + mi->ch[1].noise[0], + mi->ch[2].noise[0], + mi->ch[3].noise[0]); } static void @@ -4932,6 +4975,7 @@ end: break; } } + /* XXX 11ac density/size is different */ if (get80211val(s, IEEE80211_IOC_AMPDU_LIMIT, &val) != -1) { switch (val) { case IEEE80211_HTCAP_MAXRXAMPDU_8K: @@ -4948,6 +4992,7 @@ end: break; } } + /* XXX 11ac density/size is different */ if (get80211val(s, IEEE80211_IOC_AMPDU_DENSITY, &val) != -1) { switch (val) { case IEEE80211_HTCAP_MPDUDENSITY_NA: @@ -5029,6 +5074,8 @@ end: else if (verbose) LINE_CHECK("-rifs"); } + + /* XXX VHT STBC? */ if (get80211val(s, IEEE80211_IOC_STBC, &val) != -1) { switch (val) { case 0: @@ -5046,6 +5093,23 @@ end: break; } } + if (get80211val(s, IEEE80211_IOC_LDPC, &val) != -1) { + switch (val) { + case 0: + LINE_CHECK("-ldpc"); + break; + case 1: + LINE_CHECK("ldpctx -ldpcrx"); + break; + case 2: + LINE_CHECK("-ldpctx ldpcrx"); + break; + case 3: + if (verbose) + LINE_CHECK("ldpc"); + break; + } + } } if (IEEE80211_IS_CHAN_VHT(c) || verbose) { @@ -5578,12 +5642,12 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD_ARG("bgscanidle", set80211bgscanidle), DEF_CMD_ARG("bgscanintvl", set80211bgscanintvl), DEF_CMD_ARG("scanvalid", set80211scanvalid), - DEF_CMD("quiet", 1, set80211quiet), - DEF_CMD("-quiet", 0, set80211quiet), - DEF_CMD_ARG("quiet_count", set80211quietcount), - DEF_CMD_ARG("quiet_period", set80211quietperiod), - DEF_CMD_ARG("quiet_dur", set80211quietduration), - DEF_CMD_ARG("quiet_offset", set80211quietoffset), + DEF_CMD("quiet", 1, set80211quiet), + DEF_CMD("-quiet", 0, set80211quiet), + DEF_CMD_ARG("quiet_count", set80211quietcount), + DEF_CMD_ARG("quiet_period", set80211quietperiod), + DEF_CMD_ARG("quiet_duration", set80211quietduration), + DEF_CMD_ARG("quiet_offset", set80211quietoffset), DEF_CMD_ARG("roam:rssi", set80211roamrssi), DEF_CMD_ARG("roam:rate", set80211roamrate), DEF_CMD_ARG("mcastrate", set80211mcastrate), @@ -5618,7 +5682,13 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD("stbctx", 1, set80211stbc), DEF_CMD("-stbctx", -1, set80211stbc), DEF_CMD("stbc", 3, set80211stbc), /* NB: tx+rx */ - DEF_CMD("-ampdu", -3, set80211stbc), + DEF_CMD("-stbc", -3, set80211stbc), + DEF_CMD("ldpcrx", 2, set80211ldpc), + DEF_CMD("-ldpcrx", -2, set80211ldpc), + DEF_CMD("ldpctx", 1, set80211ldpc), + DEF_CMD("-ldpctx", -1, set80211ldpc), + DEF_CMD("ldpc", 3, set80211ldpc), /* NB: tx+rx */ + DEF_CMD("-ldpc", -3, set80211ldpc), DEF_CMD("puren", 1, set80211puren), DEF_CMD("-puren", 0, set80211puren), DEF_CMD("doth", 1, set80211doth), diff --git a/freebsd/sbin/ping/ping.c b/freebsd/sbin/ping/ping.c index e8d962f3..304f308d 100644 --- a/freebsd/sbin/ping/ping.c +++ b/freebsd/sbin/ping/ping.c @@ -19,7 +19,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/freebsd/sbin/ping6/ping6.c b/freebsd/sbin/ping6/ping6.c index b8f565c6..382336a2 100644 --- a/freebsd/sbin/ping6/ping6.c +++ b/freebsd/sbin/ping6/ping6.c @@ -52,7 +52,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/freebsd/sbin/route/route.c b/freebsd/sbin/route/route.c index 5c32dd60..07a400fb 100644 --- a/freebsd/sbin/route/route.c +++ b/freebsd/sbin/route/route.c @@ -16,7 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -343,7 +343,7 @@ fiboptlist_range(const char *arg, struct fibl_head_t *flh) if (errno == 0) { if (*endptr != '\0' || fib[i] < 0 || - (numfibs != -1 && fib[i] > numfibs - 1)) + (numfibs != -1 && fib[i] > numfibs - 1)) errno = EINVAL; } if (errno) @@ -1195,7 +1195,7 @@ inet_makenetandmask(u_long net, struct sockaddr_in *sin, j <<= 8; } /* i holds the first non zero bit */ - bits = 32 - (i*8); + bits = 32 - (i*8); } if (bits != 0) mask = 0xffffffff << (32 - bits); @@ -1415,7 +1415,7 @@ prefixlen(const char *str) int max; char *p; - rtm_addrs |= RTA_NETMASK; + rtm_addrs |= RTA_NETMASK; switch (af) { #ifdef INET6 case AF_INET6: @@ -1449,7 +1449,7 @@ prefixlen(const char *str) if (len < 0 || max < len) errx(EX_USAGE, "%s: invalid prefixlen", str); - + q = len >> 3; r = len & 7; memset((void *)p, 0, max / 8); diff --git a/freebsd/sbin/sysctl/sysctl.c b/freebsd/sbin/sysctl/sysctl.c index 1c748035..2836da5d 100644 --- a/freebsd/sbin/sysctl/sysctl.c +++ b/freebsd/sbin/sysctl/sysctl.c @@ -16,7 +16,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * |