All of lore.kernel.org
 help / color / mirror / Atom feed
* pure raw eth sockets
@ 2002-11-08  6:12 Colin Burnett
  2002-11-08  6:43 ` Chris Friesen
  2002-11-08  8:14 ` Willy Tarreau
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Burnett @ 2002-11-08  6:12 UTC (permalink / raw)
  To: LKML

I'm at a complete road block here and I appreciate any help!

I'm trying to write a packet generator that generates a packet down to the
destination/src mac address of an eth frame.  However, nothing I find seems to
explain how to do this let alone if it is possible.  As example (for
familiarity), implementing a RARP client (and server).  I first create a socket:

socket(PF_INET, SOCK_PACKET, ETH_P_RARP)

After generating an entire packet (eth frame + RARP request) and sending it via
sendto, tcpdump shows that my packet was encapsulated as the data for an IP
packet.  Definitely not what I want and I suspect it is because I'm passing the
PF_INET domain (it assuming IP?).

So how would I go about implement sending a RARP request (obviously I'm doing
something wrong or assuming something wrong)?  Or more generally, how do I get
pure raw socket access?
-- 


Colin Burnett

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pure raw eth sockets
  2002-11-08  6:12 pure raw eth sockets Colin Burnett
@ 2002-11-08  6:43 ` Chris Friesen
  2002-11-08  8:14 ` Willy Tarreau
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Friesen @ 2002-11-08  6:43 UTC (permalink / raw)
  To: Colin Burnett; +Cc: LKML

Colin Burnett wrote:

> socket(PF_INET, SOCK_PACKET, ETH_P_RARP)

I believe you want something more like:

socket(PF_PACKET, SOCK_RAW, htons(ETH_P_RARP));

Try doing a man on "packet".

Chris



-- 
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pure raw eth sockets
  2002-11-08  6:12 pure raw eth sockets Colin Burnett
  2002-11-08  6:43 ` Chris Friesen
@ 2002-11-08  8:14 ` Willy Tarreau
  1 sibling, 0 replies; 3+ messages in thread
From: Willy Tarreau @ 2002-11-08  8:14 UTC (permalink / raw)
  To: Colin Burnett; +Cc: LKML

On Fri, Nov 08, 2002 at 12:12:44AM -0600, Colin Burnett wrote:
> I'm at a complete road block here and I appreciate any help!
> 
> I'm trying to write a packet generator that generates a packet down to the
> destination/src mac address of an eth frame.  However, nothing I find seems to
> explain how to do this let alone if it is possible.  As example (for
> familiarity), implementing a RARP client (and server).  I first create a socket:

I wrote a tool which works exactly like this, to test network equipments to
limits. It's slightly commented, and relatively basic. You can download it
there :

   http://w.ods.org/tools/ethforge/

Just a tip: don't start it without args, by default it will bomb as many
packets as possible on your network! Read it first :-)

Cheers,
Willy


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-08  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-08  6:12 pure raw eth sockets Colin Burnett
2002-11-08  6:43 ` Chris Friesen
2002-11-08  8:14 ` Willy Tarreau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.