net: route: Skip lladdr check for ppp

ppp does not populate the lladdr fields in the received packet.
To enable routing for packets received on the ppp interface, the check
of the link layer addresses in the packet must be skipped.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
This commit is contained in:
Christian Taedcke 2020-06-17 11:19:09 +02:00 committed by Ioannis Glaropoulos
commit 0b849744cd

View file

@ -789,20 +789,28 @@ int net_route_packet(struct net_pkt *pkt, struct in6_addr *nexthop)
* network technologies enabled.
*/
if (net_if_l2(net_pkt_iface(pkt)) != &NET_L2_GET_NAME(DUMMY)) {
#endif
#if defined(CONFIG_NET_L2_PPP)
/* PPP does not populate the lladdr fields */
if (net_if_l2(net_pkt_iface(pkt)) != &NET_L2_GET_NAME(PPP)) {
#endif
if (!net_pkt_lladdr_src(pkt)->addr) {
NET_DBG("Link layer source address not set");
return -EINVAL;
}
/* Sanitycheck: If src and dst ll addresses are going to be
* same, then something went wrong in route lookup.
/* Sanitycheck: If src and dst ll addresses are going
* to be same, then something went wrong in route
* lookup.
*/
if (!memcmp(net_pkt_lladdr_src(pkt)->addr, lladdr->addr,
lladdr->len)) {
NET_ERR("Src ll and Dst ll are same");
return -EINVAL;
}
#if defined(CONFIG_NET_L2_PPP)
}
#endif
#if defined(CONFIG_NET_L2_DUMMY)
}
#endif