Page MenuHomeFreeBSD

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

Authored by nc on Feb 29 2020, 1:01 AM.
Referenced Files
Unknown Object (File)
Fri, Apr 19, 1:34 PM
Unknown Object (File)
Wed, Apr 3, 7:58 AM
Unknown Object (File)
Mar 18 2024, 12:05 PM
Unknown Object (File)
Feb 14 2024, 9:34 PM
Unknown Object (File)
Jan 16 2024, 10:03 PM
Unknown Object (File)
Dec 25 2023, 3:04 AM
Unknown Object (File)
Dec 20 2023, 5:02 AM
Unknown Object (File)
Nov 26 2023, 3:27 PM

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 - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

donner 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.

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

Unbreak build on recent CURRENT by using memcpy.

In D23888#565421, @neel_neelc.org wrote:

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.

In D23888#565423, @lutz_donnerhacke.de wrote:
In D23888#565421, @neel_neelc.org wrote:

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.