Skip to content

Commit 35df867

Browse files
clamattiakartben
authored andcommitted
net: ethernet: remove unused family variable
Remove unused family variable from receive function in ethernet layer 2. It is checked only once under such conditions, that do not allow the variable to be different. Signed-off-by: Cla Mattia Galliard <[email protected]>
1 parent c9647a5 commit 35df867

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

subsys/net/l2/ethernet/ethernet.c

+1-8
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
240240
uint8_t hdr_len = sizeof(struct net_eth_hdr);
241241
uint16_t type;
242242
struct net_linkaddr *lladdr;
243-
sa_family_t family = AF_UNSPEC;
244243
bool is_vlan_pkt = false;
245244

246245
/* This expects that the Ethernet header is in the first net_buf
@@ -315,18 +314,14 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
315314
case NET_ETH_PTYPE_IP:
316315
case NET_ETH_PTYPE_ARP:
317316
net_pkt_set_family(pkt, AF_INET);
318-
family = AF_INET;
319317
break;
320318
case NET_ETH_PTYPE_IPV6:
321319
net_pkt_set_family(pkt, AF_INET6);
322-
family = AF_INET6;
323320
break;
324321
case NET_ETH_PTYPE_EAPOL:
325-
family = AF_UNSPEC;
326322
break;
327323
#if defined(CONFIG_NET_L2_PTP)
328324
case NET_ETH_PTYPE_PTP:
329-
family = AF_UNSPEC;
330325
break;
331326
#endif
332327
case NET_ETH_PTYPE_LLDP:
@@ -339,7 +334,6 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
339334
#endif
340335
default:
341336
if (IS_ENABLED(CONFIG_NET_ETHERNET_FORWARD_UNRECOGNISED_ETHERTYPE)) {
342-
family = AF_UNSPEC;
343337
break;
344338
}
345339

@@ -398,8 +392,7 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
398392

399393
ethernet_update_rx_stats(iface, hdr, net_pkt_get_len(pkt) + hdr_len);
400394

401-
if (IS_ENABLED(CONFIG_NET_ARP) &&
402-
family == AF_INET && type == NET_ETH_PTYPE_ARP) {
395+
if (IS_ENABLED(CONFIG_NET_ARP) && type == NET_ETH_PTYPE_ARP) {
403396
NET_DBG("ARP packet from %s received",
404397
net_sprint_ll_addr((uint8_t *)hdr->src.addr,
405398
sizeof(struct net_eth_addr)));

0 commit comments

Comments
 (0)