net: Introduce NET_IF_POINTOPOINT flag

This flag can be used by driver to indicate pointopoint links which should
not require destination link address to be resolved.

Jira: ZEP-1656

Change-Id: I58dd3bf48485d6203e75373497e00668317b9825
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2017-02-02 11:58:15 +02:00 committed by Jukka Rissanen
commit 2c1bef4d09
3 changed files with 14 additions and 1 deletions

View file

@ -150,6 +150,9 @@ enum {
/* interface is up/ready to receive and transmit */
NET_IF_UP,
/* interface is pointopoint */
NET_IF_POINTOPOINT,
/* Total number of flags - must be at the end of the enum */
NET_IF_NUM_FLAGS
};

View file

@ -491,6 +491,13 @@ struct net_buf *net_ipv6_prepare_for_send(struct net_buf *buf)
struct net_if *iface = NULL;
struct net_nbr *nbr;
/* Workaround Linux bug, see:
* https://jira.zephyrproject.org/browse/ZEP-1656
*/
if (atomic_test_bit(net_nbuf_iface(buf)->flags, NET_IF_POINTOPOINT)) {
return buf;
}
if (net_nbuf_ll_dst(buf)->addr ||
net_is_ipv6_addr_mcast(&NET_IPV6_BUF(buf)->dst)) {
return buf;

View file

@ -154,8 +154,11 @@ enum net_verdict net_if_send_data(struct net_if *iface, struct net_buf *buf)
/* If the ll address is not set at all, then we must set
* it here.
* Workaround Linux bug, see:
* https://jira.zephyrproject.org/browse/ZEP-1656
*/
if (!net_nbuf_ll_src(buf)->addr) {
if (!atomic_test_bit(iface->flags, NET_IF_POINTOPOINT) &&
!net_nbuf_ll_src(buf)->addr) {
net_nbuf_ll_src(buf)->addr = net_nbuf_ll_if(buf)->addr;
net_nbuf_ll_src(buf)->len = net_nbuf_ll_if(buf)->len;
}