From 884be75cce8274ec6d3080de5bc49e6dd4338baa Mon Sep 17 00:00:00 2001 From: Thomas Moestl Date: Thu, 4 Sep 2003 15:57:37 +0000 Subject: [PATCH] Apply a bandaid to get this working on sparc64 again; the introduction of do_cmd() broke things, because this function assumes that a socklen_t is large enough to hold a pointer. A real solution to this problem would be a rewrite of do_cmd() to treat the optlen parameter consistently and not use it to carry a pointer or integer dependent on the context. --- sbin/ipfw/ipfw2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index bec3c2a3c7c5..c8a03017f405 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -363,7 +363,7 @@ align_uint64(uint64_t *pll) { * conditionally runs the command. */ static int -do_cmd(int optname, void *optval, socklen_t optlen) +do_cmd(int optname, void *optval, uintptr_t optlen) { static int s = -1; /* the socket */ int i; @@ -1556,7 +1556,7 @@ sets_handler(int ac, char *av[]) nbytes = sizeof(struct ip_fw); if ((data = calloc(1, nbytes)) == NULL) err(EX_OSERR, "calloc"); - if (do_cmd(IP_FW_GET, data, (socklen_t)&nbytes) < 0) + if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_FW_GET)"); bcopy(&((struct ip_fw *)data)->next_rule, &set_disable, sizeof(set_disable)); @@ -1701,7 +1701,7 @@ list(int ac, char *av[], int show_counters) nbytes = nalloc; if ((data = realloc(data, nbytes)) == NULL) err(EX_OSERR, "realloc"); - if (do_cmd(ocmd, data, (socklen_t)&nbytes) < 0) + if (do_cmd(ocmd, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_%s_GET)", do_pipe ? "DUMMYNET" : "FW"); } @@ -3493,7 +3493,7 @@ add(int ac, char *av[]) rule->cmd_len = (uint32_t *)dst - (uint32_t *)(rule->cmd); i = (char *)dst - (char *)rule; - if (do_cmd(IP_FW_ADD, rule, (socklen_t)&i) == -1) + if (do_cmd(IP_FW_ADD, rule, (uintptr_t)&i) == -1) err(EX_UNAVAILABLE, "getsockopt(%s)", "IP_FW_ADD"); if (!do_quiet) show_ipfw(rule, 0, 0);