It's just exact copy of eth_header_parse function from Linux kernel. No problem, can do that with ether_addr_copy.
On Sat, Sep 29, 2018 at 10:22 AM Stephen Hemminger < step...@networkplumber.org> wrote: > 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. >