From: Ted Lemon Date: Thu, 9 Apr 1998 04:30:00 +0000 (+0000) Subject: Check HAVE_SIN_LEN in sockaddr_dl code. Kludge hardware address length for now... X-Git-Tag: carrel-2~140 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb1989a8aaea92c70b1585738ae23b0a957753d7;p=thirdparty%2Fdhcp.git Check HAVE_SIN_LEN in sockaddr_dl code. Kludge hardware address length for now if HAVE_SIN_LEN isn't set. Return pointer to struct proto from add_protocol. --- diff --git a/common/dispatch.c b/common/dispatch.c index 4a3f07476..c92cbf363 100644 --- a/common/dispatch.c +++ b/common/dispatch.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dispatch.c,v 1.48 1998/03/16 06:09:58 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dispatch.c,v 1.49 1998/04/09 04:30:00 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -177,10 +177,14 @@ void discover_interfaces (state) if (ifp -> ifr_addr.sa_family == AF_LINK) { struct sockaddr_dl *foo = ((struct sockaddr_dl *) (&ifp -> ifr_addr)); +#if defined (HAVE_SIN_LEN) tmp -> hw_address.hlen = foo -> sdl_alen; +#else + tmp -> hw_address.hlen = 6; /* XXX!!! */ +#endif tmp -> hw_address.htype = HTYPE_ETHER; /* XXX */ memcpy (tmp -> hw_address.haddr, - LLADDR (foo), foo -> sdl_alen); + LLADDR (foo), tmp -> hw_address.hlen); } else #endif /* AF_LINK */ @@ -708,7 +712,7 @@ void cancel_timeout (where, what) } /* Add a protocol to the list of protocols... */ -void add_protocol (name, fd, handler, local) +struct protocol *add_protocol (name, fd, handler, local) char *name; int fd; void (*handler) PROTO ((struct protocol *)); @@ -726,6 +730,7 @@ void add_protocol (name, fd, handler, local) p -> next = protocols; protocols = p; + return p; } void remove_protocol (proto)