in reply to Re: (OT) Getting the source hardware address of received UDP packets?
in thread (OT) Getting the source hardware address of received UDP packets?

Say a dhcp client without an IP address sends a dhcp request (broadcast).

While a dhcp request/discover payload usually contains the alleged hardware address of the client, it may still be useful to log the hardware address of the frame if things go wrong.

But I don't want the program to see all frames. Only just the relevant packets.

I suppose that's not a good enough reason - so I guess that's why there's no easy way to do that :).

  • Comment on Re^2: (OT) Getting the source hardware address of received UDP packets?

Replies are listed 'Best First'.
Re^3: (OT) Getting the source hardware address of received UDP packets?
by ikegami (Patriarch) on Jun 02, 2006 at 17:32 UTC

    It is possible to make DHCP requests to a server outside of one's LAN*, but only because DHCP allows you to specify your MAC address inside of your request. The DHCP request looks a bit like "My MAC address is 00:00:00:00:00:00. Please give me an IP address." In other words, the client must explicitly place the MAC address in the DHCP request. There's no IP or UDP (or even TCP) solution to your problem.

    You can do the same as DHCP — have the clients send their MAC address along with their request — with your UDP-based protocol if you're still developing the protocol.

    * — That requires the co-operation of the gateway, but only because the machine doesn't have an IP address yet.

Re^3: (OT) Getting the source hardware address of received UDP packets?
by isotope (Deacon) on Jun 02, 2006 at 17:07 UTC
    That really is a good application for Net::Pcap. You dismissed pcap because you didn't want to handle all received frames, but pcap allows you to define a filter so you'd actually be able to select just dhcpc messages if you wanted.


    --isotope