-/* $OpenBSD: pfctl_parser.c,v 1.326 2018/07/31 22:48:04 kn Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.327 2018/08/10 09:54:06 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
{
struct node_host *h = NULL;
struct in_addr ina;
- int bits = 32;
- memset(&ina, 0, sizeof(struct in_addr));
- if (strrchr(s, '/') != NULL) {
- if ((bits = inet_net_pton(AF_INET, s, &ina, sizeof(ina))) == -1)
+ memset(&ina, 0, sizeof(ina));
+ if (mask > -1) {
+ if (inet_net_pton(AF_INET, s, &ina, sizeof(ina)) == -1)
return (NULL);
} else {
if (inet_pton(AF_INET, s, &ina) != 1)
h->ifname = NULL;
h->af = AF_INET;
h->addr.v.a.addr.addr32[0] = ina.s_addr;
- set_ipmask(h, bits);
+ set_ipmask(h, mask > -1 ? mask : 32);
h->next = NULL;
h->tail = h;