mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 22:35:25 +00:00
Add a -s flag to specify the broadcast destination IP address.
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char ocopyright[] =
|
static char ocopyright[] =
|
||||||
"$Id: dhcpd.c,v 1.70 1999/05/07 17:32:38 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
|
"$Id: dhcpd.c,v 1.71 1999/07/06 17:17:16 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
@@ -46,6 +46,8 @@ int server_identifier_matched;
|
|||||||
u_int16_t local_port;
|
u_int16_t local_port;
|
||||||
u_int16_t remote_port;
|
u_int16_t remote_port;
|
||||||
|
|
||||||
|
struct in_addr limited_broadcast;
|
||||||
|
|
||||||
int log_priority;
|
int log_priority;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int log_perror = -1;
|
int log_perror = -1;
|
||||||
@@ -74,6 +76,7 @@ int main (argc, argv, envp)
|
|||||||
int daemon = 1;
|
int daemon = 1;
|
||||||
#endif
|
#endif
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
|
char *server = (char *)0;
|
||||||
|
|
||||||
/* Initially, log errors to stderr as well as to syslogd. */
|
/* Initially, log errors to stderr as well as to syslogd. */
|
||||||
#ifdef SYSLOG_4_2
|
#ifdef SYSLOG_4_2
|
||||||
@@ -115,6 +118,10 @@ int main (argc, argv, envp)
|
|||||||
daemon = 0;
|
daemon = 0;
|
||||||
#endif
|
#endif
|
||||||
log_perror = -1;
|
log_perror = -1;
|
||||||
|
} else if (!strcmp (argv [i], "-s")) {
|
||||||
|
if (++i == argc)
|
||||||
|
usage ();
|
||||||
|
server = argv [i];
|
||||||
} else if (!strcmp (argv [i], "-cf")) {
|
} else if (!strcmp (argv [i], "-cf")) {
|
||||||
if (++i == argc)
|
if (++i == argc)
|
||||||
usage ();
|
usage ();
|
||||||
@@ -177,6 +184,21 @@ int main (argc, argv, envp)
|
|||||||
|
|
||||||
remote_port = htons (ntohs (local_port) + 1);
|
remote_port = htons (ntohs (local_port) + 1);
|
||||||
|
|
||||||
|
if (server) {
|
||||||
|
if (!inet_aton (server, &limited_broadcast)) {
|
||||||
|
struct hostent *he;
|
||||||
|
he = gethostbyname (server);
|
||||||
|
if (he) {
|
||||||
|
memcpy (&limited_broadcast,
|
||||||
|
he -> h_addr_list [0],
|
||||||
|
sizeof limited_broadcast);
|
||||||
|
} else
|
||||||
|
limited_broadcast.s_addr = INADDR_BROADCAST;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
limited_broadcast.s_addr = INADDR_BROADCAST;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the current time... */
|
/* Get the current time... */
|
||||||
GET_TIME (&cur_time);
|
GET_TIME (&cur_time);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user