0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef _LINUX_IF_ARP_H
0020 #define _LINUX_IF_ARP_H
0021
0022 #include <linux/skbuff.h>
0023 #include <uapi/linux/if_arp.h>
0024
0025 static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
0026 {
0027 return (struct arphdr *)skb_network_header(skb);
0028 }
0029
0030 static inline unsigned int arp_hdr_len(const struct net_device *dev)
0031 {
0032 switch (dev->type) {
0033 #if IS_ENABLED(CONFIG_FIREWIRE_NET)
0034 case ARPHRD_IEEE1394:
0035
0036 return sizeof(struct arphdr) + dev->addr_len + sizeof(u32) * 2;
0037 #endif
0038 default:
0039
0040 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
0041 }
0042 }
0043
0044 static inline bool dev_is_mac_header_xmit(const struct net_device *dev)
0045 {
0046 switch (dev->type) {
0047 case ARPHRD_TUNNEL:
0048 case ARPHRD_TUNNEL6:
0049 case ARPHRD_SIT:
0050 case ARPHRD_IPGRE:
0051 case ARPHRD_IP6GRE:
0052 case ARPHRD_VOID:
0053 case ARPHRD_NONE:
0054 case ARPHRD_RAWIP:
0055 case ARPHRD_PIMREG:
0056 return false;
0057 default:
0058 return true;
0059 }
0060 }
0061
0062 #endif