diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2017-01-21 11:32:05 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2017-01-21 11:32:05 +0000 |
commit | b025a593a7f3a0fe505e8ec32929bdc4fe2cb492 (patch) | |
tree | c2851b59914141ec276fa5f41f40364392ace7b5 /usr.sbin/mrouted | |
parent | 4459c5ac6936d9fae7cf90f9f546e056dcc7e590 (diff) |
The POSIX APIs that that sockaddrs all ignore the s*_len field in the
incoming socket, so userspace doesn't need to set it unless it has its
own reasons for tracking the size along with the sockaddr.
ok phessler@ deraadt@ florian@
Diffstat (limited to 'usr.sbin/mrouted')
-rw-r--r-- | usr.sbin/mrouted/rsrr.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/usr.sbin/mrouted/rsrr.c b/usr.sbin/mrouted/rsrr.c index b038a851003..4bf8183ff8a 100644 --- a/usr.sbin/mrouted/rsrr.c +++ b/usr.sbin/mrouted/rsrr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsrr.c,v 1.14 2015/08/21 02:07:32 deraadt Exp $ */ +/* $OpenBSD: rsrr.c,v 1.15 2017/01/21 11:32:04 guenther Exp $ */ /* $NetBSD: rsrr.c,v 1.3 1995/12/10 10:07:14 mycroft Exp $ */ /* @@ -83,7 +83,6 @@ static void rsrr_cache(struct gtable *gt, struct rsrr_rq *route_query); void rsrr_init(void) { - int servlen; struct sockaddr_un serv_addr; if ((rsrr_socket = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) @@ -93,11 +92,8 @@ rsrr_init(void) bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sun_family = AF_UNIX; strlcpy(serv_addr.sun_path, RSRR_SERV_PATH, sizeof serv_addr.sun_path); - servlen = offsetof(struct sockaddr_un, sun_path) + - strlen(serv_addr.sun_path); - serv_addr.sun_len = servlen; - if (bind(rsrr_socket, (struct sockaddr *) &serv_addr, servlen) < 0) + if (bind(rsrr_socket, (struct sockaddr *)&serv_addr, sizeof serv_addr) < 0) logit(LOG_ERR, errno, "Can't bind RSRR socket"); if (register_input_handler(rsrr_socket,rsrr_read) < 0) |