ipfw: Support {w:x:y::z}:port (bracketed) IPv6 addresses in the fwd command.
While we're doing this, optimize by not attempting to parse addresses if we're using tableargs.
Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential D24011
ipfw: Support [w:x:y::z]:port (bracketed) IPv6 addresses in the fwd command nc on Mar 10 2020, 3:57 AM. Authored by Tags Referenced Files
Subscribers
Details ipfw: Support {w:x:y::z}:port (bracketed) IPv6 addresses in the fwd command. While we're doing this, optimize by not attempting to parse addresses if we're using tableargs. Submitted by: Neel Chauhan <neel AT neelc DOT org> Try compiling HEAD with this patch (or at least /usr/src/sbin/ipfw) and then run the following command: ipfw add fwd "[::1]:3128" tcp from any to any It should work
Diff Detail
Event TimelineComment Actions How about detecting the port separator first? (i.e. repeatly call strpbrk)
Comment Actions getaddrinfo let you simplify this even more:
Do not try to parse things, which are already handled by gai. Comment Actions Your IPv4 suggestion is wrong. There can be IPv6 addresses without letters, like 2001:470:20::2, or 2600::1. Also, your suggestions would require rewriting of the IP parsing code I modify, so I'd prefer not to do this unless necessary. However, it's possible with my code that you can do IPv4 in brackets, like [1.2.3.4]:56789. I don't believe this causes any harm, but if it does I'm open to modifications or even the "rewrite" I mentioned earlier. Comment Actions That would be my approach https://reviews.freebsd.org/differential/diff/69565/
Comment Actions Here, I resolve two of three of rgrimes' suggestions. About the hostnamed tablearg, I believe it should stay the same (CLARIFICATION: as it is today) but did not test this.
Comment Actions This looks ok to me modulo the nits I pointed out.
|