diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-07 15:20:29 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-07 15:20:29 +0000 |
commit | b896d1fc8a7706642e35f3bc2da1e0a160e0b8bb (patch) | |
tree | 8c5d0e393ab28aa99de0c2e18fd34db574ef428f /sbin/dhclient | |
parent | d15ed604529cf1119e0af27fcef0e6aec3485145 (diff) |
Use memset() consistently rather than tossing in a few bzero()'s.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/conflex.c | 8 | ||||
-rw-r--r-- | sbin/dhclient/dhclient.c | 6 | ||||
-rw-r--r-- | sbin/dhclient/dispatch.c | 4 | ||||
-rw-r--r-- | sbin/dhclient/kroute.c | 36 | ||||
-rw-r--r-- | sbin/dhclient/options.c | 4 |
5 files changed, 29 insertions, 29 deletions
diff --git a/sbin/dhclient/conflex.c b/sbin/dhclient/conflex.c index 2aead95e75c..9c39cb17fa7 100644 --- a/sbin/dhclient/conflex.c +++ b/sbin/dhclient/conflex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conflex.c,v 1.16 2012/10/30 18:39:44 krw Exp $ */ +/* $OpenBSD: conflex.c,v 1.17 2012/11/07 15:20:28 krw Exp $ */ /* Lexical scanner for dhclient config file... */ @@ -79,9 +79,9 @@ new_parse(char *name) * new file, 'name'. */ - bzero(line1, sizeof(line1)); - bzero(line2, sizeof(line2)); - bzero(tokbuf, sizeof(tokbuf)); + memset(line1, 0, sizeof(line1)); + memset(line2, 0, sizeof(line2)); + memset(tokbuf, 0, sizeof(tokbuf)); lpos = line = 1; tlpos = tline = token = ugflag = 0; diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 02e0009931e..5aa7e408e04 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.167 2012/11/07 15:07:02 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.168 2012/11/07 15:20:28 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -670,7 +670,7 @@ bind_lease(void) mask = (in_addr_t *)options[DHO_SUBNET_MASK].data; add_new_address(ifi->name, ifi->rdomain, client->new->address, mask); if (options[DHO_ROUTERS].len) { - bzero(&gateway, sizeof(gateway)); + memset(&gateway, 0, sizeof(gateway)); /* XXX Only use FIRST router address for now. */ gateway.len = sizeof(in_addr_t); memcpy(gateway.iabuf, options[DHO_ROUTERS].data, @@ -1747,7 +1747,7 @@ get_ifname(char *ifname, char *arg) s = socket(AF_INET, SOCK_DGRAM, 0); if (s == -1) error("socket error"); - bzero(&ifgr, sizeof(ifgr)); + memset(&ifgr, 0, sizeof(ifgr)); strlcpy(ifgr.ifgr_name, "egress", sizeof(ifgr.ifgr_name)); if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) { if (errno == ENOENT) diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index ade73ed8930..c3d49ea5637 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.63 2012/11/07 15:07:02 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.64 2012/11/07 15:20:28 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -335,7 +335,7 @@ get_rdomain(char *name) if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) error("get_rdomain socket: %m"); - bzero(&ifr, sizeof(ifr)); + memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFRDOMAIN, (caddr_t)&ifr) != -1) rv = ifr.ifr_rdomainid; diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c index e8acad60fcb..32916aac5d7 100644 --- a/sbin/dhclient/kroute.c +++ b/sbin/dhclient/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.10 2012/11/07 15:07:02 krw Exp $ */ +/* $OpenBSD: kroute.c,v 1.11 2012/11/07 15:20:28 krw Exp $ */ /* * Copyright 2012 Kenneth R Westerback <krw@openbsd.org> @@ -114,7 +114,7 @@ priv_flush_routes_and_arp_cache(int rdomain) if (sa->sa_family == AF_KEY) continue; /* Don't flush SPD */ - bzero(rti_info, sizeof(rti_info)); + memset(rti_info, 0, sizeof(rti_info)); for (i = 0; i < RTAX_MAX; i++) { if (rtm->rtm_addrs & (1 << i)) { rti_info[i] = sa; @@ -239,7 +239,7 @@ priv_add_default_route(int rdomain, struct iaddr addr, /* Build RTM header */ - bzero(&rtm, sizeof(rtm)); + memset(&rtm, 0, sizeof(rtm)); rtm.rtm_version = RTM_VERSION; rtm.rtm_type = RTM_ADD; @@ -252,7 +252,7 @@ priv_add_default_route(int rdomain, struct iaddr addr, /* Set destination address of all zeros. */ - bzero(&dest, sizeof(dest)); + memset(&dest, 0, sizeof(dest)); dest.sin_len = sizeof(dest); dest.sin_family = AF_INET; @@ -268,7 +268,7 @@ priv_add_default_route(int rdomain, struct iaddr addr, * gateway address of 0 implies '-iface'. */ - bzero(&gateway, sizeof(gateway)); + memset(&gateway, 0, sizeof(gateway)); if (bcmp(&router, &addr, sizeof(addr)) != 0) { gateway.sin_len = sizeof(gateway); gateway.sin_family = AF_INET; @@ -283,7 +283,7 @@ priv_add_default_route(int rdomain, struct iaddr addr, } /* Add netmask of 0. */ - bzero(&mask, sizeof(mask)); + memset(&mask, 0, sizeof(mask)); mask.sin_len = sizeof(mask); mask.sin_family = AF_INET; @@ -295,7 +295,7 @@ priv_add_default_route(int rdomain, struct iaddr addr, iov[iovcnt++].iov_len = sizeof(mask); /* Add our label so we can identify the route as our creation. */ - bzero(&label, sizeof(label)); + memset(&label, 0, sizeof(label)); label.sr_len = sizeof(label); label.sr_family = AF_UNSPEC; len = snprintf(label.sr_label, sizeof(label.sr_label), "DHCLIENT %d", @@ -347,7 +347,7 @@ delete_old_addresses(char *ifname, int rdomain) (strcmp(ifi->name, ifa->ifa_name))) continue; - bzero(&addr, sizeof(addr)); + memset(&addr, 0, sizeof(addr)); addr.len = sizeof(struct in_addr); memcpy(addr.iabuf, &((struct sockaddr_in *)ifa->ifa_addr)->sin_addr, addr.len); @@ -416,7 +416,7 @@ priv_delete_old_address(char *ifname, int rdomain, struct iaddr addr) if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) error("socket open failed: %m"); - bzero(&ifaliasreq, sizeof(ifaliasreq)); + memset(&ifaliasreq, 0, sizeof(ifaliasreq)); strncpy(ifaliasreq.ifra_name, ifname, sizeof(ifaliasreq.ifra_name)); in = (struct sockaddr_in *)&ifaliasreq.ifra_addr; @@ -444,7 +444,7 @@ priv_delete_old_address(char *ifname, int rdomain, struct iaddr addr) /* Build RTM header */ - bzero(&rtm, sizeof(rtm)); + memset(&rtm, 0, sizeof(rtm)); rtm.rtm_version = RTM_VERSION; rtm.rtm_type = RTM_DELETE; @@ -457,7 +457,7 @@ priv_delete_old_address(char *ifname, int rdomain, struct iaddr addr) /* Set destination address */ - bzero(&dest, sizeof(dest)); + memset(&dest, 0, sizeof(dest)); dest.sin_len = sizeof(dest); dest.sin_family = AF_INET; @@ -471,7 +471,7 @@ priv_delete_old_address(char *ifname, int rdomain, struct iaddr addr) /* Set gateway address */ - bzero(&gateway, sizeof(gateway)); + memset(&gateway, 0, sizeof(gateway)); gateway.sin_len = sizeof(gateway); gateway.sin_family = AF_INET; @@ -532,7 +532,7 @@ add_new_address(char *ifname, int rdomain, struct iaddr addr, in_addr_t *mask) if (mask) buf_add(buf, mask, len); else { - bzero(&nomask, sizeof(nomask)); + memset(&nomask, 0, sizeof(nomask)); buf_add(buf, &nomask, len); } @@ -559,7 +559,7 @@ priv_add_new_address(char *ifname, int rdomain, struct iaddr addr, if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) error("socket open failed: %m"); - bzero(&ifaliasreq, sizeof(ifaliasreq)); + memset(&ifaliasreq, 0, sizeof(ifaliasreq)); strncpy(ifaliasreq.ifra_name, ifname, sizeof(ifaliasreq.ifra_name)); /* The actual address in ifra_addr. */ @@ -591,7 +591,7 @@ priv_add_new_address(char *ifname, int rdomain, struct iaddr addr, /* Build RTM header */ - bzero(&rtm, sizeof(rtm)); + memset(&rtm, 0, sizeof(rtm)); rtm.rtm_version = RTM_VERSION; rtm.rtm_type = RTM_ADD; @@ -604,7 +604,7 @@ priv_add_new_address(char *ifname, int rdomain, struct iaddr addr, /* Set destination address */ - bzero(&dest, sizeof(dest)); + memset(&dest, 0, sizeof(dest)); dest.sin_len = sizeof(dest); dest.sin_family = AF_INET; @@ -618,7 +618,7 @@ priv_add_new_address(char *ifname, int rdomain, struct iaddr addr, /* Set gateway address */ - bzero(&gateway, sizeof(gateway)); + memset(&gateway, 0, sizeof(gateway)); gateway.sin_len = sizeof(gateway); gateway.sin_family = AF_INET; @@ -632,7 +632,7 @@ priv_add_new_address(char *ifname, int rdomain, struct iaddr addr, iov[iovcnt++].iov_len = sizeof(gateway); /* Add our label so we can identify the route as our creation. */ - bzero(&label, sizeof(label)); + memset(&label, 0, sizeof(label)); label.sr_len = sizeof(label); label.sr_family = AF_UNSPEC; diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c index 0d635a51486..caf51105d29 100644 --- a/sbin/dhclient/options.c +++ b/sbin/dhclient/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.42 2012/10/27 23:08:53 krw Exp $ */ +/* $OpenBSD: options.c,v 1.43 2012/11/07 15:20:28 krw Exp $ */ /* DHCP options parsing and reassembly. */ @@ -152,7 +152,7 @@ cons_options(struct option_data *options) int buflen = 576 - DHCP_FIXED_LEN; int ix, incr, length, bufix, code, lastopt = -1; - bzero(buf, buflen); + memset(buf, 0, buflen); memcpy(buf, DHCP_OPTIONS_COOKIE, 4); if (options[DHO_DHCP_MESSAGE_TYPE].data) { |