Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Mar 2018 04:27:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 226429] ipfw table add & hostname parsing
Message-ID:  <bug-226429-8-qoJm7p0DL5@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-226429-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-226429-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D226429

--- Comment #2 from Conrad Meyer <cem@freebsd.org> ---
I suggest this untested patch to correct the issue (and a similar issue with
legacy table values):

--- sbin/ipfw/tables.c    (revision 330627)
+++ sbin/ipfw/tables.c    (working copy)
@@ -1471,6 +1471,7 @@
        uint32_t i;
        int dval;
        char *comma, *e, *etype, *n, *p;
+       struct in_addr ipaddr;

        v =3D &tent->v.value;

@@ -1487,8 +1488,8 @@
                        return;
                }
                /* Try hostname */
-               if (lookup_host(arg, (struct in_addr *)&val) =3D=3D 0) {
-                       set_legacy_value(val, v);
+               if (lookup_host(arg, &ipaddr) =3D=3D 0) {
+                       set_legacy_value(ntohl(ipaddr.s_addr), v);
                        return;
                }
                errx(EX_OSERR, "Unable to parse value %s", arg);
@@ -1557,8 +1558,10 @@
                                v->nh4 =3D ntohl(a4);
                                break;
                        }
-                       if (lookup_host(n, (struct in_addr *)&v->nh4) =3D=
=3D 0)
+                       if (lookup_host(n, &ipaddr) =3D=3D 0) {
+                               v->nh4 =3D ntohl(ipaddr.s_addr);
                                break;
+                       }
                        etype =3D "ipv4";
                        break;
                case IPFW_VTYPE_DSCP:

Maybe you can try it out?

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-226429-8-qoJm7p0DL5>