Ubuntu UDP Multicast not received on secondary interface - sockets

My test setup looks as following:
Ubuntu 22.4
Kernel 5.15.1025 Realtime
I210 enp1s0 (10.1.180.98)
I225 enp2s0 (10.1.180.97)
Netgear GS108 Switch
enp1s0 and enp2s0 are connected to the switch
sending UDP Packets over enp1s0 to multicast address 224.0.0.22
listening on enp2s0 (-> external loop back)
open62541 UDP pubsub
General:
ifconig
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.180.98 netmask 255.255.255.0 broadcast 10.1.180.255
inet6 fe80::36fc:cf83:b6f7:e7eb prefixlen 64 scopeid 0x20<link>
ether 00:07:32:a5:c3:88 txqueuelen 1000 (Ethernet)
RX packets 10823 bytes 3936173 (3.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 287226 bytes 29921782 (29.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x7fe00000-7fe1ffff
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.180.97 netmask 255.255.255.0 broadcast 10.1.180.255
inet6 fe80::a22:bab1:5e74:d3ad prefixlen 64 scopeid 0x20<link>
ether 00:07:32:a5:c3:89 txqueuelen 1000 (Ethernet)
RX packets 287442 bytes 29411683 (29.4 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3506 bytes 174754 (174.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x7fc00000-7fcfffff
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 10698 bytes 924534 (924.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10698 bytes 924534 (924.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.1.180.10 0.0.0.0 UG 0 0 0 enp1s0
0.0.0.0 10.1.180.10 0.0.0.0 UG 0 0 0 enp2s0
10.1.180.0 0.0.0.0 255.255.255.0 U 0 0 0 enp2s0
10.1.180.0 0.0.0.0 255.255.255.0 U 0 0 0 enp1s0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp2s0
# netstat -g
IPv6/IPv4 Group Memberships
Interface RefCnt Group
--------------- ------ ---------------------
lo 1 224.0.0.251
lo 1 224.0.0.1
enp1s0 1 224.0.0.251
enp1s0 1 224.0.0.1
enp2s0 1 224.0.0.22
enp2s0 1 224.0.0.251
enp2s0 1 224.0.0.1
lo 1 ff02::fb
lo 1 ip6-allnodes
lo 1 ff01::1
enp1s0 1 ff02::fb
enp1s0 1 ff02::1:fff7:e7eb
enp1s0 1 ip6-allnodes
enp1s0 1 ff01::1
enp2s0 1 ff02::fb
enp2s0 1 ff02::1:ff74:d3ad
enp2s0 1 ip6-allnodes
enp2s0 1 ff01::1
# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
befor sending:
# netstat -i
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
enp1s0 1500 12397 0 0 0 572786 0 0 0 BMRU
enp2s0 1500 562000 0 0 0 4015 0 0 0 BMRU
lo 65536 12782 0 0 0 12782 0 0 0 LRU
# netstat -s -u
IcmpMsg:
InType3: 6576
OutType3: 6576
Udp:
5710 packets received
902 packets to unknown port received
0 packet receive errors
576693 packets sent
0 receive buffer errors
0 send buffer errors
IgnoredMulti: 259
UdpLite:
IpExt:
InMcastPkts: 110
OutMcastPkts: 567399
InBcastPkts: 259
InOctets: 54256683
OutOctets: 52916072
InMcastOctets: 10142
OutMcastOctets: 50498445
InBcastOctets: 19383
InNoECTPkts: 574627
MPTcpExt:
# ethtool -S enp2s0 | grep rx
rx_packets: 561920
rx_bytes: 59893407
rx_broadcast: 5508
rx_multicast: 556412
rx_crc_errors: 0
rx_no_buffer_count: 0
rx_missed_errors: 0
rx_long_length_errors: 0
rx_short_length_errors: 0
rx_align_errors: 0
rx_flow_control_xon: 0
rx_flow_control_xoff: 0
rx_long_byte_count: 59893407
rx_smbus: 0
os2bmc_rx_by_bmc: 0
os2bmc_rx_by_host: 0
rx_hwtstamp_cleared: 0
rx_lpi_counter: 0
rx_errors: 0
rx_length_errors: 0
rx_over_errors: 0
rx_frame_errors: 0
rx_fifo_errors: 0
rx_queue_0_packets: 561750
rx_queue_0_bytes: 57629925
rx_queue_0_drops: 0
rx_queue_0_csum_err: 0
rx_queue_0_alloc_failed: 0
rx_queue_1_packets: 0
rx_queue_1_bytes: 0
rx_queue_1_drops: 0
rx_queue_1_csum_err: 0
rx_queue_1_alloc_failed: 0
rx_queue_2_packets: 148
rx_queue_2_bytes: 13290
rx_queue_2_drops: 0
rx_queue_2_csum_err: 0
rx_queue_2_alloc_failed: 0
rx_queue_3_packets: 22
rx_queue_3_bytes: 2512
rx_queue_3_drops: 0
rx_queue_3_csum_err: 0
rx_queue_3_alloc_failed: 0
after sending:
# netstat -i
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
enp1s0 1500 12465 0 0 0 618087 0 0 0 BMRU
enp2s0 1500 607349 0 0 0 4031 0 0 0 BMRU
lo 65536 12800 0 0 0 12800 0 0 0 LRU
# netstat -s -u
IcmpMsg:
InType3: 6588
OutType3: 6588
Udp:
5715 packets received
902 packets to unknown port received
0 packet receive errors
621972 packets sent
0 receive buffer errors
0 send buffer errors
IgnoredMulti: 263
UdpLite:
IpExt:
InMcastPkts: 112
OutMcastPkts: 612677
InBcastPkts: 263
InOctets: 58289081
OutOctets: 56953872
InMcastOctets: 10222
OutMcastOctets: 54527991
InBcastOctets: 19816
InNoECTPkts: 619936
MPTcpExt:
# ethtool -S enp2s0 | grep rx
rx_packets: 607351
rx_bytes: 64748001
rx_broadcast: 5666
rx_multicast: 601685
rx_crc_errors: 0
rx_no_buffer_count: 0
rx_missed_errors: 0
rx_long_length_errors: 0
rx_short_length_errors: 0
rx_align_errors: 0
rx_flow_control_xon: 0
rx_flow_control_xoff: 0
rx_long_byte_count: 64748001
rx_smbus: 0
os2bmc_rx_by_bmc: 0
os2bmc_rx_by_host: 0
rx_hwtstamp_cleared: 0
rx_lpi_counter: 0
rx_errors: 0
rx_length_errors: 0
rx_over_errors: 0
rx_frame_errors: 0
rx_fifo_errors: 0
rx_queue_0_packets: 607176
rx_queue_0_bytes: 62302224
rx_queue_0_drops: 0
rx_queue_0_csum_err: 0
rx_queue_0_alloc_failed: 0
rx_queue_1_packets: 0
rx_queue_1_bytes: 0
rx_queue_1_drops: 0
rx_queue_1_csum_err: 0
rx_queue_1_alloc_failed: 0
rx_queue_2_packets: 153
rx_queue_2_bytes: 13861
rx_queue_2_drops: 0
rx_queue_2_csum_err: 0
rx_queue_2_alloc_failed: 0
rx_queue_3_packets: 22
rx_queue_3_bytes: 2512
rx_queue_3_drops: 0
rx_queue_3_csum_err: 0
rx_queue_3_alloc_failed: 0
Dropwatch output is as followed:
# sudo dropwatch -l ksa
2 drops at igmp_rcv+10c (0xffffffff9dd7202c) [software]
1 drops at unix_stream_connect+36a (0xffffffff9ddbb10a) [software]
2 drops at ip_rcv_finish_core.constprop.0+19c (0xffffffff9dd1930c) [software]
2048 drops at ip_rcv_finish_core.constprop.0+19c (0xffffffff9dd1930c) [software]
2036 drops at ip_rcv_finish_core.constprop.0+19c (0xffffffff9dd1930c) [software]
1 drops at __udp4lib_lib_mcast_deliver+31f (0xffffffff9dd5d67f) [software]
1 drops at __udp4lib_lib_mcast_deliver+31f (0xffffffff9dd5d67f) [software]
If I run this setup (exatly same UDP packets with tcpdump) with a real second windows device, receiving works. But this "external loopback" dosn't receive anything (I want to create so a TSN setup, so the windows machine is no option).
If I don't specify the interface for receiving, I get the packets (but don't know if they come from the loopback)
Following steps I tried without success:
Disabling RP_FILTER (in any combination for all available interfaces)
promisc mode on (but the ethtool output says that there is no problem on the NIC side)
What did I missed?
Best regards,
Patrick
My goal is to send UDP multicast packets on the first interface and receive them on the second interface (for performance analysis and for simulating a current missing Master hardware).

Related

WEBOS LG TV: ares-inspect WARN Session#forward() failed forwarding client localPort: 0 => devicePort: 9998

I need to debug app running on the tv
The command I am running
ares-inspect -d webOS_TV -a myapp --open
The error I am getting
> Session#forward() failed forwarding client localPort: 0
> (inCnx.remotePort: 55431 )=> devicePort: 9998 ares-inspect WARN
> Session#forward() failed forwarding client localPort: 0 => devicePort:
> 9998 Session#forward() failed forwarding client localPort: 0
> (inCnx.remotePort: 55432 )=> devicePort: 9998 ares-inspect WARN
> Session#forward() failed forwarding client localPort: 0 => devicePort:
> 9998 Application Debugging - http://localhost:55430 Session#forward()
> failed forwarding client localPort: 0 (inCnx.remotePort: 55438 )=>
> devicePort: 9998 ares-inspect WARN Session#forward() failed forwarding
> client localPort: 0 => devicePort: 9998
Please help
I cannot find any 9998 port running on my TV
ares-novacom -d webOS_TV --r 'netstat -at'
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:1900 0.0.0.0:* LISTEN
tcp 0 0 localhost:43725 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1266 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:afs3-fileserver 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssg_http 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssg_https 0.0.0.0:* LISTEN
tcp 0 0 localhost:43259 0.0.0.0:* LISTEN
tcp 0 0 localhost:39547 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1979 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1088 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:9922 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1602 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:dial_http 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:dial_tvapp 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1927 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:11111 0.0.0.0:* LISTEN
tcp 0 0 192.168.0.106:dial_http 192.168.0.102:47096 ESTABLISHED
tcp 0 0 localhost:39547 localhost:50092 ESTABLISHED
tcp 0 0 localhost:39726 localhost:43259 ESTABLISHED
tcp 0 0 192.168.0.106:ssg_https 192.168.0.103:40102 ESTABLISHED
tcp 0 0 192.168.0.106:ssg_https 192.168.0.103:40056 ESTABLISHED
tcp 0 0 192.168.0.106:57364 192.168.0.103:38520 TIME_WAIT
tcp 0 0 192.168.0.106:9922 192.168.0.107:49603 ESTABLISHED
tcp 1 0 192.168.0.106:41720 192.168.0.1:60440 CLOSE_WAIT
tcp 0 0 192.168.0.106:57352 192.168.0.103:38520 TIME_WAIT
tcp 0 0 192.168.0.106:ssg_https 192.168.0.103:40046 ESTABLISHED
tcp 0 0 192.168.0.106:11111 192.168.0.107:65512 CLOSE_WAIT
tcp 0 0 localhost:50092 localhost:39547 ESTABLISHED
tcp 0 0 192.168.0.106:57358 192.168.0.103:38520 TIME_WAIT
tcp 0 0 localhost:43259 localhost:39726 ESTABLISHED
tcp 224 0 192.168.0.106:11111 192.168.0.107:65511 CLOSE_WAIT
tcp 0 0 :::36718 :::* LISTEN
tcp 0 0 localhost:domain :::* LISTEN
tcp 0 0 :::9922 :::* LISTEN
I had installed the prod app and the local app has the same id so they were conflicted

ERROR: transport error 202: bind failed: Cannot assign requested address

When I am trying to use sbt shell in intelliJ it appears the following error message:
Do I miss any settings?
Update
netstat -planet
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:41351 0.0.0.0:* LISTEN 1000 353424 573/java
tcp 0 0 127.0.0.1:63342 0.0.0.0:* LISTEN 1000 355674 573/java
tcp 0 0 0.0.0.0:33295 0.0.0.0:* LISTEN 1000 354289 573/java
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 16065 -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 0 34359 -
tcp 0 0 127.0.0.1:6942 0.0.0.0:* LISTEN 1000 354471 573/java
tcp 0 0 10.0.2.15:42510 151.101.193.69:443 ESTABLISHED 1000 305742 5102/chromium-brows
tcp 0 0 10.0.2.15:44344 104.66.167.140:443 ESTABLISHED 1000 345081 5102/chromium-brows
tcp 0 0 10.0.2.15:37646 198.252.206.25:443 ESTABLISHED 1000 353330 5102/chromium-brows
tcp 0 0 10.0.2.15:41480 104.16.29.34:443 ESTABLISHED 1000 349198 5102/chromium-brows
tcp 564 0 10.0.2.15:43148 172.217.168.42:443 ESTABLISHED 1000 377410 5102/chromium-brows
tcp 0 0 10.0.2.15:59768 54.246.222.93:443 ESTABLISHED 1000 368480 5102/chromium-brows
tcp 0 0 10.0.2.15:40474 216.58.215.226:443 ESTABLISHED 1000 327204 5102/chromium-brows
tcp 0 0 10.0.2.15:37728 198.252.206.25:443 ESTABLISHED 1000 376381 5102/chromium-brows
tcp 0 0 10.0.2.15:40470 216.58.215.226:443 ESTABLISHED 1000 327196 5102/chromium-brows
tcp 0 0 10.0.2.15:56458 34.193.164.107:443 ESTABLISHED 1000 352517 5102/chromium-brows
tcp 0 0 10.0.2.15:52954 91.228.74.181:443 ESTABLISHED 1000 377413 5102/chromium-brows
tcp 0 0 10.0.2.15:52956 91.228.74.181:443 ESTABLISHED 1000 377416 5102/chromium-brows
tcp 0 0 10.0.2.15:39020 172.217.168.66:443 ESTABLISHED 1000 324280 5102/chromium-brows
tcp 0 0 10.0.2.15:39324 216.58.215.230:443 ESTABLISHED 1000 375801 5102/chromium-brows
tcp 0 0 10.0.2.15:38640 172.217.168.38:443 ESTABLISHED 1000 352610 5102/chromium-brows
tcp 0 0 10.0.2.15:50876 172.217.168.46:443 ESTABLISHED 1000 343823 5102/chromium-brows
tcp 0 0 10.0.2.15:36630 198.252.206.25:443 ESTABLISHED 1000 327486 5102/chromium-brows
tcp 0 0 10.0.2.15:40544 216.58.215.227:443 ESTABLISHED 1000 318302 5102/chromium-brows
tcp 0 0 10.0.2.15:47506 151.101.194.49:443 ESTABLISHED 1000 353343 5102/chromium-brows
tcp 311 0 10.0.2.15:38920 13.32.166.42:443 ESTABLISHED 1000 377418 5102/chromium-brows
tcp 0 0 10.0.2.15:54224 192.30.253.125:443 ESTABLISHED 1000 317858 5102/chromium-brows
tcp 0 0 10.0.2.15:49846 172.217.168.46:443 ESTABLISHED 1000 327213 5102/chromium-brows
tcp 0 0 10.0.2.15:56456 34.193.164.107:443 ESTABLISHED 1000 351738 5102/chromium-brows
tcp 32 0 10.0.2.15:42114 52.207.55.4:443 CLOSE_WAIT 1000 374681 5102/chromium-brows
tcp6 0 0 :::43209 :::* LISTEN 1000 355214 772/java
tcp6 0 0 ::1:631 :::* LISTEN 0 34358 -
tcp6 0 0 127.0.0.1:30107 :::* LISTEN 1000 355213 772/java
tcp6 0 0 127.0.0.1:43906 127.0.0.1:33295 TIME_WAIT 0 0 -
tcp6 0 0 127.0.0.1:43904 127.0.0.1:33295 TIME_WAIT 0 0 -
tcp6 0 0 127.0.0.1:43922 127.0.0.1:33295 TIME_WAIT 0 0 -
Update 2
What do I have to set:
This used to (2015) suggest a port already in used (as in ensime/ensime-server issue 921)
You have the same error with JBoss for instance
ERROR: transport error 202: bind failed: Cannot assign requested address
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized
Make sure there isn't already an sbt shell running elsewhere (netstat -planet).

Set /etc/hosts for each vagrant vm by ansible

My Vagrantfile
hosts = {
"host01" => "192.168.11.101",
"host02" => "192.168.11.102",
}
Vagrant.configure("2") do |config|
config.ssh.username = "root"
config.ssh.password = "vagrant"
config.ssh.insert_key = "true"
hosts.each_with_index do |(name,ip),index|
config.vm.define name do |machine|
machine.vm.box = "centos7"
machine.vm.box_check_update = false
machine.vm.hostname = name
machine.vm.synced_folder "/data", "/data"
machine.vm.network :private_network, ip: ip
machine.vm.provider "virtualbox" do |v|
v.name = name
v.customize ["modifyvm", :id, "--memory", 2048]
end
end
end
end
ansible tamplate for generate /etc/host
127.0.0.1 localhost
{% for host in groups['all'] %}
{{ hostvars[host]['ansible_' + iface].ipv4.address }} {{ host }}
{% endfor %}
ansible task
- name: Create the hosts file for all machines
template: src=hosts.j2 dest=/etc/hosts
But I get the result
[root#host01 ~]# cat /etc/hosts
127.0.0.1 localhost
10.0.2.15 host01
10.0.2.15 host02
ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::42:49ff:fed1:eebb prefixlen 64 scopeid 0x20<link>
ether 02:42:49:d1:ee:bb txqueuelen 0 (Ethernet)
RX packets 77 bytes 6065 (5.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 99 bytes 8572 (8.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:fede:e0e prefixlen 64 scopeid 0x20<link>
ether 08:00:27:de:0e:0e txqueuelen 1000 (Ethernet)
RX packets 785483 bytes 57738892 (55.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 777457 bytes 1957320412 (1.8 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.101 netmask 255.255.255.0 broadcast 192.168.11.255
ether 08:00:27:15:2c:64 txqueuelen 1000 (Ethernet)
RX packets 41445 bytes 39878552 (38.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 18055 bytes 2113498 (2.0 MiB)
I found in ifconfig, only enp0s8 inet 192.168.11.102 is different on host01 and host02
host01 and host02 got same ip ??
host01 has a docker registry.
host01, curl http://host01:5006/v2/_catalog works
host02, curl http://host01:5006/v2/_catalog not work
host01 and host02 got same ip ??
Yes. That's how Vagrant works and is able to connect for orchestration purposes to machines created from a variety of boxes coming from different publishers.
There's nothing strange about that, they are connected to different virtual switches in VirtualBox.
I just want host01 and host02 can access each other by hostname .
Use the other interface as the value of iface in your Jinja2 template (you did not show it in the question anyway).

netstat/ss shows duplicated outgoing time_wait sockets

I encountered this behaviour many times in many servers which processed lots of network connections.
# ss -nt state time-wait sport ne :80 and sport ne :10050 | sort -k3
0 0 127.0.0.1:13530 127.0.0.1:8888
0 0 127.0.0.1:21978 127.0.0.1:8080
0 0 127.0.0.1:32490 127.0.0.1:8080
0 0 127.0.0.1:42922 127.0.0.1:8080
0 0 127.0.0.1:50728 127.0.0.1:8080
0 0 127.0.0.1:51542 127.0.0.1:8888
0 0 127.0.0.1:6274 127.0.0.1:8888
0 0 127.0.0.1:65264 127.0.0.1:8888
0 0 172.16.40.100:10000 172.16.40.5:3010
0 0 172.16.40.100:10002 172.16.40.34:3010
0 0 172.16.40.100:10002 172.16.40.97:3020
0 0 172.16.40.100:10004 172.16.40.116:3010
0 0 172.16.40.100:10004 172.16.40.21:3010
0 0 172.16.40.100:10008 172.16.40.30:3010
0 0 172.16.40.100:10010 172.16.40.216:3020
0 0 172.16.40.100:10012 172.16.40.30:3010
0 0 172.16.40.100:10014 172.16.40.131:3010
0 0 172.16.40.100:10014 172.16.40.22:3010
0 0 172.16.40.100:10014 172.16.40.33:3010
This is a part of ss output. As you may see, there are several strings with duplicated outgoing time_wait sockets. Such as:
0 0 172.16.40.100:10002 172.16.40.34:3010
0 0 172.16.40.100:10002 172.16.40.97:3020
or
0 0 172.16.40.100:10014 172.16.40.131:3010
0 0 172.16.40.100:10014 172.16.40.22:3010
0 0 172.16.40.100:10014 172.16.40.33:3010
I googled this question but could not get a reasonable explanation of this topic.
Thanks a lot!
As you may see, there are several strings with duplicated outgoing time_wait sockets. Such as:
0 0 172.16.40.100:10002 172.16.40.34:3010
0 0 172.16.40.100:10002 172.16.40.97:3020
or
0 0 172.16.40.100:10014 172.16.40.131:3010
0 0 172.16.40.100:10014 172.16.40.22:3010
0 0 172.16.40.100:10014 172.16.40.33:3010
The lines in this display are connections, not sockets.
There are exactly zero 'duplicated sockets' here. There is a duplicated port, because at the server end the port is always the same. However either the client IP address or the client port is always different. Or both.

SMTP & POP3 SSL Connection

I am using libetpan-1.0 open source (mail library stuff) for SMTP & POP3 access in "C" language. I have problem with SSL connection in SMTP & POP3. When i make SSL connection & connection gets fail, my socket is stay in CLOSE_WAIT state. This results in memory leak after a long time. Here is my output of command "netstat -an". I am running this application in ARM board. Can anyone tell me, what i should do? Thanks in advance.
Here is my code that i am trying.
pSmtp = mailsmtp_new(0, NULL); (Create new object)
if (SMTP_NO_ERROR != mailsmtp_ssl_connect(pSmtp, "smtp.gmail.com", 465))
{
mailsmtp_free(pSmtp);
}
else
{
// Send Mail
}
So doesn't my work is over after i call function "mailsmtp_free(pSmtp)" or
i have do other stuff to close connection.
~#netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN
tcp 1 0 192.168.51.151:4928 98.139.211.125:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4934 98.139.211.125:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2883 98.139.211.125:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4139 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4140 98.138.105.21:465 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.151.101:2745 TIME_WAIT
tcp 1 0 192.168.51.151:4142 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4143 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:3132 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:3133 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:3134 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:3135 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:3131 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2115 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:3136 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:3137 98.138.105.21:465 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.151.101:2761 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.151.101:2757 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.151.101:2753 TIME_WAIT
tcp 1 0 192.168.51.151:4083 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4082 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4081 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4080 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4085 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4084 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4075 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4074 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4073 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4072 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4079 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4078 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4077 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:4076 63.250.193.228:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2493 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2492 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2495 98.138.105.21:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2496 98.138.105.21:465 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52577 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52581 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52585 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52565 TIME_WAIT
tcp 1 0 192.168.51.151:3978 63.250.193.228:465 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52569 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52573 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52609 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.151.101:2748 TIME_WAIT
tcp 1 0 192.168.51.151:2743 98.139.211.125:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2742 98.139.211.125:465 CLOSE_WAIT
tcp 1 0 192.168.51.151:2744 98.139.211.125:465 CLOSE_WAIT
tcp 94 0 192.168.51.151:3650 74.125.129.108:587 CLOSE_WAIT
tcp 95 0 192.168.51.151:3655 74.125.129.108:587 CLOSE_WAIT
tcp 1 0 192.168.51.151:2250 63.250.193.228:465 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52578 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52582 TIME_WAIT
tcp 95 0 192.168.51.151:4618 74.125.129.108:587 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52586 TIME_WAIT
tcp 95 0 192.168.51.151:4615 74.125.129.108:587 CLOSE_WAIT
tcp 1 0 192.168.51.151:4353 98.139.211.125:465 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52590 TIME_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52594 TIME_WAIT
tcp 1 0 192.168.51.151:2769 98.138.105.21:465 CLOSE_WAIT
tcp 0 0 192.168.51.151:80 192.168.51.40:52598 TIME_WAIT
udp 0 0 0.0.0.0:2048 0.0.0.0:*
udp 0 0 0.0.0.0:2049 0.0.0.0:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 6 [ ] DGRAM 1262 /dev/log
unix 2 [ ] DGRAM 1993
unix 2 [ ] DGRAM 1513
unix 2 [ ] DGRAM 1511
unix 2 [ ] DGRAM 1492
You need to close them on your side.
CLOSE_WAIT means the remote side has closed the connection, but your side hasn't.
See accepted answer here