O pacote UDP não chega ao aplicativo que está escutando no Ubuntu

1

Estou enviando um pacote UDP do Arduino, o pacote chega ao meu servidor Ubuntu porque é possível vê-lo no tcpdump como você pode ver. Mas nunca é encaminhado para o meu aplicativo que está escutando na porta 8888. Alguém tem uma ideia do que está errado no pacote?

Minha versão do Ubuntu é: Ubuntu 12.04.1 LTS (GNU / Linux 3.2.0-29-genérico-pae i686)

Este é o tcpdump :

tcpdump -i 1 udp port 8888 -vv -X
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 byte                                                       s
19:06:20.179117 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 131)
    192.168.1.53.3333 > diskServer.8888: [udp sum ok] UDP, length 103
        0x0000:  4500 0083 0000 4000 4011 b6b1 c0a8 0135  E.....@[email protected]
        0x0010:  c0a8 0133 0d05 22b8 006f 87d6 7465 7374  ...3.."..o..test
        0x0020:  2030 3132 3334 3536 3738 3930 2074 6573  .01234567890.tes
        0x0030:  7420 3031 3233 3435 3637 3839 3020 7465  t.01234567890.te
        0x0040:  7374 2030 3132 3334 3536 3738 3930 2074  st.01234567890.t
        0x0050:  6573 7420 3031 3233 3435 3637 3839 3020  est.01234567890.
        0x0060:  7465 7374 2030 3132 3334 3536 3738 3930  test.01234567890
        0x0070:  2074 6573 7420 3031 3233 3435 3637 3839  .test.0123456789
        0x0080:  3020 00                                  0..

Esta é a porta de escuta:

root@diskServer:~# netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 diskServer:mysql        *:*                     LISTEN
tcp        0      0 *:netbios-ssn           *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:https                 *:*                     LISTEN
tcp        0      0 *:microsoft-ds          *:*                     LISTEN
tcp        0      0 diskServer:ssh          flavix:53077            ESTABLISHED
tcp        0    144 diskServer:ssh          flavix:53028            ESTABLISHED
tcp        0      0 diskServer:ssh          192.168.1.107:54978     ESTABLISHED
tcp        0      0 diskServer:ssh          192.168.1.107:55000     ESTABLISHED
tcp6       0      0 [::]:8009               [::]:*                  LISTEN
tcp6       0      0 [::]:http-alt           [::]:*                  LISTEN
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN
tcp6       0      0 [::]:8443               [::]:*                  LISTEN
tcp6       0      0 localhost:8005          [::]:*                  LISTEN
udp        0      0 diskServer:ntp          *:*
udp        0      0 localhost:ntp           *:*
udp        0      0 *:ntp                   *:*
udp        0      0 192.168.1.25:netbios-ns *:*
udp        0      0 diskServer:netbios-ns   *:*
udp        0      0 *:netbios-ns            *:*
udp        0      0 192.168.1.2:netbios-dgm *:*
udp        0      0 diskServer:netbios-dgm  *:*
udp        0      0 *:netbios-dgm           *:*
udp        0      0 diskServer:8888         *:***
udp6       0      0 ip6-localhost:ntp       [::]:*
udp6       0      0 fe80::20e:7bff:feac:ntp [::]:*
udp6       0      0 [::]:ntp                [::]:*

Memória do UDP:

root@diskServer:~# cat /proc/sys/net/ipv4/udp_mem
18066   24090   36132

root@diskServer:~# netstat -su
IcmpMsg:
    InType3: 10316969
    InType8: 18368
    OutType0: 18368
    OutType3: 10317030
Udp:
    211263 packets received
    10309092 packets to unknown port received.
    0 packet receive errors
    10348446 packets sent
UdpLite:
IpExt:
    InMcastPkts: 24678
    InBcastPkts: 287164
    OutBcastPkts: 12685
    InOctets: -1
    OutOctets: -1
    InMcastOctets: 690984
    InBcastOctets: 48281994
    OutBcastOctets: 3170039
root@diskServer:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
fail2ban-apache-badbots  tcp  --  anywhere             anywhere             multiport dports http,https
fail2ban-apache-overflows  tcp  --  anywhere             anywhere             multiport dports http,https
fail2ban-apache-noscript  tcp  --  anywhere             anywhere             multiport dports http,https
fail2ban-apache  tcp  --  anywhere             anywhere             multiport dports http,https
fail2ban-ssh  tcp  --  anywhere             anywhere             multiport dports ssh
ufw-before-logging-input  all  --  anywhere             anywhere
ufw-before-input  all  --  anywhere             anywhere
ufw-after-input  all  --  anywhere             anywhere
ufw-after-logging-input  all  --  anywhere             anywhere
ufw-reject-input  all  --  anywhere             anywhere
ufw-track-input  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ufw-before-logging-forward  all  --  anywhere             anywhere
ufw-before-forward  all  --  anywhere             anywhere
ufw-after-forward  all  --  anywhere             anywhere
ufw-after-logging-forward  all  --  anywhere             anywhere
ufw-reject-forward  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ufw-before-logging-output  all  --  anywhere             anywhere
ufw-before-output  all  --  anywhere             anywhere
ufw-after-output  all  --  anywhere             anywhere
ufw-after-logging-output  all  --  anywhere             anywhere
ufw-reject-output  all  --  anywhere             anywhere
ufw-track-output  all  --  anywhere             anywhere

Chain fail2ban-apache (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-apache-badbots (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-apache-noscript (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-apache-overflows (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-ssh (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain ufw-after-forward (1 references)
target     prot opt source               destination

Chain ufw-after-input (1 references)
target     prot opt source               destination

Chain ufw-after-logging-forward (1 references)
target     prot opt source               destination

Chain ufw-after-logging-input (1 references)
target     prot opt source               destination

Chain ufw-after-logging-output (1 references)
target     prot opt source               destination

Chain ufw-after-output (1 references)
target     prot opt source               destination

Chain ufw-before-forward (1 references)
target     prot opt source               destination

Chain ufw-before-input (1 references)
target     prot opt source               destination

Chain ufw-before-logging-forward (1 references)
target     prot opt source               destination

Chain ufw-before-logging-input (1 references)
target     prot opt source               destination

Chain ufw-before-logging-output (1 references)
target     prot opt source               destination

Chain ufw-before-output (1 references)
target     prot opt source               destination

Chain ufw-reject-forward (1 references)
target     prot opt source               destination

Chain ufw-reject-input (1 references)
target     prot opt source               destination

Chain ufw-reject-output (1 references)
target     prot opt source               destination

Chain ufw-track-input (1 references)
target     prot opt source               destination

Chain ufw-track-output (1 references)
target     prot opt source               destination

ufw está desativado.

    
por Flavio Mion 10.02.2016 / 18:25

2 respostas

1

O problema estava no pacote, isso está errado porque o destino no nível Ethernet foi definido como 0, esta é a saída de wireShark:

Ethernet II, Src: 74: 69: 69: 2d: 30: 31 (74: 69: 69: 2d: 30: 31), Dst: 00: 00: 00_00: 00: 00 (00:00:00 : 00: 00: 00)

Isso se deve a um problema de hardware na minha placa Arduino.

Thaks para todos, Ciao.

    
por Flavio Mion 18.02.2016 / 17:03
0

O problema real está provavelmente na biblioteca ethercard usada. Ele não manipula corretamente a pesquisa ARP para o destino, causando o endereço MAC de destino de todos os zeros (consulte link ).

Uma biblioteca alternativa que funciona é a Ethernet_UIP, que pode ser encontrada no link e que tem um exemplo que envia pacotes UDP; Eu testei esse exemplo e ele funciona.

    
por fjalvingh 18.01.2017 / 22:18