Obtain and/or use ETHER_ADDR_LEN.
This commit is contained in:
parent
836038fc64
commit
edd6a404ba
@ -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 @@ readether(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft,
|
||||
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",
|
||||
|
@ -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 */
|
||||
|
@ -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 @@ struct iodesc {
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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 @@ rarp_getipaddress(int sock)
|
||||
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 @@ rarprecv(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
|
||||
}
|
||||
|
||||
/* 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");
|
||||
|
Loading…
Reference in New Issue
Block a user