Routing tables aren't very useful for DHCP packets, because a significant proportion of DHCP packets don't have unique IP addresses even at a local network level. After all DHCP is typically used by hosts without valid IP addresses to get valid IP addresses.
getsockopt and setsockopt allow you to get more info about a socket. e.g.
# Get the original destination of the connection
# that was redirected to our socket
my $p= getsockopt $client, $SOL_IP, $SO_ORIGINAL_DST;
$orig_destaddr=inet_ntoa(substr($p,4,4));
$orig_destport=unpack('n',substr($p,2,2));
I just don't know how to read or write the ancillary messages once I set the IP_PKTINFO socket option. In C it's stuff like sendmsg, recvmsg or cmsg.
DHCP doesn't really require high performance - legitimate client machines should not be sending DHCP packets at a high rate, so perl isn't such a bad fit other than this problem I'm having. A perl DHCP server won't be as prone to buffer overflows and will be flexible and more easily extensible.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.