Damjan Jovanovic wrote:
Well I've thought about it, and...

Raw sockets are a nightmare - too platform-specific, quirky,
inefficient (you get many packets you don't need to see) and require
root access. But, it's the only way to unicast to a particular MAC
address like the RFC says we should in some cases.
Raw sockets (for example using RockSaw: http://www.savarese.org/software/rocksaw/) is something we considered. Wrapped in a corresponding MINA transport implementation this might not be too bad after all.
Moving on - SO_BINDTODEVICE is also platform-specific and seems a bit
of a hack (it changes how routing is done). Plus you need a socket per
interface, which means you use more sockets, and if network interfaces
are created or destroyed while the DHCP server is running it has to
deal with it.
That is correct.
Using recvmsg() seems nice, it's only 1 socket, and it tells you where
the packet came from.
I didn't find a corresponding implementation of recvmsg() for Windows.

There is one more option: going not after the socket layer, but even one layer below using a packet capture interface (which, contrary to its name, can also inject arbitrary packets), e.g. as supported by this: http://netresearch.ics.uci.edu/kfujii/jpcap/doc/
A disadvantage is that it requires an installed PCAP driver.
Little hope? When last I checked, Sun was accepting patches to Java :-).

I've mailed the appropriate mailing list and offered to patch
DatagramPacket and co to provide the packet's destination address and
the NetworkInterface it came through, and they've sent me some
preliminary code I can carry on from. So, luck witholding, it will
make it into not just Java 7, but maybe even some of the prerelease
builds.
That sounds rather brilliant. Is this a cross-platform solution which also works on Windows?

The bigbang branch seems much further ahead than trunk, I'm not sure
there is much for me to do any more.
Don't worry - there is :-)
The code on the trunk contains a proof-of-concept DHCP server implementation only. There is no functionality to look up clients from the directory, no configuration, no state (lease) management etc.

Joerg Henne

PS.: I'll treat myself to a week of holidays, so I won't be able to take part in the discussion over the next days, I'm afraid.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to