This has been unused for years.
While here, zap the duplicate function signature from pfctl.h (already
present in pfctl_parser.h); spotted by sashan, thanks.
OK sashan
-/* $OpenBSD: parse.y,v 1.682 2018/07/16 08:29:08 kn Exp $ */
+/* $OpenBSD: parse.y,v 1.683 2018/09/06 15:07:33 kn Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
if (b->af != e->af ||
b->addr.type != PF_ADDR_ADDRMASK ||
e->addr.type != PF_ADDR_ADDRMASK ||
- unmask(&b->addr.v.a.mask, b->af) !=
+ unmask(&b->addr.v.a.mask) !=
(b->af == AF_INET ? 32 : 128) ||
- unmask(&e->addr.v.a.mask, e->af) !=
+ unmask(&e->addr.v.a.mask) !=
(e->af == AF_INET ? 32 : 128) ||
b->next != NULL || b->not ||
e->next != NULL || e->not) {
sizeof(a)) == NULL)
snprintf(tmp, sizeof(tmp), "?");
else {
- bits = unmask(&h->addr.v.a.mask, af);
+ bits = unmask(&h->addr.v.a.mask);
if ((af == AF_INET && bits < 32) ||
(af == AF_INET6 && bits < 128))
snprintf(tmp, sizeof(tmp),
-/* $OpenBSD: pf_print_state.c,v 1.66 2018/09/06 14:46:36 kn Exp $ */
+/* $OpenBSD: pf_print_state.c,v 1.67 2018/09/06 15:07:33 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
if (addr->type != PF_ADDR_RANGE &&
!(PF_AZERO(&addr->v.a.addr, AF_INET6) &&
PF_AZERO(&addr->v.a.mask, AF_INET6))) {
- int bits = unmask(&addr->v.a.mask, af);
+ int bits = unmask(&addr->v.a.mask);
if (bits < (af == AF_INET ? 32 : 128))
printf("/%d", bits);
}
int
-unmask(struct pf_addr *m, sa_family_t af)
+unmask(struct pf_addr *m)
{
int i = 31, j = 0, b = 0;
u_int32_t tmp;
-/* $OpenBSD: pfctl.h,v 1.56 2018/07/24 09:48:04 kn Exp $ */
+/* $OpenBSD: pfctl.h,v 1.57 2018/09/06 15:07:33 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
void print_host(struct pf_addr *, u_int16_t p, sa_family_t, u_int16_t, const char *, int);
void print_seq(struct pfsync_state_peer *);
void print_state(struct pfsync_state *, int);
-int unmask(struct pf_addr *, sa_family_t);
int pfctl_cmdline_symset(char *);
int pfctl_add_trans(struct pfr_buffer *, int, const char *);
-/* $OpenBSD: pfctl_optimize.c,v 1.38 2017/11/25 22:20:06 sashan Exp $ */
+/* $OpenBSD: pfctl_optimize.c,v 1.39 2018/09/06 15:07:33 kn Exp $ */
/*
* Copyright (c) 2004 Mike Frantzen <frantzen@openbsd.org>
#ifdef OPT_DEBUG
DEBUG("<%s> adding %s/%d", (*tbl)->pt_name, inet_ntop(af,
&node_host.addr.v.a.addr, buf, sizeof(buf)),
- unmask(&node_host.addr.v.a.mask, af));
+ unmask(&node_host.addr.v.a.mask);
#endif /* OPT_DEBUG */
if (append_addr_host((*tbl)->pt_buf, &node_host, 0, 0)) {
sub->src.addr.type == PF_ADDR_ADDRMASK &&
super->src.neg == sub->src.neg &&
super->af == sub->af &&
- unmask(&super->src.addr.v.a.mask, super->af) <
- unmask(&sub->src.addr.v.a.mask, sub->af) &&
+ unmask(&super->src.addr.v.a.mask) <
+ unmask(&sub->src.addr.v.a.mask) &&
super->src.addr.v.a.addr.addr32[0] ==
(sub->src.addr.v.a.addr.addr32[0] &
super->src.addr.v.a.mask.addr32[0]) &&
sub->dst.addr.type == PF_ADDR_ADDRMASK &&
super->dst.neg == sub->dst.neg &&
super->af == sub->af &&
- unmask(&super->dst.addr.v.a.mask, super->af) <
- unmask(&sub->dst.addr.v.a.mask, sub->af) &&
+ unmask(&super->dst.addr.v.a.mask) <
+ unmask(&sub->dst.addr.v.a.mask) &&
super->dst.addr.v.a.addr.addr32[0] ==
(sub->dst.addr.v.a.addr.addr32[0] &
super->dst.addr.v.a.mask.addr32[0]) &&
-/* $OpenBSD: pfctl_parser.c,v 1.329 2018/09/05 21:16:26 kn Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.330 2018/09/06 15:07:33 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
if (af == AF_INET &&
(m->addr32[1] || m->addr32[2] || m->addr32[3])) {
fprintf(stderr, "netmask %u invalid for IPv4 address\n",
- unmask(m, AF_INET6));
+ unmask(m));
return (1);
}
}
/* fix up netmask */
m = &n->addr.v.a.mask;
- if (af == AF_INET && unmask(m, AF_INET6) > 32)
+ if (af == AF_INET && unmask(m))
set_ipmask(n, 32);
return (n);
memcpy(&n->addr.v.a.addr, &p->addr.v.a.addr,
sizeof(struct pf_addr));
if (flags & PFI_AFLAG_NETWORK)
- set_ipmask(n, unmask(&p->addr.v.a.mask, n->af));
+ set_ipmask(n, unmask(&p->addr.v.a.mask));
else {
if (n->af == AF_INET &&
p->ifa_flags & IFF_LOOPBACK &&
bzero(&addr, sizeof(addr));
addr.pfra_not = n->not ^ not;
addr.pfra_af = n->af;
- addr.pfra_net = unmask(&n->addr.v.a.mask, n->af);
+ addr.pfra_net = unmask(&n->addr.v.a.mask);
if (n->ifname) {
if (strlcpy(addr.pfra_ifname, n->ifname,
sizeof(addr.pfra_ifname)) >= sizeof(addr.pfra_ifname))
-/* $OpenBSD: pfctl_parser.h,v 1.111 2018/09/05 21:16:26 kn Exp $ */
+/* $OpenBSD: pfctl_parser.h,v 1.112 2018/09/06 15:07:34 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
void set_ipmask(struct node_host *, int);
int check_netmask(struct node_host *, sa_family_t);
-int unmask(struct pf_addr *, sa_family_t);
+int unmask(struct pf_addr *);
struct node_host *gen_dynnode(struct node_host *, sa_family_t);
void ifa_load(void);
unsigned int ifa_nametoindex(const char *);