summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2005-04-14 15:09:06 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2005-04-14 15:09:06 +0000
commitef1f80ea300f47a91d1ab251c12bd5d3a7f7bf93 (patch)
tree95caa7f683ce0958a7e8de2c39b36efdab3a1b93
parent2005-04-14 Ralf Corsepius <ralf.corsepius@rtems.org> (diff)
downloadrtems-ef1f80ea300f47a91d1ab251c12bd5d3a7f7bf93.tar.bz2
Partial updates from FreeBSD.
-rw-r--r--cpukit/libnetworking/net/if_arp.h47
-rw-r--r--cpukit/libnetworking/net/if_ethersubr.c8
-rw-r--r--cpukit/libnetworking/netinet/if_ether.h17
-rw-r--r--cpukit/libnetworking/netinet/in.h12
4 files changed, 54 insertions, 30 deletions
diff --git a/cpukit/libnetworking/net/if_arp.h b/cpukit/libnetworking/net/if_arp.h
index a581c21558..5d3414cb9b 100644
--- a/cpukit/libnetworking/net/if_arp.h
+++ b/cpukit/libnetworking/net/if_arp.h
@@ -10,10 +10,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,13 +27,16 @@
* SUCH DAMAGE.
*
* @(#)if_arp.h 8.1 (Berkeley) 6/10/93
- * $Id$
+ * $FreeBSD: src/sys/net/if_arp.h,v 1.21 2005/01/07 01:45:34 imp Exp $
*/
#ifndef _NET_IF_ARP_H_
#define _NET_IF_ARP_H_
-#include <netinet/in.h>
+#ifdef __rtems__
+#define BYTE_PACK __attribute__((packed))
+#endif
+
/*
* Address Resolution Protocol.
*
@@ -74,6 +73,15 @@ struct arphdr {
#endif
};
+#define ar_sha(ap) (((caddr_t)((ap)+1)) + 0)
+#define ar_spa(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln)
+#define ar_tha(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln)
+#define ar_tpa(ap) (((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)
+
+#define arphdr_len2(ar_hln, ar_pln) \
+ (sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln))
+#define arphdr_len(ap) (arphdr_len2((ap)->ar_hln, (ap)->ar_pln))
+
/*
* ARP ioctl request
*/
@@ -89,4 +97,31 @@ struct arpreq {
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
+#ifdef _KERNEL
+/*
+ * Structure shared between the ethernet driver modules and
+ * the address resolution code. For example, each ec_softc or il_softc
+ * begins with this structure.
+ * The code is written so that each *_softc _must_ begin with a
+ * struct arpcom, which in turn _must_ begin with a struct ifnet.
+ */
+struct arpcom {
+ /*
+ * The ifnet struct _must_ be at the head of this structure.
+ */
+ struct ifnet ac_if; /* network-visible interface */
+ u_char ac_enaddr[6]; /* ethernet hardware address */
+#if defined(__rtems__)
+/* Cruft from ancient BSD - should be removed once RTEMS is updated */
+ struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */
+ int ac_multicnt; /* length of ac_multiaddrs list */
+#else
+ int now_unused; /* XXX was length of ac_multiaddrs list */
+ void *ac_netgraph; /* ng_ether(4) netgraph node info */
+#endif
+};
+#define IFP2AC(ifp) ((struct arpcom *)(ifp))
+
+#endif
+
#endif /* !_NET_IF_ARP_H_ */
diff --git a/cpukit/libnetworking/net/if_ethersubr.c b/cpukit/libnetworking/net/if_ethersubr.c
index 50c1d48cd7..2b516d68a7 100644
--- a/cpukit/libnetworking/net/if_ethersubr.c
+++ b/cpukit/libnetworking/net/if_ethersubr.c
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.179 2004/10/12 10:33:41 glebius Exp $
+ * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.189 2005/03/06 22:59:40 sobomax Exp $
*/
/*
@@ -76,6 +76,10 @@
#include <netinet6/nd6.h>
#endif
+#ifdef DEV_CARP
+#include <netinet/ip_carp.h>
+#endif
+
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
@@ -94,7 +98,7 @@ extern u_char aarp_org_code[3];
#endif /* NETATALK */
u_char etherbroadcastaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-#define senderr(e) { error = (e); goto bad;}
+#define senderr(e) do { error = (e); goto bad;} while (0)
/*
* Ethernet output routine.
diff --git a/cpukit/libnetworking/netinet/if_ether.h b/cpukit/libnetworking/netinet/if_ether.h
index b033c2a93c..5e39e43f2f 100644
--- a/cpukit/libnetworking/netinet/if_ether.h
+++ b/cpukit/libnetworking/netinet/if_ether.h
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)if_ether.h 8.3 (Berkeley) 5/2/95
- * $FreeBSD: src/sys/netinet/if_ether.h,v 1.30 2004/04/07 20:46:13 imp Exp $
+ * $FreeBSD: src/sys/netinet/if_ether.h,v 1.32 2005/02/22 13:04:03 glebius Exp $
*/
/*
@@ -80,21 +80,6 @@ struct ether_arp {
#define arp_op ea_hdr.ar_op
-/*
- * Structure shared between the ethernet driver modules and
- * the address resolution code. For example, each ec_softc or il_softc
- * begins with this structure.
- */
-struct arpcom {
- /*
- * The ifnet struct _must_ be at the head of this structure.
- */
- struct ifnet ac_if; /* network-visible interface */
- u_char ac_enaddr[ETHER_ADDR_LEN]; /* ethernet hardware address */
- struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */
- int ac_multicnt; /* length of ac_multiaddrs list */
-};
-
struct sockaddr_inarp {
u_char sin_len;
u_char sin_family;
diff --git a/cpukit/libnetworking/netinet/in.h b/cpukit/libnetworking/netinet/in.h
index 884a19ff99..4adfee689a 100644
--- a/cpukit/libnetworking/netinet/in.h
+++ b/cpukit/libnetworking/netinet/in.h
@@ -234,31 +234,31 @@ struct in_addr {
* On subnets, the decomposition of addresses to host and net parts
* is done according to subnet mask, not the masks here.
*/
-#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
+#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA_MAX 128
-#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
+#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB_MAX 65536
-#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
+#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ff
-#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
+#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
#define IN_MULTICAST(i) IN_CLASSD(i)
-#define IN_EXPERIMENTAL(i) (((long)(i) & 0xf0000000) == 0xf0000000)
-#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000)
+#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
+#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
#define INADDR_ANY (u_long)0x00000000
#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */