Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/dist/dhcp pull in code patches from usr.sbin/dhcp
details: https://anonhg.NetBSD.org/src/rev/2cce1d31bbf0
branches: trunk
changeset: 513551:2cce1d31bbf0
user: drochner <drochner%NetBSD.org@localhost>
date: Fri Aug 03 13:07:03 2001 +0000
description:
pull in code patches from usr.sbin/dhcp
diffstat:
dist/dhcp/client/clparse.c | 13 ++++++++++-
dist/dhcp/client/dhclient.c | 6 ++++-
dist/dhcp/common/bpf.c | 16 +++++++++-----
dist/dhcp/common/comapi.c | 6 ++++-
dist/dhcp/common/discover.c | 38 +++++++++++++++++++++++++-----------
dist/dhcp/common/dns.c | 7 +++++-
dist/dhcp/common/fddi.c | 18 ++++++++++++++--
dist/dhcp/common/packet.c | 6 ++--
dist/dhcp/common/parse.c | 15 +++++++++++--
dist/dhcp/common/print.c | 12 +++++-----
dist/dhcp/common/tables.c | 8 +++---
dist/dhcp/includes/cf/netbsd.h | 13 +++++++++++-
dist/dhcp/includes/dhcp.h | 9 ++++++++
dist/dhcp/includes/site.h | 4 ++-
dist/dhcp/minires/ns_samedomain.c | 4 +-
dist/dhcp/minires/ns_sign.c | 8 +++---
dist/dhcp/minires/res_findzonecut.c | 4 +-
dist/dhcp/omapip/errwarn.c | 14 ++++++++----
dist/dhcp/omapip/protocol.c | 4 +--
dist/dhcp/omapip/support.c | 6 +++++
20 files changed, 151 insertions(+), 60 deletions(-)
diffs (truncated from 838 to 300 lines):
diff -r 5dc3b86af7e8 -r 2cce1d31bbf0 dist/dhcp/client/clparse.c
--- a/dist/dhcp/client/clparse.c Fri Aug 03 12:58:38 2001 +0000
+++ b/dist/dhcp/client/clparse.c Fri Aug 03 13:07:03 2001 +0000
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: clparse.c,v 1.1.1.1 2001/08/03 11:35:30 drochner Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.2 2001/08/03 13:07:03 drochner Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -165,8 +165,13 @@
int token;
isc_result_t status;
- if ((file = open (name, O_RDONLY)) < 0)
+ if ((file = open (name, O_RDONLY)) < 0) {
+#ifndef SMALL
return uerr2isc (errno);
+#else
+ return errno == ENOENT ? ISC_R_NOTFOUND : ISC_R_NOPERM;
+#endif
+ }
cfile = (struct parse *)0;
new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
@@ -275,6 +280,7 @@
}
return;
+#if !defined (SMALL)
case KEY:
next_token (&val, (unsigned *)0, cfile);
if (ip) {
@@ -296,6 +302,7 @@
}
parse_key (cfile);
return;
+#endif
/* REQUIRE can either start a policy statement or a
comma-seperated list of names of required options. */
@@ -952,6 +959,7 @@
struct data_string key_id;
switch (next_token (&val, (unsigned *)0, cfile)) {
+#if !defined (SMALL)
case KEY:
token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING && !is_identifier (token)) {
@@ -964,6 +972,7 @@
parse_warn (cfile, "unknown key %s", val);
parse_semi (cfile);
break;
+#endif
case TOKEN_BOOTP:
lease -> is_bootp = 1;
break;
diff -r 5dc3b86af7e8 -r 2cce1d31bbf0 dist/dhcp/client/dhclient.c
--- a/dist/dhcp/client/dhclient.c Fri Aug 03 12:58:38 2001 +0000
+++ b/dist/dhcp/client/dhclient.c Fri Aug 03 13:07:03 2001 +0000
@@ -41,7 +41,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.1.1.1 2001/08/03 11:35:30 drochner Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.2 2001/08/03 13:07:03 drochner Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -426,6 +426,7 @@
if (release_mode)
return 0;
+#if !defined (SMALL)
/* Start up a listener for the object management API protocol. */
if (top_level_config.omapi_port != -1) {
listener = (omapi_object_t *)0;
@@ -441,6 +442,7 @@
log_fatal ("Can't start OMAPI protocol: %s",
isc_result_totext (result));
}
+#endif
/* Set up the bootp packet handler... */
bootp_packet_handler = do_packet;
@@ -3021,6 +3023,7 @@
&global_scope, oc, MDL))
return;
+#ifndef SMALL
/* Make a dhcid string out of either the client identifier,
if we are sending one, or the interface's MAC address,
otherwise. */
@@ -3073,4 +3076,5 @@
data_string_forget (&ddns_fwd_name, MDL);
data_string_forget (&ddns_dhcid, MDL);
+#endif
}
diff -r 5dc3b86af7e8 -r 2cce1d31bbf0 dist/dhcp/common/bpf.c
--- a/dist/dhcp/common/bpf.c Fri Aug 03 12:58:38 2001 +0000
+++ b/dist/dhcp/common/bpf.c Fri Aug 03 13:07:03 2001 +0000
@@ -47,7 +47,7 @@
#ifndef lint
static char copyright[] =
-"$Id: bpf.c,v 1.1.1.1 2001/08/03 11:35:31 drochner Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: bpf.c,v 1.2 2001/08/03 13:07:03 drochner Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -210,7 +210,7 @@
BPF_STMT(BPF_RET+BPF_K, 0),
};
-#if defined (DEC_FDDI)
+#if defined(DEC_FDDI) || defined(NETBSD_FDDI)
struct bpf_insn *bpf_fddi_filter;
#endif
@@ -241,9 +241,9 @@
u_int32_t addr;
struct bpf_program p;
u_int32_t bits;
-#ifdef DEC_FDDI
+#if defined(DEC_FDDI) || defined(NETBSD_FDDI)
int link_layer;
-#endif /* DEC_FDDI */
+#endif /* DEC_FDDI || NETBSD_FDDI */
/* Open a BPF device and hang it on this interface... */
info -> rfdesc = if_register_bpf (info);
@@ -290,7 +290,7 @@
/* Set up the bpf filter program structure. */
p.bf_len = dhcp_bpf_filter_len;
-#ifdef DEC_FDDI
+#if defined(DEC_FDDI) || defined(NETBSD_FDDI)
/* See if this is an FDDI interface, flag it for later. */
if (ioctl(info -> rfdesc, BIOCGDLT, &link_layer) >= 0 &&
link_layer == DLT_FDDI) {
@@ -314,7 +314,7 @@
}
p.bf_insns = bpf_fddi_filter;
} else
-#endif /* DEC_FDDI */
+#endif /* DEC_FDDI || NETBSD_FDDI */
p.bf_insns = dhcp_bpf_filter;
/* Patch the server port into the BPF program...
@@ -442,6 +442,10 @@
continue;
}
+ /* Adjust for any padding BPF inserted between the packets. */
+ interface -> rbuf_offset =
+ BPF_WORDALIGN (interface -> rbuf_offset);
+
/* Copy out a bpf header... */
memcpy (&hdr, &interface -> rbuf [interface -> rbuf_offset],
sizeof hdr);
diff -r 5dc3b86af7e8 -r 2cce1d31bbf0 dist/dhcp/common/comapi.c
--- a/dist/dhcp/common/comapi.c Fri Aug 03 12:58:38 2001 +0000
+++ b/dist/dhcp/common/comapi.c Fri Aug 03 13:07:03 2001 +0000
@@ -50,7 +50,7 @@
#ifndef lint
static char copyright[] =
-"$Id: comapi.c,v 1.1.1.1 2001/08/03 11:35:31 drochner Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: comapi.c,v 1.2 2001/08/03 13:07:03 drochner Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -331,6 +331,7 @@
return ISC_R_INVALIDARG;
group = (struct group_object *)h;
+#if !defined (SMALL)
/* Write out all the values. */
if (group -> name) {
status = omapi_connection_put_name (c, "name");
@@ -340,6 +341,7 @@
if (status != ISC_R_SUCCESS)
return status;
}
+#endif
/* Write out the inner object, if any. */
if (h -> inner && h -> inner -> type -> stuff_values) {
@@ -560,6 +562,7 @@
return ISC_R_INVALIDARG;
control = (dhcp_control_object_t *)h;
+#ifndef SMALL
/* Write out all the values. */
status = omapi_connection_put_name (c, "state");
if (status != ISC_R_SUCCESS)
@@ -570,6 +573,7 @@
status = omapi_connection_put_uint32 (c, control -> state);
if (status != ISC_R_SUCCESS)
return status;
+#endif
/* Write out the inner object, if any. */
if (h -> inner && h -> inner -> type -> stuff_values) {
diff -r 5dc3b86af7e8 -r 2cce1d31bbf0 dist/dhcp/common/discover.c
--- a/dist/dhcp/common/discover.c Fri Aug 03 12:58:38 2001 +0000
+++ b/dist/dhcp/common/discover.c Fri Aug 03 13:07:03 2001 +0000
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: discover.c,v 1.1.1.1 2001/08/03 11:35:32 drochner Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: discover.c,v 1.2 2001/08/03 13:07:04 drochner Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -84,6 +84,16 @@
isc_result_t status;
status = omapi_object_type_register (&dhcp_type_interface,
"interface",
+#ifdef SMALL
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+#else
dhcp_interface_set_value,
dhcp_interface_get_value,
dhcp_interface_destroy,
@@ -92,6 +102,7 @@
dhcp_interface_lookup,
dhcp_interface_create,
dhcp_interface_remove,
+#endif
0, 0, 0,
sizeof (struct interface_info),
interface_initialize);
@@ -296,7 +307,15 @@
#else
tmp -> hw_address.hlen = 6; /* XXX!!! */
#endif
- tmp -> hw_address.hbuf [0] = HTYPE_ETHER; /* XXX */
+ if (foo -> sdl_type == IFT_ETHER) {
+ tmp -> hw_address.hbuf [0] = HTYPE_ETHER;
+#if defined (DEC_FDDI) || defined(NETBSD_FDDI)
+ } else if (foo -> sdl_type == IFT_FDDI) {
+ tmp -> hw_address.hbuf [0] = HTYPE_FDDI;
+#endif
+ } else {
+ continue;
+ }
memcpy (&tmp -> hw_address.hbuf [1],
LLADDR (foo), tmp -> hw_address.hlen);
tmp -> hw_address.hlen++; /* for type. */
@@ -305,10 +324,11 @@
if (ifp -> ifr_addr.sa_family == AF_INET) {
struct iaddr addr;
+ void *ptr;
/* Get a pointer to the address... */
- memcpy (&foo, &ifp -> ifr_addr,
- sizeof ifp -> ifr_addr);
+ ptr = &ifp -> ifr_addr;
+ memcpy (&foo, ptr, sizeof ifp -> ifr_addr);
/* We don't want the loopback interface. */
if (foo.sin_addr.s_addr == htonl (INADDR_LOOPBACK) &&
@@ -761,14 +781,6 @@
if (result == 0)
return ISC_R_UNEXPECTED;
- /* If we didn't at least get the fixed portion of the BOOTP
- packet, drop the packet. We're allowing packets with no
- sname or filename, because we're aware of at least one
- client that sends such packets, but this definitely falls
- into the category of being forgiving. */
- if (result < DHCP_FIXED_NON_UDP - DHCP_SNAME_LEN - DHCP_FILE_LEN)
- return ISC_R_UNEXPECTED;
-
if (bootp_packet_handler) {
ifrom.len = 4;
memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
@@ -784,6 +796,7 @@
return ISC_R_SUCCESS;
}
+#if !defined (SMALL)
isc_result_t dhcp_interface_set_value (omapi_object_t *h,
omapi_object_t *id,
omapi_data_string_t *name,
@@ -1031,6 +1044,7 @@
interface_dereference (&hp, MDL);
Home |
Main Index |
Thread Index |
Old Index