Karen Pease
2005-01-31 04:27:55 UTC
A couple weeks ago, I posted here with problems sending packets via
LIBNET_LINk when they worked with LIBNET_RAW4. Last I posted, I thought I
had resolved the problem by using the libnet_ethernet_autobuild function;
however, it turns out that it was only working in a situation that I
previously had working (sending from my home computer to my work computer) (I
discovered this shortly after I send my last emaiL); I've tried to work on it
on my own, but have had no success in getting packets to arrive the other
way. So, I'm still stuck where I was before.
The main problem is mac addrs. The libnet example code for raw sockets (which
I was pointed to before) uses hard coded mac addrs; naturally, as I mentioned
before, this means that the code is effectively worthless in real-world
applications, since you don't know beforehand what a target machine's mac
addr will be. I can get packets from my home computer to my work computer
using mac addr ff.ff.ff.ff.ff.ff; however, the same does not work in reverse.
Assumedly this has something to do with my router (I'm behind NAT with port
forwarding for the port being sent to). To send packets from work to home, I
need to be able to look up the router's mac addr (in fact, if I hard code it,
they make it home just fine). I previously asked if there was a libnet
function to do this for you. I got no clear response, so I assume the answer
is "no".
So as not to bother the list any more, I decided to try and look it up myself;
to the best of my knowlege, this is done with arp who-has requests. So, I
tried sending who-has requests, and set up this nice system to send them out
and sniff the results back off the network. I got no response. Looking in
tcpdump, only a small percentage of all machines on the network that issued
who-has requests got them answered - at least, so far as I could see in
sniffed network traffic. All of the who-has requests seemed to be structured
the same (including mine). So, I'm not sure what I'm missing.
In short, I have to ask: How can I get a remote machine's mac addr to use with
libnet? I'm getting somewhat frustrated here. :(
- Karen
LIBNET_LINk when they worked with LIBNET_RAW4. Last I posted, I thought I
had resolved the problem by using the libnet_ethernet_autobuild function;
however, it turns out that it was only working in a situation that I
previously had working (sending from my home computer to my work computer) (I
discovered this shortly after I send my last emaiL); I've tried to work on it
on my own, but have had no success in getting packets to arrive the other
way. So, I'm still stuck where I was before.
The main problem is mac addrs. The libnet example code for raw sockets (which
I was pointed to before) uses hard coded mac addrs; naturally, as I mentioned
before, this means that the code is effectively worthless in real-world
applications, since you don't know beforehand what a target machine's mac
addr will be. I can get packets from my home computer to my work computer
using mac addr ff.ff.ff.ff.ff.ff; however, the same does not work in reverse.
Assumedly this has something to do with my router (I'm behind NAT with port
forwarding for the port being sent to). To send packets from work to home, I
need to be able to look up the router's mac addr (in fact, if I hard code it,
they make it home just fine). I previously asked if there was a libnet
function to do this for you. I got no clear response, so I assume the answer
is "no".
So as not to bother the list any more, I decided to try and look it up myself;
to the best of my knowlege, this is done with arp who-has requests. So, I
tried sending who-has requests, and set up this nice system to send them out
and sniff the results back off the network. I got no response. Looking in
tcpdump, only a small percentage of all machines on the network that issued
who-has requests got them answered - at least, so far as I could see in
sniffed network traffic. All of the who-has requests seemed to be structured
the same (including mine). So, I'm not sure what I'm missing.
In short, I have to ask: How can I get a remote machine's mac addr to use with
libnet? I'm getting somewhat frustrated here. :(
- Karen