Re: Sample code for sending raw packets?
Re: Sample code for sending raw packets?
- Subject: Re: Sample code for sending raw packets?
- From: "Justin C. Walker" <email@hidden>
- Date: Fri, 13 Oct 2006 14:30:54 -0700
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.
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Director
Institute for the Enhancement of the Director's Income
--------
"Weaseling out of things is what separates us from the animals.
Well, except the weasel."
- Homer J Simpson
--------
_______________________________________________
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