Skip to contentSkip to conversation

Best way to hook incoming eth pkts?

DISCUSSION Jeff Garzik 4 participants 8 messages Aug 20, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

All,

netconsole, netdump, and ATA-over-ethernet (and others?) all have a need to directly send and receive ethernet packets from inside the kernel.

The sending part is easy and obvious. The receive part isn't.

Essentially, all the things mentioned above need some way to listen for incoming ethernet packets. ATA-over-ethernet has its own IANA-registered ethernet type, but netconsole and netdump are using IP/UDP instead of a custom ethernet protocol.

So, two questions for the gurus of the crowd ;-)

1) What is the best way for an in-kernel piece of software to receive ethernet packets that are intended for it?

2) Possibly related to #1, is it a good or bad idea to consider sending netconsole/netdump directly over ethernet, eschewing the IP/UDP/syslog stuff?

Comments and insight requested.

Jeff

#1 lore raw
Quoted 3 lines · Jeff Garzik

ATA-over-ethernet has its own
IANA-registered ethernet type, but netconsole and netdump are using IP/UDP instead of a custom ethernet protocol.

This is useful, because it minimises the work needed to get them going over other transports, such as Myrinet. I'd rather not see the UDP encapsulation go away. Netconsole is already messy enough to configure and deal with; Matt Mackall's 2.6 forward port, that makes configuration more IP-oriented instead of less, is a step in the right direction.

	<b
#3 lore raw
In reply to Jeff Garzik

-----BEGIN PGP SIGNED MESSAGE-----

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jeff" == Jeff Garzik <[email protected]> writes:

Jeff> Essentially, all the things mentioned above need some way to listen Jeff> for incoming ethernet packets. ATA-over-ethernet has its own Jeff> IANA-registered ethernet type, but netconsole and netdump are using Jeff> IP/UDP instead of a custom ethernet protocol.

Jeff> So, two questions for the gurus of the crowd ;-)

Jeff> 1) What is the best way for an in-kernel piece of software to Jeff> receive ethernet packets that are intended for it?

For ethernet protocols, you can just register the protocol handler, and you
will get them.

Jeff> 2) Possibly related to #1, is it a good or bad idea to consider Jeff> sending netconsole/netdump directly over ethernet, eschewing the Jeff> IP/UDP/syslog stuff?

netconsole makes me really nervous, and I'd rather it was not over IP. (If you need a far-away remote console, then get another box with multiple
serial ports + SSH, or get an Annex, or...)

Another thing which would like UDP packets is the IPsec NAT-T stuff. It is even weirder, because some packets need to be *returned* to the
UDP socket. (I didn't design this protocol, and argued against putting the ESP and IKE traffic on the same port, but I lost that argument. I would have prefered to implement Teredo, and then do IPv4-ESP-IPv6-UDP-IPv4 instead, since it would encourage IPv6)

]      Out and about in Ottawa.    hmmm... beer.                |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] [email protected] http://www.sandelman.ottawa.on.ca/ |device driver[

] panic("Just another Debian/notebook using, kernel hacking, security guy"); [

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys - custom hacks make this fully PGP2 compat

iQCVAwUBP0O0p4qHRg3pndX9AQGjoAP/R37iSdbaK2aWqAwPZvY1DQ9JVSGdk+bq RBhtuixa3V2SC/kqacw6eUf4gbEMZZgtA0IP4tP0vYXYv3eIUBeB4wJGTBD7Sezn Tzwc1hJo/Eplbts+kirAM1DJ9Oh8/2HVVWvEQbyGvOqAE2WKzRrQYiCDuyuarH/F ksardhGJKcM=
=daOJ
-----END PGP SIGNATURE-----

#2 lore raw
In reply to Bryan O'Sullivan
Quoted 11 lines · Bryan O'Sullivan
Quoted 3 lines · Jeff Garzik

ATA-over-ethernet has its own
IANA-registered ethernet type, but netconsole and netdump are using IP/UDP instead of a custom ethernet protocol.

This is useful, because it minimises the work needed to get them going over other transports, such as Myrinet. I'd rather not see the UDP encapsulation go away. Netconsole is already messy enough to configure and deal with; Matt Mackall's 2.6 forward port, that makes configuration more IP-oriented instead of less, is a step in the right direction.

Configuration has zero to do with the protocol of choice.

I fully agree that current RH netconsole/netdump configuration is positively awful...

Jeff

#5 lore raw
In reply to Jeff Garzik
Quoted 5 lines · On Wed, 20 Aug 2003 13:59:29 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 2 lines · Michael Richardson

For ethernet protocols, you can just register the protocol handler, and you
will get them.

Dumb question: how? example code, or relevant functions to grep for?

He's talking about net/core/dev.c:dev_add_pack()

#4 lore raw
In reply to Michael Richardson
Quoted 2 lines · Michael Richardson

For ethernet protocols, you can just register the protocol handler, and you
will get them.

Dumb question: how? example code, or relevant functions to grep for?

grepping for 'register.*prot' didn't seem to turn up anything useful, and I didn't see any register*ether functions in linux/if_ether.h.

Thanks,

Jeff

#6 lore raw
In reply to David S. Miller
Quoted 10 lines · David S. Miller
Quoted 5 lines · On Wed, 20 Aug 2003 13:59:29 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 2 lines · Michael Richardson

For ethernet protocols, you can just register the protocol handler, and you
will get them.

Dumb question: how? example code, or relevant functions to grep for?

He's talking about net/core/dev.c:dev_add_pack()

Thanks much.

Tangent, from reading dev.c: Is it ok that dev_queue_xmit_nit does not check the return value of struct packet_type's ->func hook? It seems to do so in all other cases...

Jeff

#7 lore raw
Quoted 3 lines · On Wed, 20 Aug 2003 14:15:12 -0400 Jeff Garzik <[email protected]> wrote:

Tangent, from reading dev.c: Is it ok that dev_queue_xmit_nit does not check the return value of struct packet_type's ->func hook? It seems to do so in all other cases...

The return value isn't really used currently. It provides congestion heuristics that maybe eventually will be taken advantage of.