Signed-off-by: Darya Litvintseva <litv.da...@gmail.com> --- net/ethernet/eth.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index fd8faa0dfa61..3b430e245d58 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -90,9 +90,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, else eth->h_proto = htons(len); - /* - * Set the source hardware address. - */ + /* Set the source hardware address.*/ if (!saddr) saddr = dev->dev_addr; @@ -103,9 +101,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, return ETH_HLEN; } - /* - * Anyway, the loopback-device should never use this function... - */ + /* Anyway, the loopback-device should never use this function... */ if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) { eth_zero_addr(eth->h_dest); @@ -170,13 +166,11 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) skb->pkt_type = PACKET_BROADCAST; else skb->pkt_type = PACKET_MULTICAST; - } - else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, + } else if (unlikely(!ether_addr_equal_64bits(eth->h_dest, dev->dev_addr))) skb->pkt_type = PACKET_OTHERHOST; - /* - * Some variants of DSA tagging don't have an ethertype field + /* Some variants of DSA tagging don't have an ethertype field * at all, so we check here whether one of those tagging * variants has been configured on the receiving interface, * and if so, set skb->protocol without looking at the packet. @@ -187,8 +181,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) if (likely(eth_proto_is_802_3(eth->h_proto))) return eth->h_proto; - /* - * This is a magic hack to spot IPX packets. Older Novell breaks + /* This is a magic hack to spot IPX packets. Older Novell breaks * the protocol design and runs IPX over 802.3 without an 802.2 LLC * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This * won't work for fault tolerant netware but does for the rest. @@ -197,8 +190,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) if (sap && *sap == 0xFFFF) return htons(ETH_P_802_3); - /* - * Real 802.2 LLC + /* Real 802.2 LLC */ return htons(ETH_P_802_2); } @@ -212,6 +204,7 @@ EXPORT_SYMBOL(eth_type_trans); int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr) { const struct ethhdr *eth = eth_hdr(skb); + memcpy(haddr, eth->h_source, ETH_ALEN); return ETH_ALEN; } @@ -355,7 +348,7 @@ void ether_setup(struct net_device *dev) { dev->header_ops = ð_header_ops; dev->type = ARPHRD_ETHER; - dev->hard_header_len = ETH_HLEN; + dev->hard_header_len = ETH_HLEN; dev->min_header_len = ETH_HLEN; dev->mtu = ETH_DATA_LEN; dev->min_mtu = ETH_MIN_MTU; -- 2.19.1