Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Mar 2019 15:52:31 +0700
From:      Eugene Grosbein <eugen@grosbein.net>
To:        =?UTF-8?Q?Goran_Meki=c4=87?= <meka@tilda.center>, freebsd-net@freebsd.org
Subject:   Re: UDP broadcast
Message-ID:  <149e7a2f-6297-3478-e8c0-64baeeb02d8b@grosbein.net>
In-Reply-To: <20190305224610.frw5ov5bn6f3xaqg@hal9000.home.meka.rs>
References:  <20190305224610.frw5ov5bn6f3xaqg@hal9000.home.meka.rs>

next in thread | previous in thread | raw e-mail | index | archive | help
06.03.2019 5:46, Goran Mekić wrote:

> I have a audio mixer which is controleable over network via android app.
> The discovery is done by sending broadcast UDP message "/info\0\0\0" to
> 255.255.255.255 (checked by tcpdump on the router). I thought I can do
> the same with:
> 
> printf "/info\0\0\0" | nc -4u -w 0 255.255.255.255 10024
> 
> But I never get the reply. This is what tcpdump sees:
> 
> tcpdump -nnSX -v 'src 192.168.5.80 or dst 255.255.255.255'
> tcpdump: listening on re0, link-type EN10MB (Ethernet), capture size
> 262144 bytes
> 23:41:25.595663 IP (tos 0x0, ttl 64, id 28810, offset 0, flags [none],
> proto UDP (17), length 36, bad cksum 0 (->4439)!)

As shown, nc generates UDP datagramm without (optional) checksum.

>     192.168.5.94.36465 > 255.255.255.255.10024: UDP, length 8
> 		0x0000:   4500 0024 708a 0000 4011 0000 c0a8 055e  E..$p...@......^
> 		0x0010:  f  fff ffff 8e71 2728 0010 c627 2f69 6e66  .....q'(...'/inf
> 		0x0020:  6f00    0000                                o...
> 
> I never get any reply, but when I try the same with the android app while sniffing on the router:
> 
> 
> tcpdump -nnSX -v -i bridge0 'dst 255.255.255.255 or src 192.168.5.80'
> tcpdump: listening on bridge0, link-type EN10MB (Ethernet), capture size 262144 bytes
> 23:43:52.165821 IP (tos 0x0, ttl 64, id 20743, offset 0, flags [DF], proto UDP (17), length 36)
>     192.168.5.79.57477 > 255.255.255.255.10024: UDP, length 8

Here tcpdump dump does not complain on missing checksum. This means Android sends checksummed datagramms.
Perhaps, receiver discards datagramms without checksum.

> So what am I doing wrong and how can I send UDP broadcast from either script of C code? Thank you!

You should try ncat from security/nmap instead of nc.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?149e7a2f-6297-3478-e8c0-64baeeb02d8b>