On Thu, 27 Sep 2018 03:02:24 +0300 Igor Ryzhov <iryz...@nfware.com> wrote:
> +/* > + * Extract hardware address from packet > + */ > +static int > +kni_net_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; > +} Kernel has function ether_addr_copy which is marginally faster and commonly used.