Page MenuHomeFreeBSD

ipfw: Allow resolving of IPv6 DNS AAAA records in IPv6 table lookups
Needs ReviewPublic

Authored by neel_neelc.org on Feb 29 2020, 1:01 AM.

Details

Summary

ipfw: Allow resolving of IPv6 DNS AAAA records in IPv6 table lookups. Previously, only IPv4 A records were supported.

PR: 228338
Reported By: bugs.freebsd.org AT mx.zzux DOT com
Submitted by: Neel Chauhan <neel AT neelc DOT org>

Test Plan

Run the following commands:

ipfw table 6 create type addr valtype ipv6
ipfw table 6 add freebsd.org freebsd.org

IPv6 addresses should be added to the lookup table.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

neel_neelc.org created this revision.Feb 29 2020, 1:01 AM
neel_neelc.org edited the test plan for this revision. (Show Details)Feb 29 2020, 1:01 AM
lutz_donnerhacke.de added inline comments.
sbin/ipfw/tables.c
1211–1212
} else if ... {
1211–1212

Could we use the newly introduced getaddrinfo call to handle even the numerical cases?
How about setting the AF by the table flags and let's hand over the cases to the library function?

1218

Could we canonify the IPv4 and IPv6 fqdn cases into a single getaddrinfo call by just setting the address family differently?

1622–1623

What will happen, if this condition is removed, too?
IMHO the library will handle the cases internally.

Good catch. I didn't realize all this.

neel_neelc.org marked 4 inline comments as done.Feb 29 2020, 9:37 PM

Unbreak build on recent CURRENT by using memcpy.

Unbreak build on recent CURRENT by using memcpy.

Can you please explain, what the problem is?
Replacing a "struct assignment" by "memcpy" throws away several compile time checks while increasing the susceptibility to manual error.

Unbreak build on recent CURRENT by using memcpy.

Can you please explain, what the problem is?
Replacing a "struct assignment" by "memcpy" throws away several compile time checks while increasing the susceptibility to manual error.

I get this error:

/usr/src/sbin/ipfw/tables.c:1215:11: error: assigning to 'struct in6_addr' from
      incompatible type 'struct in_addr'
  ...*paddr = ((struct sockaddr_in *) res->ai_addr)->sin_addr;
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

However, I will try to find a workaround which doesn't involve memcpy.

Stop using memcpy here, instead use void pointers.