Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa Obtain and/or use ETHER_ADDR_LEN.
details: https://anonhg.NetBSD.org/src/rev/bbb8d88cd1c2
branches: trunk
changeset: 328209:bbb8d88cd1c2
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Sat Mar 29 14:30:16 2014 +0000
description:
Obtain and/or use ETHER_ADDR_LEN.
diffstat:
sys/lib/libsa/ether.c | 6 +++---
sys/lib/libsa/globals.c | 5 +++--
sys/lib/libsa/iodesc.h | 6 ++++--
sys/lib/libsa/net.h | 7 ++++---
sys/lib/libsa/rarp.c | 8 ++++----
5 files changed, 18 insertions(+), 14 deletions(-)
diffs (136 lines):
diff -r e704c27b9159 -r bbb8d88cd1c2 sys/lib/libsa/ether.c
--- a/sys/lib/libsa/ether.c Sat Mar 29 14:25:10 2014 +0000
+++ b/sys/lib/libsa/ether.c Sat Mar 29 14:30:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ether.c,v 1.22 2009/01/12 11:32:45 tsutsui Exp $ */
+/* $NetBSD: ether.c,v 1.23 2014/03/29 14:30:16 jakllsch Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -108,8 +108,8 @@
return -1;
/* Validate Ethernet address. */
- if (memcmp(d->myea, eh->ether_dhost, 6) != 0 &&
- memcmp(bcea, eh->ether_dhost, 6) != 0) {
+ if (memcmp(d->myea, eh->ether_dhost, ETHER_ADDR_LEN) != 0 &&
+ memcmp(bcea, eh->ether_dhost, ETHER_ADDR_LEN) != 0) {
#ifdef ETHER_DEBUG
if (debug)
printf("readether: not ours (ea=%s)\n",
diff -r e704c27b9159 -r bbb8d88cd1c2 sys/lib/libsa/globals.c
--- a/sys/lib/libsa/globals.c Sat Mar 29 14:25:10 2014 +0000
+++ b/sys/lib/libsa/globals.c Sat Mar 29 14:30:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.c,v 1.10 2014/01/05 21:38:25 jakllsch Exp $ */
+/* $NetBSD: globals.c,v 1.11 2014/03/29 14:30:16 jakllsch Exp $ */
/*
* globals.c:
@@ -8,13 +8,14 @@
*/
#include <sys/param.h>
+#include <net/if_ether.h> /* for ETHER_ADDR_LEN */
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include "stand.h"
#include "net.h"
-u_char bcea[6] = BA; /* broadcast ethernet address */
+u_char bcea[ETHER_ADDR_LEN] = BA; /* broadcast ethernet address */
char rootpath[FNAME_SIZE]; /* root mount path */
char bootfile[FNAME_SIZE]; /* bootp says to boot this */
diff -r e704c27b9159 -r bbb8d88cd1c2 sys/lib/libsa/iodesc.h
--- a/sys/lib/libsa/iodesc.h Sat Mar 29 14:25:10 2014 +0000
+++ b/sys/lib/libsa/iodesc.h Sat Mar 29 14:30:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iodesc.h,v 1.9 2009/01/17 14:00:36 tsutsui Exp $ */
+/* $NetBSD: iodesc.h,v 1.10 2014/03/29 14:30:16 jakllsch Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@@ -41,6 +41,8 @@
#ifndef __SYS_LIBNETBOOT_IODESC_H
#define __SYS_LIBNETBOOT_IODESC_H
+#include <net/if_ether.h> /* for ETHER_ADDR_LEN */
+
#ifdef _STANDALONE
/*
* libsa code uses the following types to avoid 64 bit time_t:
@@ -66,7 +68,7 @@
u_short destport; /* dest. port, net order */
u_short myport; /* local port, net order */
u_long xid; /* transaction identification */
- u_char myea[6]; /* my ethernet address */
+ u_char myea[ETHER_ADDR_LEN]; /* my ethernet address */
void *io_netif;
};
diff -r e704c27b9159 -r bbb8d88cd1c2 sys/lib/libsa/net.h
--- a/sys/lib/libsa/net.h Sat Mar 29 14:25:10 2014 +0000
+++ b/sys/lib/libsa/net.h Sat Mar 29 14:30:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: net.h,v 1.26 2011/05/11 16:23:40 zoltan Exp $ */
+/* $NetBSD: net.h,v 1.27 2014/03/29 14:30:16 jakllsch Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@@ -38,6 +38,7 @@
* SUCH DAMAGE.
*/
+#include <net/if_ether.h> /* for ETHER_ADDR_LEN */
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -57,7 +58,7 @@
/* Returns true if n_long's on the same net */
#define SAMENET(a1, a2, m) ((a1.s_addr & m) == (a2.s_addr & m))
-#define MACPY(s, d) memcpy(d, s, 6)
+#define MACPY(s, d) memcpy(d, s, ETHER_ADDR_LEN)
#define MAXTMO 20 /* seconds */
#define MINTMO 2 /* seconds */
@@ -89,7 +90,7 @@
#define TCP_TOTAL_HEADER_SIZE (ETHERNET_HEADER_SIZE + IP_HEADER_SIZE + TCP_HEADER_SIZE)
-extern u_char bcea[6];
+extern u_char bcea[ETHER_ADDR_LEN];
extern char rootpath[FNAME_SIZE];
extern char bootfile[FNAME_SIZE];
extern char hostname[FNAME_SIZE];
diff -r e704c27b9159 -r bbb8d88cd1c2 sys/lib/libsa/rarp.c
--- a/sys/lib/libsa/rarp.c Sat Mar 29 14:25:10 2014 +0000
+++ b/sys/lib/libsa/rarp.c Sat Mar 29 14:30:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rarp.c,v 1.31 2011/05/11 16:23:40 zoltan Exp $ */
+/* $NetBSD: rarp.c,v 1.32 2014/03/29 14:30:16 jakllsch Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -122,8 +122,8 @@
ap->arp_hln = sizeof(ap->arp_sha); /* hardware address length */
ap->arp_pln = sizeof(ap->arp_spa); /* protocol address length */
ap->arp_op = htons(ARPOP_REVREQUEST);
- (void)memcpy(ap->arp_sha, d->myea, 6);
- (void)memcpy(ap->arp_tha, d->myea, 6);
+ (void)memcpy(ap->arp_sha, d->myea, ETHER_ADDR_LEN);
+ (void)memcpy(ap->arp_tha, d->myea, ETHER_ADDR_LEN);
if (sendrecv(d,
rarpsend, &wbuf.data, sizeof(wbuf.data),
@@ -223,7 +223,7 @@
}
/* Is the reply for our Ethernet address? */
- if (memcmp(ap->arp_tha, d->myea, 6)) {
+ if (memcmp(ap->arp_tha, d->myea, ETHER_ADDR_LEN)) {
#ifdef RARP_DEBUG
if (debug)
printf("unwanted address\n");
Home |
Main Index |
Thread Index |
Old Index