Opened 8 years ago

Closed 8 years ago

#1239 closed defect (fixed)

Multiple IP address UDP response error

Reported by: wu3396@… Owned by:
Priority: minor Milestone: 1.11
Component: other Version: 1.11.x
Keywords: Cc:
uname -a: Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.11.13
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
configure arguments: --prefix=/usr/local/nginx --with-stream --without-http

Description

### nginx conf
sh-4.2#cat nginx.conf
user nobody;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {

worker_connections 1024;

}
stream {

server {

listen 10000 udp;
return $time_iso8601;
error_log /var/log/nginx/error.log;

}

}

### server ipaddress
sh-4.2# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000

inet 172.22.12.8/23 brd 172.22.13.255 scope global eth0

valid_lft forever preferred_lft forever

inet 172.22.12.67/32 scope global eth0

valid_lft forever preferred_lft forever

#### The client tests are normal (connection ip: 172.22.12.8 ) ############
sh-4.2# nc -u 172.22.12.8 10000

2017-04-07T16:48:25+08:00
2017-04-07T16:48:27+08:00^C

sh-4.2#

#### no response ! (connection ip: 172.22.12.67 ) ############
sh-4.2# nc -u 172.22.12.67 10000

C
sh-4.2#

### server tcpdump ############
sh-4.2# tcpdump -ln -i eth0 port 10000
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes

16:48:25.414499 IP 172.22.12.6.19160 > 172.22.12.8.ndmp: UDP, length 1
16:48:25.414722 IP 172.22.12.8.ndmp > 172.22.12.6.19160: UDP, length 25
16:48:27.814346 IP 172.22.12.6.19160 > 172.22.12.8.ndmp: UDP, length 1
16:48:27.814461 IP 172.22.12.8.ndmp > 172.22.12.6.19160: UDP, length 25


16:49:27.023198 IP 172.22.12.6.59931 > 172.22.12.67.ndmp: UDP, length 1
16:49:27.023475 IP 172.22.12.8.ndmp > 172.22.12.6.59931: UDP, length 25
### source ip is should be 172.22.12.67 instead of 172.22.12.8 ########

16:49:28.798889 IP 172.22.12.6.59931 > 172.22.12.67.ndmp: UDP, length 1
16:49:28.799039 IP 172.22.12.8.ndmp > 172.22.12.6.59931: UDP, length 25
16:49:30.551067 IP 172.22.12.6.59931 > 172.22.12.67.ndmp: UDP, length 1
16:49:30.551255 IP 172.22.12.8.ndmp > 172.22.12.6.59931: UDP, length 25

C
10 packets captured
10 packets received by filter
0 packets dropped by kernel
sh-4.2#

Attachments (1)

udp-send-addr (3.8 KB ) - added by Roman Arutyunyan 8 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Roman Arutyunyan, 8 years ago

Thanks for reporting this.
Please try the patch.

by Roman Arutyunyan, 8 years ago

Attachment: udp-send-addr added

comment:2 by wu3396@…, 8 years ago

Use the patch to work properly
Thanks

comment:3 by Roman Arutyunyan <arut@…>, 8 years ago

In 6980:dbb0c854e308/nginx:

Set UDP datagram source address (ticket #1239).

Previously, the source IP address of a response UDP datagram could differ from
the original datagram destination address. This could happen if the server UDP
socket is bound to a wildcard address and the network interface chosen to output
the response packet has a different default address than the destination address
of the original packet. For example, if two addresses from the same network are
configured on an interface.

Now source address is set explicitly if a response is sent for a server UDP
socket bound to a wildcard address.

comment:4 by Roman Arutyunyan, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.