From 64cd693adaffee8f41082349901d63731885b25a Mon Sep 17 00:00:00 2001 From: drochner Date: Mon, 7 Jul 1997 15:52:49 +0000 Subject: [PATCH] Don't use private copy of old netinet/if_ether.h. Use for ethernet specific definitions, and insert private definitions for ARP if needed. (The new ARP macros in are not used because they create larger code, and we really don't need more than ethernet/ip support here.) --- sys/lib/libsa/arp.c | 24 ++++++++++++++++++++++-- sys/lib/libsa/ether.c | 4 ++-- sys/lib/libsa/net.c | 4 ++-- sys/lib/libsa/rarp.c | 25 +++++++++++++++++++++++-- 4 files changed, 49 insertions(+), 8 deletions(-) diff --git a/sys/lib/libsa/arp.c b/sys/lib/libsa/arp.c index 917de85755c2..f44a75f6f6ab 100644 --- a/sys/lib/libsa/arp.c +++ b/sys/lib/libsa/arp.c @@ -1,4 +1,4 @@ -/* $NetBSD: arp.c,v 1.17 1997/06/26 19:11:30 drochner Exp $ */ +/* $NetBSD: arp.c,v 1.18 1997/07/07 15:52:49 drochner Exp $ */ /* * Copyright (c) 1992 Regents of the University of California. @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -52,10 +53,29 @@ #include #endif -#include "if_ether.h" #include "stand.h" #include "net.h" +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_int8_t arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */ + u_int8_t arp_spa[4]; /* sender protocol address */ + u_int8_t arp_tha[ETHER_ADDR_LEN]; /* target hardware address */ + u_int8_t arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + /* Cache stuff */ #define ARP_NUM 8 /* need at most 3 arp entries */ diff --git a/sys/lib/libsa/ether.c b/sys/lib/libsa/ether.c index 49d15f3774da..7984ef5d00f1 100644 --- a/sys/lib/libsa/ether.c +++ b/sys/lib/libsa/ether.c @@ -1,4 +1,4 @@ -/* $NetBSD: ether.c,v 1.10 1997/06/26 19:11:36 drochner Exp $ */ +/* $NetBSD: ether.c,v 1.11 1997/07/07 15:52:50 drochner Exp $ */ /* * Copyright (c) 1992 Regents of the University of California. @@ -48,12 +48,12 @@ #endif #include +#include #include #include #include -#include "if_ether.h" #include "stand.h" #include "net.h" #include "netif.h" diff --git a/sys/lib/libsa/net.c b/sys/lib/libsa/net.c index a0338e0d182f..733509552891 100644 --- a/sys/lib/libsa/net.c +++ b/sys/lib/libsa/net.c @@ -1,4 +1,4 @@ -/* $NetBSD: net.c,v 1.16 1997/06/26 19:11:42 drochner Exp $ */ +/* $NetBSD: net.c,v 1.17 1997/07/07 15:52:51 drochner Exp $ */ /* * Copyright (c) 1992 Regents of the University of California. @@ -49,6 +49,7 @@ #endif #include +#include #include #include @@ -57,7 +58,6 @@ #include #include -#include "if_ether.h" #include "stand.h" #include "net.h" diff --git a/sys/lib/libsa/rarp.c b/sys/lib/libsa/rarp.c index 452141e396a4..1753d4a1ff43 100644 --- a/sys/lib/libsa/rarp.c +++ b/sys/lib/libsa/rarp.c @@ -1,4 +1,4 @@ -/* $NetBSD: rarp.c,v 1.15 1997/06/26 19:11:50 drochner Exp $ */ +/* $NetBSD: rarp.c,v 1.16 1997/07/07 15:52:52 drochner Exp $ */ /* * Copyright (c) 1992 Regents of the University of California. @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -51,11 +52,31 @@ #include #endif -#include "if_ether.h" #include "stand.h" #include "net.h" #include "netif.h" + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_int8_t arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */ + u_int8_t arp_spa[4]; /* sender protocol address */ + u_int8_t arp_tha[ETHER_ADDR_LEN]; /* target hardware address */ + u_int8_t arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + static ssize_t rarpsend __P((struct iodesc *, void *, size_t)); static ssize_t rarprecv __P((struct iodesc *, void *, size_t, time_t));