Update to FreeBSD head 2018-06-01

Git mirror commit fb63610a69b0eb7f69a201ba05c4c1a7a2739cf9.

Update #3472.
This commit is contained in:
Sebastian Huber
2018-08-21 13:47:02 +02:00
parent 2df56dbd60
commit bcdce02d9b
340 changed files with 27754 additions and 11720 deletions

View File

@@ -851,11 +851,23 @@ bind_lease(struct interface_info *ip)
opt = &ip->client->new->options[DHO_INTERFACE_MTU];
if (opt->len == sizeof(u_int16_t)) {
u_int16_t mtu = be16dec(opt->data);
if (mtu < MIN_MTU)
warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU);
u_int16_t mtu = 0;
bool supersede = (ip->client->config->default_actions[DHO_INTERFACE_MTU] ==
ACTION_SUPERSEDE);
if (supersede)
mtu = getUShort(ip->client->config->defaults[DHO_INTERFACE_MTU].data);
else
mtu = be16dec(opt->data);
if (mtu < MIN_MTU) {
/* Treat 0 like a user intentionally doesn't want to change MTU and,
* therefore, warning is not needed */
if (!supersede || mtu != 0)
warning("mtu size %u < %d: ignored", (unsigned)mtu, MIN_MTU);
} else {
interface_set_mtu_unpriv(privfd, mtu);
}
}
/* Write out the new lease. */

View File

@@ -202,7 +202,7 @@ static void
clone_Copt_cb(const char *optarg __unused)
{
list_cloners();
exit(0);
exit(exit_code);
}
static struct option clone_Copt = { .opt = "C", .opt_usage = "[-C]", .cb = clone_Copt_cb };

View File

@@ -117,6 +117,7 @@ int printifname = 0;
int supmedia = 0;
int printkeys = 0; /* Print keying material for interfaces. */
int exit_code = 0;
/* Formatter Strings */
char *f_inet, *f_inet6, *f_ether, *f_addr;
@@ -566,7 +567,7 @@ main(int argc, char *argv[])
errx(1, "%s: cloning name too long",
ifname);
ifconfig(argc, argv, 1, NULL);
exit(0);
exit(exit_code);
}
#ifdef JAIL
/*
@@ -580,7 +581,7 @@ main(int argc, char *argv[])
errx(1, "%s: interface name too long",
ifname);
ifconfig(argc, argv, 0, NULL);
exit(0);
exit(exit_code);
}
#endif
errx(1, "interface %s does not exist", ifname);
@@ -678,7 +679,7 @@ main(int argc, char *argv[])
freeifaddrs(ifap);
freeformat();
exit(0);
exit(exit_code);
}
static struct afswtch *afs = NULL;
@@ -1573,8 +1574,8 @@ static struct cmd basic_cmds[] = {
DEF_CMD("-wol_magic", -IFCAP_WOL_MAGIC, setifcap),
DEF_CMD("txrtlmt", IFCAP_TXRTLMT, setifcap),
DEF_CMD("-txrtlmt", -IFCAP_TXRTLMT, setifcap),
DEF_CMD("hwrxtsmp", IFCAP_HWRXTSTMP, setifcap),
DEF_CMD("-hwrxtsmp", -IFCAP_HWRXTSTMP, setifcap),
DEF_CMD("hwrxtstmp", IFCAP_HWRXTSTMP, setifcap),
DEF_CMD("-hwrxtstmp", -IFCAP_HWRXTSTMP, setifcap),
DEF_CMD("normal", -IFF_LINK0, setifflags),
DEF_CMD("compress", IFF_LINK0, setifflags),
DEF_CMD("noicmp", IFF_LINK1, setifflags),

View File

@@ -136,6 +136,7 @@ extern int printkeys;
extern int newaddr;
extern int verbose;
extern int printifname;
extern int exit_code;
void setifcap(const char *, int value, int s, const struct afswtch *);

View File

@@ -162,7 +162,7 @@ printgroup(const char *groupname)
if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) {
if (errno == EINVAL || errno == ENOTTY ||
errno == ENOENT)
exit(0);
exit(exit_code);
else
err(1, "SIOCGIFGMEMB");
}
@@ -181,7 +181,7 @@ printgroup(const char *groupname)
}
free(ifgr.ifgr_groups);
exit(0);
exit(exit_code);
}
static struct cmd group_cmds[] = {

View File

@@ -53,9 +53,17 @@ setlaggport(const char *val, int d, int s, const struct afswtch *afp)
strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname));
strlcpy(rp.rp_portname, val, sizeof(rp.rp_portname));
/* Don't choke if the port is already in this lagg. */
if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST)
err(1, "SIOCSLAGGPORT");
/*
* Do not exit with an error here. Doing so permits a
* failed NIC to take down an entire lagg.
*
* Don't error at all if the port is already in the lagg.
*/
if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST) {
warnx("%s %s: SIOCSLAGGPORT: %s",
name, val, strerror(errno));
exit_code = 1;
}
}
static void

View File

@@ -195,14 +195,6 @@ media_status(int s)
printf("no carrier");
break;
case IFM_FDDI:
case IFM_TOKEN:
if (ifmr.ifm_status & IFM_ACTIVE)
printf("inserted");
else
printf("no ring");
break;
case IFM_IEEE80211:
if (ifmr.ifm_status & IFM_ACTIVE) {
/* NB: only sta mode associates */
@@ -430,24 +422,6 @@ static struct ifmedia_description ifm_subtype_ethernet_aliases[] =
static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] =
IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_tokenring_descriptions[] =
IFM_SUBTYPE_TOKENRING_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_tokenring_aliases[] =
IFM_SUBTYPE_TOKENRING_ALIASES;
static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
IFM_SUBTYPE_FDDI_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_fddi_aliases[] =
IFM_SUBTYPE_FDDI_ALIASES;
static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
@@ -521,42 +495,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
{ NULL, 0 },
},
},
{
{
{ &ifm_subtype_shared_descriptions[0], 0 },
{ &ifm_subtype_shared_aliases[0], 1 },
{ &ifm_subtype_tokenring_descriptions[0], 0 },
{ &ifm_subtype_tokenring_aliases[0], 1 },
{ NULL, 0 },
},
{
{ &ifm_shared_option_descriptions[0], 0 },
{ &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_tokenring_option_descriptions[0], 0 },
{ NULL, 0 },
},
{
{ NULL, 0 },
},
},
{
{
{ &ifm_subtype_shared_descriptions[0], 0 },
{ &ifm_subtype_shared_aliases[0], 1 },
{ &ifm_subtype_fddi_descriptions[0], 0 },
{ &ifm_subtype_fddi_aliases[0], 1 },
{ NULL, 0 },
},
{
{ &ifm_shared_option_descriptions[0], 0 },
{ &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_fddi_option_descriptions[0], 0 },
{ NULL, 0 },
},
{
{ NULL, 0 },
},
},
{
{
{ &ifm_subtype_shared_descriptions[0], 0 },

View File

@@ -15,6 +15,7 @@ RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern char *f_inet6);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern char name[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern int clearaddr);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern int doalias);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern int exit_code);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern int newaddr);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern int noload);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, extern int printifname);

View File

@@ -13,17 +13,11 @@ RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_ethernet_aliases[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_ethernet_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_fddi_aliases[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_fddi_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_fddi_option_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_ieee80211_aliases[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_ieee80211_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_shared_aliases[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_shared_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_tokenring_aliases[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_tokenring_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_description ifm_type_descriptions[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[]);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifconfig, static struct ifmediareq *ifmedia_getstate_ifmr);

View File

@@ -23,6 +23,7 @@
#define descr _bsd_ifconfig_descr
#define descrlen _bsd_ifconfig_descrlen
#define doalias _bsd_ifconfig_doalias
#define exit_code _bsd_ifconfig_exit_code
#define f_addr _bsd_ifconfig_f_addr
#define f_ether _bsd_ifconfig_f_ether
#define f_inet _bsd_ifconfig_f_inet

View File

@@ -85,6 +85,9 @@ void usage(void);
int pfctl_enable(int, int);
int pfctl_disable(int, int);
int pfctl_clear_stats(int, int);
int pfctl_get_skip_ifaces(void);
int pfctl_check_skip_ifaces(char *);
int pfctl_clear_skip_ifaces(struct pfctl *);
int pfctl_clear_interface_flags(int, int);
int pfctl_clear_rules(int, int, char *);
int pfctl_clear_nat(int, int, char *);
@@ -124,6 +127,7 @@ const char *pfctl_lookup_option(char *, const char * const *);
static struct pf_anchor_global pf_anchors;
static struct pf_anchor pf_main_anchor;
static struct pfr_buffer skip_b;
static const char *clearopt;
static char *rulesopt;
@@ -316,6 +320,44 @@ pfctl_clear_stats(int dev, int opts)
return (0);
}
int
pfctl_get_skip_ifaces(void)
{
bzero(&skip_b, sizeof(skip_b));
skip_b.pfrb_type = PFRB_IFACES;
for (;;) {
pfr_buf_grow(&skip_b, skip_b.pfrb_size);
skip_b.pfrb_size = skip_b.pfrb_msize;
if (pfi_get_ifaces(NULL, skip_b.pfrb_caddr, &skip_b.pfrb_size))
err(1, "pfi_get_ifaces");
if (skip_b.pfrb_size <= skip_b.pfrb_msize)
break;
}
return (0);
}
int
pfctl_check_skip_ifaces(char *ifname)
{
struct pfi_kif *p;
PFRB_FOREACH(p, &skip_b)
if ((p->pfik_flags & PFI_IFLAG_SKIP) && !strcmp(ifname, p->pfik_name))
p->pfik_flags &= ~PFI_IFLAG_SKIP;
return (0);
}
int
pfctl_clear_skip_ifaces(struct pfctl *pf)
{
struct pfi_kif *p;
PFRB_FOREACH(p, &skip_b)
if (p->pfik_flags & PFI_IFLAG_SKIP)
pfctl_set_interface_flags(pf, p->pfik_name, PFI_IFLAG_SKIP, 0);
return (0);
}
int
pfctl_clear_interface_flags(int dev, int opts)
{
@@ -1505,6 +1547,8 @@ pfctl_rules(int dev, char *filename, int opts, int optimize,
else
goto _error;
}
if (loadopt & PFCTL_FLAG_OPTION)
pfctl_clear_skip_ifaces(&pf);
if ((pf.loadopt & PFCTL_FLAG_FILTER &&
(pfctl_load_ruleset(&pf, path, rs, PF_RULESET_SCRUB, 0))) ||
@@ -1915,6 +1959,7 @@ pfctl_set_interface_flags(struct pfctl *pf, char *ifname, int flags, int how)
} else {
if (ioctl(pf->dev, DIOCSETIFFLAG, &pi))
err(1, "DIOCSETIFFLAG");
pfctl_check_skip_ifaces(ifname);
}
}
return (0);
@@ -2405,7 +2450,7 @@ main(int argc, char *argv[])
if ((rulesopt != NULL) && (loadopt & PFCTL_FLAG_OPTION) &&
!anchorname[0])
if (pfctl_clear_interface_flags(dev, opts | PF_OPT_QUIET))
if (pfctl_get_skip_ifaces())
error = 1;
if (rulesopt != NULL && !(opts & (PF_OPT_MERGE|PF_OPT_NOACTION)) &&

View File

@@ -79,11 +79,13 @@
#define pfctl_add_pool _bsd_pfctl_pfctl_add_pool
#define pfctl_add_rule _bsd_pfctl_pfctl_add_rule
#define pfctl_addrprefix _bsd_pfctl_pfctl_addrprefix
#define pfctl_check_skip_ifaces _bsd_pfctl_pfctl_check_skip_ifaces
#define pfctl_clear_altq _bsd_pfctl_pfctl_clear_altq
#define pfctl_clear_interface_flags _bsd_pfctl_pfctl_clear_interface_flags
#define pfctl_clear_nat _bsd_pfctl_pfctl_clear_nat
#define pfctl_clear_pool _bsd_pfctl_pfctl_clear_pool
#define pfctl_clear_rules _bsd_pfctl_pfctl_clear_rules
#define pfctl_clear_skip_ifaces _bsd_pfctl_pfctl_clear_skip_ifaces
#define pfctl_clear_src_nodes _bsd_pfctl_pfctl_clear_src_nodes
#define pfctl_clear_states _bsd_pfctl_pfctl_clear_states
#define pfctl_clear_stats _bsd_pfctl_pfctl_clear_stats
@@ -92,6 +94,7 @@
#define pfctl_enable _bsd_pfctl_pfctl_enable
#define pfctl_fopen _bsd_pfctl_pfctl_fopen
#define pfctl_get_pool _bsd_pfctl_pfctl_get_pool
#define pfctl_get_skip_ifaces _bsd_pfctl_pfctl_get_skip_ifaces
#define pfctl_id_kill_states _bsd_pfctl_pfctl_id_kill_states
#define pfctl_init_options _bsd_pfctl_pfctl_init_options
#define pfctl_kill_src_nodes _bsd_pfctl_pfctl_kill_src_nodes

View File

@@ -20,3 +20,4 @@ RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static int src_node_killers);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static int state_killers);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static struct pf_anchor pf_main_anchor);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static struct pf_anchor_global pf_anchors);
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static struct pfr_buffer skip_b);