Skip to content

Commit

Permalink
net: l2: ethernet: check if the dev->api->send method not NULL
Browse files Browse the repository at this point in the history
adds a check for "send" method in Ethernet river's API not being NULL in ethernet_send

Signed-off-by: Maciej Panek <[email protected]>
  • Loading branch information
panekmaciej committed Sep 1, 2024
1 parent a8e7562 commit 63fdd93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions subsys/net/l2/ethernet/ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,11 @@ static int ethernet_send(struct net_if *iface, struct net_pkt *pkt)
goto error;
}

if (!api->send) {
ret = -ENOTSUP;
goto error;
}

if (IS_ENABLED(CONFIG_NET_ETHERNET_BRIDGE) &&
net_pkt_is_l2_bridged(pkt)) {
net_pkt_cursor_init(pkt);
Expand Down

0 comments on commit 63fdd93

Please sign in to comment.