#ifndef lint
static char copyright[] =
-"$Id: bpf.c,v 1.14 1997/01/02 12:00:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: bpf.c,v 1.15 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Patch the server port into the BPF program...
XXX changes to filter program may require changes
to the insn number(s) used below! XXX */
- filter [8].k = ntohs (server_port);
+ filter [8].k = ntohs (local_port);
if (ioctl (info -> rfdesc, BIOCSETF, &p) < 0)
error ("Can't install packet filter program: %m");
#ifndef lint
static char copyright[] =
-"$Id: bpf.c,v 1.14 1997/01/02 12:00:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: bpf.c,v 1.15 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Patch the server port into the BPF program...
XXX changes to filter program may require changes
to the insn number(s) used below! XXX */
- filter [8].k = ntohs (server_port);
+ filter [8].k = ntohs (local_port);
if (ioctl (info -> rfdesc, BIOCSETF, &p) < 0)
error ("Can't install packet filter program: %m");
#ifndef lint
static char copyright[] =
-"$Id: nit.c,v 1.10 1997/01/02 12:00:17 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: nit.c,v 1.11 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_CAND;
pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHWORD + 18;
pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHLIT + ENF_CAND;
- pf.Pf_Filter [pf.Pf_FilterLen++] = server_port;
+ pf.Pf_Filter [pf.Pf_FilterLen++] = local_port;
/* Install the filter... */
sio.ic_cmd = NIOCSETF;
#ifndef lint
static char copyright[] =
-"$Id: packet.c,v 1.11 1996/08/27 09:53:14 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: packet.c,v 1.12 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
*bufix += sizeof ip;
/* Fill out the UDP header */
- udp.uh_sport = server_port; /* XXX */
+ udp.uh_sport = local_port; /* XXX */
udp.uh_dport = port; /* XXX */
udp.uh_ulen = htons(sizeof(udp) + len);
memset (&udp.uh_sum, 0, sizeof udp.uh_sum);
return -1;
/* Is it to the port we're serving? */
- if (udp -> uh_dport != server_port)
+ if (udp -> uh_dport != local_port)
return -1;
#endif /* USERLAND_FILTER */
#ifndef lint
static char copyright[] =
-"$Id: raw.c,v 1.8 1996/09/04 07:06:39 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: raw.c,v 1.9 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Set up the address we're going to connect to. */
name.sin_family = AF_INET;
- name.sin_port = server_port;
+ name.sin_port = local_port;
name.sin_addr.s_addr = htonl (INADDR_BROADCAST);
memset (name.sin_zero, 0, sizeof (name.sin_zero));
/* List addresses on which we're listening. */
note ("Sending on %s, port %d",
- piaddr (info -> address), htons (server_port));
+ piaddr (info -> address), htons (local_port));
if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
error ("Can't create dhcp socket: %m");
#ifndef lint
static char copyright[] =
-"$Id: socket.c,v 1.17 1997/01/02 12:00:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: socket.c,v 1.18 1997/02/18 14:30:13 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Set up the address we're going to bind to. */
name.sin_family = AF_INET;
- name.sin_port = server_port;
+ name.sin_port = local_port;
name.sin_addr.s_addr = INADDR_ANY;
memset (name.sin_zero, 0, sizeof (name.sin_zero));
#ifndef lint
static char ocopyright[] =
-"$Id: dhcpd.c,v 1.36 1996/09/12 09:28:13 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
+"$Id: dhcpd.c,v 1.37 1997/02/18 14:30:11 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
#endif
static char copyright[] =
struct interface_info fallback_interface;
#endif
-u_int16_t server_port;
+u_int16_t local_port;
+u_int16_t remote_port;
+
int log_priority;
#ifdef DEBUG
int log_perror = -1;
if (status < 1 || status > 65535)
error ("%s: not a valid UDP port",
argv [i]);
- server_port = htons (status);
+ local_port = htons (status);
debug ("binding to user-specified port %d",
- ntohs (server_port));
+ ntohs (local_port));
} else if (!strcmp (argv [i], "-f")) {
#ifndef DEBUG
daemon = 0;
#endif /* !DEBUG */
/* Default to the DHCP/BOOTP port. */
- if (!server_port)
+ if (!local_port)
{
ent = getservbyname ("dhcp", "udp");
if (!ent)
- server_port = htons (67);
+ local_port = htons (67);
else
- server_port = ent -> s_port;
+ local_port = ent -> s_port;
endservent ();
}
+ remote_port = htons (ntohs (local_port) + 1);
+
/* Get the current time... */
GET_TIME (&cur_time);
#ifndef lint
static char copyright[] =
-"$Id: nit.c,v 1.10 1997/01/02 12:00:17 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: nit.c,v 1.11 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_CAND;
pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHWORD + 18;
pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHLIT + ENF_CAND;
- pf.Pf_Filter [pf.Pf_FilterLen++] = server_port;
+ pf.Pf_Filter [pf.Pf_FilterLen++] = local_port;
/* Install the filter... */
sio.ic_cmd = NIOCSETF;
#ifndef lint
static char copyright[] =
-"$Id: packet.c,v 1.11 1996/08/27 09:53:14 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: packet.c,v 1.12 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
*bufix += sizeof ip;
/* Fill out the UDP header */
- udp.uh_sport = server_port; /* XXX */
+ udp.uh_sport = local_port; /* XXX */
udp.uh_dport = port; /* XXX */
udp.uh_ulen = htons(sizeof(udp) + len);
memset (&udp.uh_sum, 0, sizeof udp.uh_sum);
return -1;
/* Is it to the port we're serving? */
- if (udp -> uh_dport != server_port)
+ if (udp -> uh_dport != local_port)
return -1;
#endif /* USERLAND_FILTER */
#ifndef lint
static char copyright[] =
-"$Id: raw.c,v 1.8 1996/09/04 07:06:39 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: raw.c,v 1.9 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Set up the address we're going to connect to. */
name.sin_family = AF_INET;
- name.sin_port = server_port;
+ name.sin_port = local_port;
name.sin_addr.s_addr = htonl (INADDR_BROADCAST);
memset (name.sin_zero, 0, sizeof (name.sin_zero));
/* List addresses on which we're listening. */
note ("Sending on %s, port %d",
- piaddr (info -> address), htons (server_port));
+ piaddr (info -> address), htons (local_port));
if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
error ("Can't create dhcp socket: %m");
#ifndef lint
static char ocopyright[] =
-"$Id: dhcpd.c,v 1.36 1996/09/12 09:28:13 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
+"$Id: dhcpd.c,v 1.37 1997/02/18 14:30:11 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
#endif
static char copyright[] =
struct interface_info fallback_interface;
#endif
-u_int16_t server_port;
+u_int16_t local_port;
+u_int16_t remote_port;
+
int log_priority;
#ifdef DEBUG
int log_perror = -1;
if (status < 1 || status > 65535)
error ("%s: not a valid UDP port",
argv [i]);
- server_port = htons (status);
+ local_port = htons (status);
debug ("binding to user-specified port %d",
- ntohs (server_port));
+ ntohs (local_port));
} else if (!strcmp (argv [i], "-f")) {
#ifndef DEBUG
daemon = 0;
#endif /* !DEBUG */
/* Default to the DHCP/BOOTP port. */
- if (!server_port)
+ if (!local_port)
{
ent = getservbyname ("dhcp", "udp");
if (!ent)
- server_port = htons (67);
+ local_port = htons (67);
else
- server_port = ent -> s_port;
+ local_port = ent -> s_port;
endservent ();
}
+ remote_port = htons (ntohs (local_port) + 1);
+
/* Get the current time... */
GET_TIME (&cur_time);
#ifndef lint
static char copyright[] =
-"$Id: socket.c,v 1.17 1997/01/02 12:00:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: socket.c,v 1.18 1997/02/18 14:30:13 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Set up the address we're going to bind to. */
name.sin_family = AF_INET;
- name.sin_port = server_port;
+ name.sin_port = local_port;
name.sin_addr.s_addr = INADDR_ANY;
memset (name.sin_zero, 0, sizeof (name.sin_zero));