[Bug 275774] IPv4 Mapper address problem

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 15 Dec 2023 12:25:16 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275774

            Bug ID: 275774
           Summary: IPv4 Mapper address problem
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: manu@freebsd.org
 Attachment #247054 text/plain
         mime type:

Created attachment 247054
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=247054&action=edit
udptest

Hi,
We have a problem at work with IPv4-Mapped address.

Attached is two test program, udptest and udptest_recv.
The first one send a udp datagram to 127.0.0.1 and if a response is received it
will send another one to the given ip address given in the first args.

So we have machine A and machine B.
- Start udptest_recv on machine A
- Start udptest_recv on machine B
- tcpdump -i lo0 on machine A
- Start udptest XXX.XXX.XXX.XXX (ipv4 of machine B) on machine A

What is expected :
- machine A send 'abcd' to 127.0.0.1
- machine A receive 'abcd'
- machine A sends back 'abcd' to machine A
- machine A send 'efgh' to machine B
- machine B receive 'efgh' from machine A

What is happening :
- machine A send 'abcd' to 127.0.0.1
- machine A receive 'abcd'
- machine A sends back 'abcd' to machine A
- machine A send 'efgh' to machine A
- machine A receive 'efgh' from machine A
- machine B receives nothing

tcpdump -i lo0 on machine A gives us :
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on lo0, link-type NULL (BSD loopback), snapshot length 262144 bytes
13:17:46.418063 IP 127.0.0.1.34254 > 127.0.0.1.1234: UDP, length 4
13:17:46.418233 IP 127.0.0.1.1234 > 127.0.0.1.34254: UDP, length 4
13:17:46.418341 IP 192.168.1.51.34254 > 192.168.1.50.1234: UDP, length 4

192.168.1.51 is the IPv4 of machine A and 192.168.1.50 the one of machine B

So the second udp packet is send via lo0

Attached is also a patch that fixes it but we're not sure if that's the best
way or not as we don't have much knowledge of our IP stack.

On 13.2 the correct behavior is happening.
On 15-CURRENT (3494f7c019fc6558a99f63 from December 8 2023) it doesn't work.
Not tested on 14.0 (yet).

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