| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: conf.c,v 1.17 2015/01/27 20:16:11 christos Exp $ */ | | 1 | /* $NetBSD: conf.c,v 1.18 2015/01/28 00:42:15 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2015 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2015 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Christos Zoulas. | | 8 | * by Christos Zoulas. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -23,27 +23,27 @@ | | | @@ -23,27 +23,27 @@ |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | #ifdef HAVE_CONFIG_H | | 31 | #ifdef HAVE_CONFIG_H |
32 | #include "config.h" | | 32 | #include "config.h" |
33 | #endif | | 33 | #endif |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | __RCSID("$NetBSD: conf.c,v 1.17 2015/01/27 20:16:11 christos Exp $"); | | 36 | __RCSID("$NetBSD: conf.c,v 1.18 2015/01/28 00:42:15 christos Exp $"); |
37 | | | 37 | |
38 | #include <stdio.h> | | 38 | #include <stdio.h> |
39 | #include <string.h> | | 39 | #include <string.h> |
40 | #include <ctype.h> | | 40 | #include <ctype.h> |
41 | #include <inttypes.h> | | 41 | #include <inttypes.h> |
42 | #include <netdb.h> | | 42 | #include <netdb.h> |
43 | #include <pwd.h> | | 43 | #include <pwd.h> |
44 | #include <syslog.h> | | 44 | #include <syslog.h> |
45 | #include <errno.h> | | 45 | #include <errno.h> |
46 | #ifdef HAVE_UTIL_H | | 46 | #ifdef HAVE_UTIL_H |
47 | #include <util.h> | | 47 | #include <util.h> |
48 | #endif | | 48 | #endif |
49 | #include <stdlib.h> | | 49 | #include <stdlib.h> |
| @@ -598,27 +598,27 @@ conf_addr_set(struct conf *c, const stru | | | @@ -598,27 +598,27 @@ conf_addr_set(struct conf *c, const stru |
598 | break; | | 598 | break; |
599 | case AF_INET6: | | 599 | case AF_INET6: |
600 | sin6 = (void *)&c->c_ss; | | 600 | sin6 = (void *)&c->c_ss; |
601 | port = &sin6->sin6_port; | | 601 | port = &sin6->sin6_port; |
602 | addr = &sin6->sin6_addr; | | 602 | addr = &sin6->sin6_addr; |
603 | alen = sizeof(sin6->sin6_addr); | | 603 | alen = sizeof(sin6->sin6_addr); |
604 | break; | | 604 | break; |
605 | default: | | 605 | default: |
606 | (*lfun)(LOG_CRIT, "%s: Internal error: bad family %u", | | 606 | (*lfun)(LOG_CRIT, "%s: Internal error: bad family %u", |
607 | __func__, c->c_ss.ss_family); | | 607 | __func__, c->c_ss.ss_family); |
608 | abort(); | | 608 | abort(); |
609 | } | | 609 | } |
610 | | | 610 | |
611 | *port = htons(c->c_port); | | 611 | *port = htons((in_port_t)c->c_port); |
612 | conf_apply_mask(addr, alen, c->c_lmask); | | 612 | conf_apply_mask(addr, alen, c->c_lmask); |
613 | if (c->c_lmask == -1) | | 613 | if (c->c_lmask == -1) |
614 | c->c_lmask = (int)(alen * 8); | | 614 | c->c_lmask = (int)(alen * 8); |
615 | if (debug) { | | 615 | if (debug) { |
616 | char buf[128]; | | 616 | char buf[128]; |
617 | sockaddr_snprintf(buf, sizeof(buf), "%a:%p", (void *)&c->c_ss); | | 617 | sockaddr_snprintf(buf, sizeof(buf), "%a:%p", (void *)&c->c_ss); |
618 | (*lfun)(LOG_DEBUG, "Applied address %s", buf); | | 618 | (*lfun)(LOG_DEBUG, "Applied address %s", buf); |
619 | } | | 619 | } |
620 | } | | 620 | } |
621 | | | 621 | |
622 | /* | | 622 | /* |
623 | * Compared two addresses for equality applying the mask | | 623 | * Compared two addresses for equality applying the mask |
624 | */ | | 624 | */ |