Re: Sample code for sending raw packets?
Re: Sample code for sending raw packets?
- Subject: Re: Sample code for sending raw packets?
- From: Dave Camp <email@hidden>
- Date: Fri, 13 Oct 2006 14:53:50 -0700
On Oct 13, 2006, at 2:30 PM, Justin C. Walker wrote:
On Oct 13, 2006, at 11:37 , Dave Camp wrote:
On Oct 13, 2006, at 11:26 AM, Justin C. Walker wrote:
On Oct 13, 2006, at 11:03 , Dave Camp wrote:
- Add a static entry to the ARP table for x.x.x.x -> Printer
MAC Address, where x.x.x.x is the new IP address they want to
set the printer to and the Printer MAC address is the MAC
address of the printer.
- Send an ICMP ping to the printer.
- Remove the ARP entry
[snip]
If you really want ICMP 'Echo' packets, check the source for
'ping' (or, just use 'ping' in a shell script :-}). It's on the
darwin site (<http://developer.apple.com/darwin>).
Why do you want to use "raw ethernet" if you want to send ICMP
packets?
I'm not well versed in the lower levels of ethernet, but it's my
understanding that to form a packet where the MAC address does not
match the destination IP address in the IP layer, I'd have to roll
my own ethernet packet. The printer is going to listen to the
packet because the MAC address matches and then change it's
internal IP address to match what is in the packet.
Or am I misunderstanding something?
If I understand the recipe above, you have the MAC address/IP
address association already in the ARP cache, by dint of step 1.
If this is true, the system will handle the frame assembly and
transmission.
If you need to send the "whole frame" by yourself, step 1 seems
superfluous.
My original intent was to avoid step 1 by sending the whole frame
myself. However, folks here think that step 1 isn't as bad as I
thought it was, so I'm going to try that. The downside is that I get
to use the command line as an API and hope it works well. :-)
Thanks,
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden