diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-10 00:39:47 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-10 00:39:47 +0000 |
commit | 8c913293005db33c671612618dda7a754cf05ff8 (patch) | |
tree | deeda1e0603c4c93cc2a63682ac6e20cfb2f5572 /usr.sbin/dhcp | |
parent | f7d6d89cb8589b3578ec61958687a446570db823 (diff) |
more sockaddr initializations.
Diffstat (limited to 'usr.sbin/dhcp')
-rw-r--r-- | usr.sbin/dhcp/common/socket.c | 1 | ||||
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient.c | 2 | ||||
-rw-r--r-- | usr.sbin/dhcp/relay/dhcrelay.c | 2 | ||||
-rw-r--r-- | usr.sbin/dhcp/server/bootp.c | 2 | ||||
-rw-r--r-- | usr.sbin/dhcp/server/dhcp.c | 5 | ||||
-rw-r--r-- | usr.sbin/dhcp/statmsg/main.c | 3 | ||||
-rw-r--r-- | usr.sbin/dhcp/sysconfd/sysconfd.c | 3 |
7 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/dhcp/common/socket.c b/usr.sbin/dhcp/common/socket.c index 01bb5dd1737..711b22dc833 100644 --- a/usr.sbin/dhcp/common/socket.c +++ b/usr.sbin/dhcp/common/socket.c @@ -55,7 +55,6 @@ int if_register_socket (info) name.sin_family = AF_INET; name.sin_port = local_port; name.sin_addr.s_addr = INADDR_ANY; - memset (name.sin_zero, 0, sizeof (name.sin_zero)); /* Make a socket... */ if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) diff --git a/usr.sbin/dhcp/dhclient/dhclient.c b/usr.sbin/dhcp/dhclient/dhclient.c index 5f3492a5c2c..ac013d02fc8 100644 --- a/usr.sbin/dhcp/dhclient/dhclient.c +++ b/usr.sbin/dhcp/dhclient/dhclient.c @@ -207,6 +207,7 @@ int main (argc, argv, envp) /* Get the current time... */ GET_TIME(&cur_time); + memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); sockaddr_broadcast.sin_family = AF_INET; sockaddr_broadcast.sin_port = remote_port; sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; @@ -1329,6 +1330,7 @@ void send_request (ipp) /* If the lease T2 time has elapsed, or if we're not yet bound, broadcast the DHCPREQUEST rather than unicasting. */ + memset(&destination, 0, sizeof(destination)); if (ip->client->state == S_REQUESTING || ip->client->state == S_REBOOTING || cur_time > ip->client->active->rebind) diff --git a/usr.sbin/dhcp/relay/dhcrelay.c b/usr.sbin/dhcp/relay/dhcrelay.c index 6fc4f5011f4..50390ee78cf 100644 --- a/usr.sbin/dhcp/relay/dhcrelay.c +++ b/usr.sbin/dhcp/relay/dhcrelay.c @@ -186,6 +186,7 @@ int main (argc, argv, envp) /* Set up the server sockaddrs. */ for (sp = servers; sp; sp = sp -> next) { + memset(&sp->to, 0, sizeof(sp->to)); sp -> to.sin_port = local_port; sp -> to.sin_family = AF_INET; sp -> to.sin_len = sizeof sp -> to; @@ -262,6 +263,7 @@ void relay (ip, packet, length, from_port, from, hfrom) /* If it's a bootreply, forward it to the client. */ if (packet -> op == BOOTREPLY) { + memset(&to, 0, sizeof(to)); if (!(packet -> flags & htons (BOOTP_BROADCAST)) && can_unicast_without_arp ()) { to.sin_addr = packet -> yiaddr; diff --git a/usr.sbin/dhcp/server/bootp.c b/usr.sbin/dhcp/server/bootp.c index a5e636b7c2c..154228edc64 100644 --- a/usr.sbin/dhcp/server/bootp.c +++ b/usr.sbin/dhcp/server/bootp.c @@ -329,11 +329,11 @@ void bootp (packet) : packet -> interface -> name); /* Set up the parts of the address that are in common. */ + memset (&to, 0, sizeof to); to.sin_family = AF_INET; #ifdef HAVE_SA_LEN to.sin_len = sizeof to; #endif - memset (to.sin_zero, 0, sizeof to.sin_zero); /* If this was gatewayed, send it back to the gateway... */ if (raw.giaddr.s_addr) { diff --git a/usr.sbin/dhcp/server/dhcp.c b/usr.sbin/dhcp/server/dhcp.c index 5e36623fe4b..dd87756df9a 100644 --- a/usr.sbin/dhcp/server/dhcp.c +++ b/usr.sbin/dhcp/server/dhcp.c @@ -579,11 +579,10 @@ void nak_lease (packet, cip) memcpy (hto.haddr, packet -> raw -> chaddr, hto.hlen); /* Set up the common stuff... */ + memset (&to, 0, sizeof to); to.sin_family = AF_INET; to.sin_len = sizeof to; - memset (to.sin_zero, 0, sizeof to.sin_zero); - from = packet -> interface -> primary_address; /* Make sure that the packet is at least as big as a BOOTP packet. */ @@ -1289,11 +1288,11 @@ void dhcp_reply (lease) hto.hlen = lease -> hardware_addr.hlen; memcpy (hto.haddr, lease -> hardware_addr.haddr, hto.hlen); + memset (&to, 0, sizeof to); to.sin_family = AF_INET; #ifdef HAVE_SA_LEN to.sin_len = sizeof to; #endif - memset (to.sin_zero, 0, sizeof to.sin_zero); #ifdef DEBUG_PACKET dump_raw ((unsigned char *)&raw, packet_length); diff --git a/usr.sbin/dhcp/statmsg/main.c b/usr.sbin/dhcp/statmsg/main.c index 0c267a0d9c5..9cbe88e2aed 100644 --- a/usr.sbin/dhcp/statmsg/main.c +++ b/usr.sbin/dhcp/statmsg/main.c @@ -44,7 +44,7 @@ #ifndef lint static char copyright[] = -"$Id: main.c,v 1.1 1998/08/18 03:43:36 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: main.c,v 1.2 2002/06/10 00:39:46 itojun Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -88,6 +88,7 @@ int main (argc, argv, envp) error ("unable to create sysconf socket: %m"); /* XXX for now... */ + memset(&name, 0, sizeof(name)); name.sun_family = PF_UNIX; strcpy (name.sun_path, "/var/run/sysconf"); name.sun_len = ((sizeof name) - (sizeof name.sun_path) + diff --git a/usr.sbin/dhcp/sysconfd/sysconfd.c b/usr.sbin/dhcp/sysconfd/sysconfd.c index 2529ccd2abd..8fc2c1c8329 100644 --- a/usr.sbin/dhcp/sysconfd/sysconfd.c +++ b/usr.sbin/dhcp/sysconfd/sysconfd.c @@ -44,7 +44,7 @@ #ifndef lint static char copyright[] = -"$Id: sysconfd.c,v 1.1 1998/08/18 03:43:36 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: sysconfd.c,v 1.2 2002/06/10 00:39:46 itojun Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -93,6 +93,7 @@ int main (argc, argv, envp) error ("unable to create sysconf socket: %m"); /* XXX for now... */ + memset(&name, 0, sizeof(name)); name.sun_family = PF_UNIX; strcpy (name.sun_path, "/var/run/sysconf"); name.sun_len = ((sizeof name) - (sizeof name.sun_path) + |