[Differential] D23737: nat64: Get the IPv4 address from a NAT64 address when comparing addresses in a ICMP translate

neel_neelc.org (Neel Chauhan) phabric-noreply at FreeBSD.org
Wed Feb 19 16:33:11 UTC 2020


neel_neelc.org updated this revision to Diff 68545.
neel_neelc.org added a comment.


  I decided to use the existing function nat64_extract_ip4() to extract the IPv4 and removed my nat64_get_ip4().
  
  I'm new to the FreeBSD TCP/IP stack, sorry.

REPOSITORY
  rS FreeBSD src repository

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D23737?vs=68489&id=68545

CHANGES SINCE LAST ACTION
  https://reviews.freebsd.org/D23737/new/

REVISION DETAIL
  https://reviews.freebsd.org/D23737

AFFECTED FILES
  sys/netpfil/ipfw/nat64/nat64_translate.c

CHANGE DETAILS

diff --git a/sys/netpfil/ipfw/nat64/nat64_translate.c b/sys/netpfil/ipfw/nat64/nat64_translate.c
--- a/sys/netpfil/ipfw/nat64/nat64_translate.c
+++ b/sys/netpfil/ipfw/nat64/nat64_translate.c
@@ -1061,19 +1061,16 @@
 		    m->m_pkthdr.len);
 		goto freeit;
 	}
-#if 0
 	/*
 	 * Check that inner source matches the outer destination.
-	 * XXX: We need some method to convert IPv4 into IPv6 address here,
-	 *	and compare IPv6 addresses.
 	 */
-	if (ip.ip_src.s_addr != nat64_get_ip4(&ip6->ip6_dst)) {
-		DPRINTF(DP_GENERIC, "Inner source doesn't match destination ",
+	if (ip.ip_src.s_addr !=
+	    nat64_extract_ip4(&ip6->ip6_dst, cfg->plat_plen)) {
+		DPRINTF(DP_GENERIC, "Inner source doesn't match destination: "
 		    "%04x vs %04x", ip.ip_src.s_addr,
-		    nat64_get_ip4(&ip6->ip6_dst));
+		    nat64_extract_ip4(&ip6->ip6_dst, cfg->plat_plen));
 		goto freeit;
 	}
-#endif
 	/*
 	 * Create new mbuf for ICMPv6 datagram.
 	 * NOTE: len is data length just after inner IP header.



EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: neel_neelc.org, ae
Cc: imp, ae, melifaro, #contributor_reviews_base, freebsd-net-list, mmacy, kpraveen.lkml_gmail.com, marcnarc_gmail.com, simonvella_gmail.com, novice_techie.com, tommi.pernila_iki.fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23737.68545.patch
Type: text/x-patch
Size: 986 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20200219/0a457c63/attachment.bin>


More information about the freebsd-net mailing list