summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-05-23 07:58:17 +0000
committerJoe Hershberger <joe.hershberger@ni.com>2012-05-23 17:46:18 -0500
commit674bb249825aa9b0bddab046d23d43c33bb75f78 (patch)
tree49fbeb7b7731bb655604a802af2914752ad39e0a /include
parent1256793b1862dcd1a6e5ee51e155c2e214b06594 (diff)
downloadu-boot-imx-674bb249825aa9b0bddab046d23d43c33bb75f78.zip
u-boot-imx-674bb249825aa9b0bddab046d23d43c33bb75f78.tar.gz
u-boot-imx-674bb249825aa9b0bddab046d23d43c33bb75f78.tar.bz2
net: cosmetic: Replace magic numbers in arp.c with constants
Use field names and sizes when accessing ARP packets Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'include')
-rw-r--r--include/net.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net.h b/include/net.h
index 730af4f..3bf0806 100644
--- a/include/net.h
+++ b/include/net.h
@@ -259,7 +259,9 @@ struct arp_hdr {
# define ARP_ETHER 1 /* Ethernet hardware address */
ushort ar_pro; /* Format of protocol address */
uchar ar_hln; /* Length of hardware address */
+# define ARP_HLEN 6
uchar ar_pln; /* Length of protocol address */
+# define ARP_PLEN 4
ushort ar_op; /* Operation */
# define ARPOP_REQUEST 1 /* Request to resolve address */
# define ARPOP_REPLY 2 /* Response to previous request */
@@ -273,6 +275,10 @@ struct arp_hdr {
* specific hardware/protocol combinations.
*/
uchar ar_data[0];
+#define ar_sha ar_data[0]
+#define ar_spa ar_data[ARP_HLEN]
+#define ar_tha ar_data[ARP_HLEN + ARP_PLEN]
+#define ar_tpa ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN]
#if 0
uchar ar_sha[]; /* Sender hardware address */
uchar ar_spa[]; /* Sender protocol address */