-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: added generic network interface header format #2449
Conversation
uint8_t addr_len; /**< link layer address length in byte */ | ||
uint8_t rssi; /**< rssi of received packet (optional) */ | ||
uint8_t lqi; /**< lqi of received packet (optional) */ | ||
uint8_t options; /**< any optional options */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"optional options" ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Seriously - what is this supposed to be?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is open for discussion, there 8-bit left in the struct to fill (so it aligns), so I thought some options field might be a good idea...
I don't fully understand the purpose of this PR. Why should any layer apart from IP/network layer be interested in the link layer header? Even for the network layer I'm not sure, where it would be needed. |
The purpose is to unify the very heterogeneous link layer headers with a simpler, but common, header format. The drivers translate it then to the format they need / they translate it from their format to the common one.
Routing needs sometimes information for their metrics (see #2449 (comment)) + according to @cgundogan their are TCP extensions that use link-layer information.
Uhm, ARP/NDP needs to now the link layer addresses? |
Just stumbled upon this: can you rename this module |
As far as I see it, the required information (e.g. RSSI or ETX) are rather PHY layer information. They are usually not part of a link layer header. I complete agree that it makes sense to provide this data to upper layers or routing, but I would not put them into a link-layer header.
To my understanding (and at least Wikipedia agrees) ARP and NDP are not part of the network layer. Maybe the general problem is more a terminology problem. This PR seems to provide information like the one that is currently handled by |
We also would then have a really easy scheme to refer to the different layers in abbreviations:
|
And why not KISS and unify this into one header? |
Yes, but at least NDP is controlled by a network layer protocol (ICMPv6). That means, that the network layer needs this information to have any kind of network resolution. |
I would argue that ICMP is not pure network layer protocol (since it uses IP for transport), but that's not the point. I'm not against unifying this information, but strongly against putting all into a structure called link-layer header. |
uint8_t rssi; /**< rssi of received packet (optional) */ | ||
uint8_t lqi; /**< lqi of received packet (optional) */ | ||
uint8_t options; /**< any optional options */ | ||
} llhdr_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to put the PID for the link-layer interface in here to. While implementing IPv6 I wondered how else a routing protocol might get those to put them in the FIB. Do they need it anyway? @cgundogan @Lotterleben @benpicco or @fnack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for multi-interface support in NHDP and OLSRv2 which are working atop of IPv6 it is necessary that the protocols can determine on which interface a packet was received on. I haven't looked into the whole new network stack structure yet, so I can't assess whether this is the right struct to save this information but generally the information has to be available somewhere for network layer protocols.
I agree that link layer header wasn't maybe the best name for this -> I renamed it to interface header for now, somebody has a better idea? Anyway: The notion behind this PR is, that we need a generic way to speak with link-layers/network interfaces of different type - and this is done through this proposed header format. For sending out data the link layer addresses are given to the link layer using this header. When receiving data, the link layer addresses and additionally all information that is interesting for upper layers is bundled into this header, so it can be accessed generically from layers above (without having them to know any specifics of the underlying link layer technologies...). |
aa697c4
to
eacec1e
Compare
and some more fixes... |
I would argue that things like RSSI values are part of any header. |
true, not in a conventional sense. But how would you make this data available to upper layers in a clean way? |
Maybe calling the struct something like |
just makes stuff more complicated by introducing additional de-referencing... remember this data is allocated in the packet buffer and every new element in the pktsnip-chain introduces addtional overhead... |
Then the question is strict layering vs. efficiency, I guess. |
In general I like the connection to interfaces for the name, but for consistency I would name it |
@authmillenon: I think that would make sense. But I probably won't get to it before next week... |
555c23c
to
8a33d55
Compare
renamed it to |
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
*/ | ||
|
||
#ifndef IFHDR_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arghs: one last minute thing: %s/IFHDR/NG_NETIF_HDR/g
;-)
addressed comments. |
|
||
/** | ||
* @defgroup ng_netif_hdr Generic network interface header | ||
* @{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not want the @ingroup ng_netif
to go :(
addresses more comments. |
ACK - squash please |
squashed and go. |
net: added generic network interface header format
This is a first approach to a generic link layer header that can be used throughout the network stack.
The basic idea is create a link layer header format, that all link layers understand and that contains the data from link layers, that upper protocols might be interested in.
I am not too happy with this implementation yet, maybe somebody has a better idea how to deal with varying address sizes?