2019-05-27 09:55:01 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* INET An implementation of the TCP/IP protocol suite for the LINUX
|
|
|
|
* operating system. INET is implemented using the BSD Socket
|
|
|
|
* interface as the means of communication with the user level.
|
|
|
|
*
|
|
|
|
* Global definitions for the ARP (RFC 826) protocol.
|
|
|
|
*
|
|
|
|
* Version: @(#)if_arp.h 1.0.1 04/16/93
|
|
|
|
*
|
|
|
|
* Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988
|
|
|
|
* Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source.
|
2005-05-06 03:16:16 +04:00
|
|
|
* Ross Biro
|
2005-04-17 02:20:36 +04:00
|
|
|
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
|
|
|
* Florian La Roche,
|
|
|
|
* Jonathan Layes <layes@loran.com>
|
|
|
|
* Arnaldo Carvalho de Melo <acme@conectiva.com.br> ARPHRD_HWX25
|
|
|
|
*/
|
|
|
|
#ifndef _LINUX_IF_ARP_H
|
|
|
|
#define _LINUX_IF_ARP_H
|
|
|
|
|
2007-03-13 02:56:31 +03:00
|
|
|
#include <linux/skbuff.h>
|
2012-10-13 13:46:48 +04:00
|
|
|
#include <uapi/linux/if_arp.h>
|
2007-03-13 02:56:31 +03:00
|
|
|
|
|
|
|
static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
return (struct arphdr *)skb_network_header(skb);
|
|
|
|
}
|
2008-03-03 23:20:57 +03:00
|
|
|
|
2017-09-26 23:12:28 +03:00
|
|
|
static inline unsigned int arp_hdr_len(const struct net_device *dev)
|
2008-03-03 23:20:57 +03:00
|
|
|
{
|
firewire net, ipv4 arp: Extend hardware address and remove driver-level packet inspection.
Inspection of upper layer protocol is considered harmful, especially
if it is about ARP or other stateful upper layer protocol; driver
cannot (and should not) have full state of them.
IPv4 over Firewire module used to inspect ARP (both in sending path
and in receiving path), and record peer's GUID, max packet size, max
speed and fifo address. This patch removes such inspection by extending
our "hardware address" definition to include other information as well:
max packet size, max speed and fifo. By doing this, The neighbour
module in networking subsystem can cache them.
Note: As we have started ignoring sspd and max_rec in ARP/NDP, those
information will not be used in the driver when sending.
When a packet is being sent, the IP layer fills our pseudo header with
the extended "hardware address", including GUID and fifo. The driver
can look-up node-id (the real but rather volatile low-level address)
by GUID, and then the module can send the packet to the wire using
parameters provided in the extendedn hardware address.
This approach is realistic because IP over IEEE1394 (RFC2734) and IPv6
over IEEE1394 (RFC3146) share same "hardware address" format
in their address resolution protocols.
Here, extended "hardware address" is defined as follows:
union fwnet_hwaddr {
u8 u[16];
struct {
__be64 uniq_id; /* EUI-64 */
u8 max_rec; /* max packet size */
u8 sspd; /* max speed */
__be16 fifo_hi; /* hi 16bits of FIFO addr */
__be32 fifo_lo; /* lo 32bits of FIFO addr */
} __packed uc;
};
Note that Hardware address is declared as union, so that we can map full
IP address into this, when implementing MCAP (Multicast Cannel Allocation
Protocol) for IPv6, but IP and ARP subsystem do not need to know this
format in detail.
One difference between original ARP (RFC826) and 1394 ARP (RFC2734)
is that 1394 ARP Request/Reply do not contain the target hardware address
field (aka ar$tha). This difference is handled in the ARP subsystem.
CC: Stephan Gatzka <stephan.gatzka@gmail.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-25 12:26:16 +04:00
|
|
|
switch (dev->type) {
|
|
|
|
#if IS_ENABLED(CONFIG_FIREWIRE_NET)
|
|
|
|
case ARPHRD_IEEE1394:
|
|
|
|
/* ARP header, device address and 2 IP addresses */
|
|
|
|
return sizeof(struct arphdr) + dev->addr_len + sizeof(u32) * 2;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
/* ARP header, plus 2 device addresses, plus 2 IP addresses. */
|
|
|
|
return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
|
|
|
|
}
|
2008-03-03 23:20:57 +03:00
|
|
|
}
|
2016-11-26 03:28:06 +03:00
|
|
|
|
|
|
|
static inline bool dev_is_mac_header_xmit(const struct net_device *dev)
|
|
|
|
{
|
|
|
|
switch (dev->type) {
|
|
|
|
case ARPHRD_TUNNEL:
|
|
|
|
case ARPHRD_TUNNEL6:
|
|
|
|
case ARPHRD_SIT:
|
|
|
|
case ARPHRD_IPGRE:
|
2021-06-21 23:08:49 +03:00
|
|
|
case ARPHRD_IP6GRE:
|
2016-11-26 03:28:06 +03:00
|
|
|
case ARPHRD_VOID:
|
|
|
|
case ARPHRD_NONE:
|
2019-01-24 14:07:02 +03:00
|
|
|
case ARPHRD_RAWIP:
|
2022-03-15 12:20:08 +03:00
|
|
|
case ARPHRD_PIMREG:
|
2016-11-26 03:28:06 +03:00
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif /* _LINUX_IF_ARP_H */
|