in reply to Intercepting UDP broadcasts

Do have a firewall on the box you're testing on? That might explain why tcpdump can see the packets, but your code can't.

-sam

Replies are listed 'Best First'.
Re: Intercepting UDP broadcasts
by Abigail-II (Bishop) on Jan 30, 2004 at 19:53 UTC
    Nope. No firewall on the box. There's nothing special running on the box - a plain Redhat 7.3 distro.

    I'll have to think it over during the weekend - I won't be back in the office to work on it till Monday.

    Abigail

      By default (unless you asked for "no security" or something similar during the install) RH7.3 sets up an ipchains firewall which will block incoming UDP packets for port <= 1023, among others. Is there any chance that's tripping you up?
        Sounds like AM has a good idea here.. check your kernel log to see if they got dropped. I used your code on the OP and 'nc -u localhost 67' and it worked like a charm. "foobar.\n" => Saw a bootp request


        mhoward - at - hattmoward.org
        Actually it leaves it on no matter what choice you make during install on all the 7.x and 8.x versions. I always had to go in and diable it for Oracle. I think they finally fixed it in 9, but I've since switched to Gentoo and haven't installed RH in a while.

        As for examples, the last broadcast UDP client I saw was the Net::mDNS module that is used to send and receive multicast dns over udp for things like Apple's Rendezvous. You can get it from CPAN.

        HTH

      After reading some more 'nix socket threads you might want to try binding to 0.0.0.0 instead of 255.255.255.255