mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 22:10:40 +08:00
Update to FreeBSD head 2016-12-10
Git mirror commit 80c55f08a05ab3b26a73b226ccb56adc3122a55c.
This commit is contained in:
@@ -367,6 +367,8 @@ void decide_address_family(struct node_host *, sa_family_t *);
|
||||
void remove_invalid_hosts(struct node_host **, sa_family_t *);
|
||||
int invalid_redirect(struct node_host *, sa_family_t);
|
||||
u_int16_t parseicmpspec(char *, sa_family_t);
|
||||
int kw_casecmp(const void *, const void *);
|
||||
int map_tos(char *string, int *);
|
||||
|
||||
static TAILQ_HEAD(loadanchorshead, loadanchors)
|
||||
loadanchorshead = TAILQ_HEAD_INITIALIZER(loadanchorshead);
|
||||
@@ -2346,7 +2348,7 @@ pfrule : action dir logquick interface route af proto fromto
|
||||
memcpy(&r.rpool.key, $5.key,
|
||||
sizeof(struct pf_poolhashkey));
|
||||
}
|
||||
if (r.rt && r.rt != PF_FASTROUTE) {
|
||||
if (r.rt) {
|
||||
decide_address_family($5.host, &r.af);
|
||||
remove_invalid_hosts(&$5.host, &r.af);
|
||||
if ($5.host == NULL) {
|
||||
@@ -3600,15 +3602,17 @@ icmp6type : STRING {
|
||||
;
|
||||
|
||||
tos : STRING {
|
||||
if (!strcmp($1, "lowdelay"))
|
||||
$$ = IPTOS_LOWDELAY;
|
||||
else if (!strcmp($1, "throughput"))
|
||||
$$ = IPTOS_THROUGHPUT;
|
||||
else if (!strcmp($1, "reliability"))
|
||||
$$ = IPTOS_RELIABILITY;
|
||||
else if ($1[0] == '0' && $1[1] == 'x')
|
||||
$$ = strtoul($1, NULL, 16);
|
||||
else
|
||||
int val;
|
||||
char *end;
|
||||
|
||||
if (map_tos($1, &val))
|
||||
$$ = val;
|
||||
else if ($1[0] == '0' && $1[1] == 'x') {
|
||||
errno = 0;
|
||||
$$ = strtoul($1, &end, 16);
|
||||
if (errno || *end != '\0')
|
||||
$$ = 256;
|
||||
} else
|
||||
$$ = 256; /* flag bad argument */
|
||||
if ($$ < 0 || $$ > 255) {
|
||||
yyerror("illegal tos value %s", $1);
|
||||
@@ -4432,8 +4436,9 @@ route : /* empty */ {
|
||||
$$.pool_opts = 0;
|
||||
}
|
||||
| FASTROUTE {
|
||||
/* backwards-compat */
|
||||
$$.host = NULL;
|
||||
$$.rt = PF_FASTROUTE;
|
||||
$$.rt = 0;
|
||||
$$.pool_opts = 0;
|
||||
}
|
||||
| ROUTETO routespec pool_opts {
|
||||
@@ -6269,6 +6274,57 @@ pfctl_load_anchors(int dev, struct pfctl *pf, struct pfr_buffer *trans)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
kw_casecmp(const void *k, const void *e)
|
||||
{
|
||||
return (strcasecmp(k, ((const struct keywords *)e)->k_name));
|
||||
}
|
||||
|
||||
int
|
||||
map_tos(char *s, int *val)
|
||||
{
|
||||
/* DiffServ Codepoints and other TOS mappings */
|
||||
const struct keywords toswords[] = {
|
||||
{ "af11", IPTOS_DSCP_AF11 },
|
||||
{ "af12", IPTOS_DSCP_AF12 },
|
||||
{ "af13", IPTOS_DSCP_AF13 },
|
||||
{ "af21", IPTOS_DSCP_AF21 },
|
||||
{ "af22", IPTOS_DSCP_AF22 },
|
||||
{ "af23", IPTOS_DSCP_AF23 },
|
||||
{ "af31", IPTOS_DSCP_AF31 },
|
||||
{ "af32", IPTOS_DSCP_AF32 },
|
||||
{ "af33", IPTOS_DSCP_AF33 },
|
||||
{ "af41", IPTOS_DSCP_AF41 },
|
||||
{ "af42", IPTOS_DSCP_AF42 },
|
||||
{ "af43", IPTOS_DSCP_AF43 },
|
||||
{ "critical", IPTOS_PREC_CRITIC_ECP },
|
||||
{ "cs0", IPTOS_DSCP_CS0 },
|
||||
{ "cs1", IPTOS_DSCP_CS1 },
|
||||
{ "cs2", IPTOS_DSCP_CS2 },
|
||||
{ "cs3", IPTOS_DSCP_CS3 },
|
||||
{ "cs4", IPTOS_DSCP_CS4 },
|
||||
{ "cs5", IPTOS_DSCP_CS5 },
|
||||
{ "cs6", IPTOS_DSCP_CS6 },
|
||||
{ "cs7", IPTOS_DSCP_CS7 },
|
||||
{ "ef", IPTOS_DSCP_EF },
|
||||
{ "inetcontrol", IPTOS_PREC_INTERNETCONTROL },
|
||||
{ "lowdelay", IPTOS_LOWDELAY },
|
||||
{ "netcontrol", IPTOS_PREC_NETCONTROL },
|
||||
{ "reliability", IPTOS_RELIABILITY },
|
||||
{ "throughput", IPTOS_THROUGHPUT }
|
||||
};
|
||||
const struct keywords *p;
|
||||
|
||||
p = bsearch(s, toswords, sizeof(toswords)/sizeof(toswords[0]),
|
||||
sizeof(toswords[0]), kw_casecmp);
|
||||
|
||||
if (p) {
|
||||
*val = p->k_val;
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
rt_tableid_max(void)
|
||||
{
|
||||
|
@@ -1364,7 +1364,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth)
|
||||
else
|
||||
snprintf(&path[len], MAXPATHLEN - len,
|
||||
"%s", r->anchor->name);
|
||||
name = path;
|
||||
name = r->anchor->name;
|
||||
} else
|
||||
name = r->anchor->path;
|
||||
} else
|
||||
|
@@ -103,7 +103,7 @@ TAILQ_HEAD(superblocks, superblock);
|
||||
* Description of the PF rule structure.
|
||||
*/
|
||||
enum {
|
||||
BARRIER, /* the presence of the field puts the rule in it's own block */
|
||||
BARRIER, /* the presence of the field puts the rule in its own block */
|
||||
BREAK, /* the field may not differ between rules in a superblock */
|
||||
NOMERGE, /* the field may not differ between rules when combined */
|
||||
COMBINED, /* the field may itself be combined with other rules */
|
||||
@@ -127,7 +127,7 @@ static struct pf_rule_field pf_rule_desc[] = {
|
||||
|
||||
|
||||
/*
|
||||
* The presence of these fields in a rule put the rule in it's own
|
||||
* The presence of these fields in a rule put the rule in its own
|
||||
* superblock. Thus it will not be optimized. It also prevents the
|
||||
* rule from being re-ordered at all.
|
||||
*/
|
||||
|
@@ -790,12 +790,8 @@ print_rule(struct pf_rule *r, const char *anchor_call, int verbose, int numeric)
|
||||
printf(" reply-to");
|
||||
else if (r->rt == PF_DUPTO)
|
||||
printf(" dup-to");
|
||||
else if (r->rt == PF_FASTROUTE)
|
||||
printf(" fastroute");
|
||||
if (r->rt != PF_FASTROUTE) {
|
||||
printf(" ");
|
||||
print_pool(&r->rpool, 0, 0, r->af, PF_PASS);
|
||||
}
|
||||
printf(" ");
|
||||
print_pool(&r->rpool, 0, 0, r->af, PF_PASS);
|
||||
}
|
||||
if (r->af) {
|
||||
if (r->af == AF_INET)
|
||||
|
Reference in New Issue
Block a user