summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2004-01-25 18:47:15 +0000
committerderaadt <deraadt@openbsd.org>2004-01-25 18:47:15 +0000
commit715eb238ac4221868285c1ce75a7cdb77f0895a8 (patch)
tree6fa8d30b117d88dabda76a5f72693bc3331030db
parentFix entry point and crtbegin/crtend. slight ok espie millert (diff)
downloadwireguard-openbsd-715eb238ac4221868285c1ce75a7cdb77f0895a8.tar.xz
wireguard-openbsd-715eb238ac4221868285c1ce75a7cdb77f0895a8.zip
This fix was made WITHOUT RUNNING REGRESS. Henning, you are being
extremely unfluffy, King Bula is coming for your head.
-rw-r--r--sbin/pfctl/pfctl_parser.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 2210715811b..2979e2115f1 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.188 2004/01/22 13:32:00 henning Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.189 2004/01/25 18:47:15 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1326,27 +1326,20 @@ host_v4(const char *s, int mask)
{
struct node_host *h = NULL;
struct in_addr ina;
- int bits = -1;
+ int bits;
memset(&ina, 0, sizeof(struct in_addr));
- if (strrchr(s, '/') != NULL) {
- if ((bits = inet_net_pton(AF_INET, s, &ina, sizeof(ina))) == -1)
- return (NULL);
- } else {
- if (inet_pton(AF_INET, s, &ina) != 1)
- return (NULL);
- }
-
- h = calloc(1, sizeof(struct node_host));
- if (h == NULL)
- err(1, "address: calloc");
- h->ifname = NULL;
- h->af = AF_INET;
- h->addr.v.a.addr.addr32[0] = ina.s_addr;
- if (bits != -1)
+ if ((bits = inet_net_pton(AF_INET, s, &ina, sizeof(ina))) > -1) {
+ h = calloc(1, sizeof(struct node_host));
+ if (h == NULL)
+ err(1, "address: calloc");
+ h->ifname = NULL;
+ h->af = AF_INET;
+ h->addr.v.a.addr.addr32[0] = ina.s_addr;
set_ipmask(h, bits);
- h->next = NULL;
- h->tail = h;
+ h->next = NULL;
+ h->tail = h;
+ }
return (h);
}