-/* $OpenBSD: ipsecctl.c,v 1.83 2017/11/20 10:51:24 mpi Exp $ */
+/* $OpenBSD: ipsecctl.c,v 1.84 2018/09/07 12:43:30 kn Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
int ipsecctl_monitor(int);
void usage(void);
const char *ipsecctl_lookup_option(char *, const char **);
-static int unmask(struct ipsec_addr *, sa_family_t);
+static int unmask(struct ipsec_addr *);
int sacompare(const void *, const void *);
const char *showopt;
else
printf("%s", buf);
- bits = unmask(&ipa->mask, ipa->af);
+ bits = unmask(&ipa->mask);
if (bits != (ipa->af == AF_INET ? 32 : 128))
printf("/%d", bits);
}
exit(error);
}
-/* ARGSUSED1 */
static int
-unmask(struct ipsec_addr *ipa, sa_family_t af)
+unmask(struct ipsec_addr *ipa)
{
int i = 31, j = 0, b = 0;
u_int32_t tmp;
-/* $OpenBSD: pftop.c,v 1.41 2018/02/08 07:00:33 martijn Exp $ */
+/* $OpenBSD: pftop.c,v 1.42 2018/09/07 12:43:30 kn Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar
* Copyright (c) 2001 Daniel Hartmeier
}
int
-unmask(struct pf_addr * m, u_int8_t af)
+unmask(struct pf_addr * m)
{
- int i = 31, j = 0, b = 0, msize;
+ int i = 31, j = 0, b = 0;
u_int32_t tmp;
- if (af == AF_INET)
- msize = 1;
- else
- msize = 4;
- while (j < msize && m->addr32[j] == 0xffffffff) {
+ while (j < 4 && m->addr32[j] == 0xffffffff) {
b += 32;
j++;
}
- if (j < msize) {
+ if (j < 4) {
tmp = ntohl(m->addr32[j]);
for (i = 31; tmp & (1 << i); --i)
b++;
if (mask != NULL) {
if (!PF_AZERO(mask, af))
- tbprintf("/%u", unmask(mask, af));
+ tbprintf("/%u", unmask(mask));
}
}