UDP broadcast

Goran Mekić meka at tilda.center
Wed Mar 6 12:53:26 UTC 2019


On Wed, Mar 06, 2019 at 03:37:04PM +0300, Andrey V. Elsukov wrote:
> On 06.03.2019 01:46, Goran Mekić wrote:
> I think it is because netcat does not send real broadcast, you can add
> -e flag to tcpdump and compare ethernet destination addresses.
We might be on track here. I get this on router (first is nc from my
machine, second is android app):

tcpdump -e -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
13:42:47.313189 bc:ae:c5:e1:31:d0 > 02:c9:63:0b:f4:00, ethertype IPv4 (0x0800), length 60: (tos 0x0, ttl 64, id 65271, offset 0, flags [none], proto UDP (17), length 36)
    192.168.5.94.26375 > 255.255.255.255.10024: UDP, length 8
	0x0000:  4500 0024 fef7 0000 4011 b5cb c0a8 055e  E..$.... at ......^
	0x0010:  ffff ffff 6707 2728 0010 9ec8 2f69 6e66  ....g.'(..../inf
	0x0020:  6f00 0000 0000 0000 0000 0000 0000       o.............
13:43:12.540319 bc:a5:8b:ad:71:4c > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 50: (tos 0x0, ttl 64, id 26278, offset 0, flags [DF], proto UDP (17), length 36)
    192.168.5.79.34717 > 255.255.255.255.10024: UDP, length 8
	0x0000:  4500 0024 66a6 4000 4011 0e2c c0a8 054f  E..$f. at .@..,...O
	0x0010:  ffff ffff 879d 2728 0010 7e41 2f69 6e66  ......'(..~A/inf
	0x0020:  6f00 0000                                o...

I checked, and 02:c9:63:0b:f4:00 is my router MAC, so I suppose the
ff:ff:ff:ff:ff:ff should be what I see.

Of course, I tried to write a simple C program that does the same, but
just using 255.255.255.255 as IP address gives the same result as nc. Do
I need to use raw sockets, perheps?

Regards,
meka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20190306/ef96106a/attachment.sig>


More information about the freebsd-net mailing list