summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/bsd/krt-sock.c6
-rw-r--r--sysdep/bsd/krt-sys.h1
-rw-r--r--sysdep/bsd/sysio.h18
-rw-r--r--sysdep/linux/krt-sys.h2
-rw-r--r--sysdep/linux/netlink.c4
-rw-r--r--sysdep/linux/syspriv.h9
-rw-r--r--sysdep/unix/io.c17
-rw-r--r--sysdep/unix/krt.c4
-rw-r--r--sysdep/unix/log.c18
-rw-r--r--sysdep/unix/main.c10
10 files changed, 56 insertions, 33 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 3440ed63..d2372a3d 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -933,7 +933,7 @@ kif_do_scan(struct kif_proto *p)
/* Kernel sockets */
static int
-krt_sock_hook(sock *sk, int size UNUSED)
+krt_sock_hook(sock *sk, uint size UNUSED)
{
struct ks_msg msg;
int l = read(sk->fd, (char *)&msg, sizeof(msg));
@@ -953,7 +953,7 @@ krt_sock_err_hook(sock *sk, int e UNUSED)
}
static sock *
-krt_sock_open(pool *pool, void *data, int table_id)
+krt_sock_open(pool *pool, void *data, int table_id UNUSED)
{
sock *sk;
int fd;
@@ -1120,7 +1120,7 @@ kif_sys_shutdown(struct kif_proto *p)
struct ifa *
-kif_get_primary_ip(struct iface *i)
+kif_get_primary_ip(struct iface *i UNUSED)
{
#if 0
static int fd = -1;
diff --git a/sysdep/bsd/krt-sys.h b/sysdep/bsd/krt-sys.h
index 870cdf2c..ed667e80 100644
--- a/sysdep/bsd/krt-sys.h
+++ b/sysdep/bsd/krt-sys.h
@@ -48,4 +48,5 @@ static inline void krt_sys_postconfig(struct krt_config *x UNUSED) { }
static inline int krt_sys_get_attr(eattr *a UNUSED, byte *buf UNUSED, int buflen UNUSED) { return GA_UNKNOWN; }
+
#endif
diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h
index 57c45bcf..0c5f8fbb 100644
--- a/sysdep/bsd/sysio.h
+++ b/sysdep/bsd/sysio.h
@@ -28,6 +28,7 @@
#endif
+#undef SA_LEN
#define SA_LEN(x) (x).sa.sa_len
@@ -133,12 +134,12 @@ sk_process_cmsg4_ttl(sock *s, struct cmsghdr *cm)
s->rcv_ttl = * (byte *) CMSG_DATA(cm);
}
+#ifdef IP_SENDSRCADDR
static inline void
sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen)
{
/* Unfortunately, IP_SENDSRCADDR does not work for raw IP sockets on BSD kernels */
-#ifdef IP_SENDSRCADDR
struct cmsghdr *cm;
struct in_addr *sa;
int controllen = 0;
@@ -156,10 +157,13 @@ sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen)
*sa = ipa_to_in4(s->saddr);
msg->msg_controllen = controllen;
-#endif
}
+#else
+static inline void
+sk_prepare_cmsgs4(sock *s UNUSED, struct msghdr *msg UNUSED, void *cbuf UNUSED, size_t cbuflen UNUSED) { }
+#endif
-static void
+static void UNUSED
sk_prepare_ip_header(sock *s, void *hdr, int dlen)
{
struct ip *ip = hdr;
@@ -200,7 +204,7 @@ sk_prepare_ip_header(sock *s, void *hdr, int dlen)
#endif
int
-sk_set_md5_auth(sock *s, ip_addr local, ip_addr remote, struct iface *ifa, char *passwd, int setkey UNUSED)
+sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, struct iface *ifa UNUSED, char *passwd, int setkey UNUSED)
{
#ifdef USE_MD5SIG_SETKEY
if (setkey)
@@ -235,20 +239,20 @@ sk_set_min_ttl4(sock *s, int ttl)
}
static inline int
-sk_set_min_ttl6(sock *s, int ttl)
+sk_set_min_ttl6(sock *s, int ttl UNUSED)
{
ERR_MSG("Kernel does not support IPv6 TTL security");
}
static inline int
-sk_disable_mtu_disc4(sock *s)
+sk_disable_mtu_disc4(sock *s UNUSED)
{
/* TODO: Set IP_DONTFRAG to 0 ? */
return 0;
}
static inline int
-sk_disable_mtu_disc6(sock *s)
+sk_disable_mtu_disc6(sock *s UNUSED)
{
/* TODO: Set IPV6_DONTFRAG to 0 ? */
return 0;
diff --git a/sysdep/linux/krt-sys.h b/sysdep/linux/krt-sys.h
index 6d6586d1..76ae29b7 100644
--- a/sysdep/linux/krt-sys.h
+++ b/sysdep/linux/krt-sys.h
@@ -27,7 +27,7 @@ static inline void kif_sys_postconfig(struct kif_config *c UNUSED) { }
static inline void kif_sys_init_config(struct kif_config *c UNUSED) { }
static inline void kif_sys_copy_config(struct kif_config *d UNUSED, struct kif_config *s UNUSED) { }
-static inline struct ifa * kif_get_primary_ip(struct iface *i) { return NULL; }
+static inline struct ifa * kif_get_primary_ip(struct iface *i UNUSED) { return NULL; }
/* Kernel routes */
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 7af575a7..ee2cd125 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -503,7 +503,7 @@ nl_parse_multipath(struct krt_proto *p, struct rtattr *ra)
struct rtattr *a[BIRD_RTA_MAX];
struct rtnexthop *nh = RTA_DATA(ra);
struct mpnh *rv, *first, **last;
- int len = RTA_PAYLOAD(ra);
+ unsigned len = RTA_PAYLOAD(ra);
first = NULL;
last = &first;
@@ -1584,7 +1584,7 @@ nl_async_msg(struct nlmsghdr *h)
}
static int
-nl_async_hook(sock *sk, int size UNUSED)
+nl_async_hook(sock *sk, uint size UNUSED)
{
struct iovec iov = { nl_async_rx_buffer, NL_RX_SIZE };
struct sockaddr_nl sa;
diff --git a/sysdep/linux/syspriv.h b/sysdep/linux/syspriv.h
index d2ba95dd..8b210f06 100644
--- a/sysdep/linux/syspriv.h
+++ b/sysdep/linux/syspriv.h
@@ -1,4 +1,11 @@
+#ifndef _BIRD_SYSPRIV_H_
+#define _BIRD_SYSPRIV_H_
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <unistd.h>
#include <sys/prctl.h>
#include <linux/capability.h>
@@ -70,3 +77,5 @@ drop_uid(uid_t uid)
if (setresuid(uid, uid, uid) < 0)
die("setresuid: %m");
}
+
+#endif /* _BIRD_SYSPRIV_H_ */
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index e90964c1..6d886dab 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -9,7 +9,9 @@
/* Unfortunately, some glibc versions hide parts of RFC 3542 API
if _GNU_SOURCE is not defined. */
-#define _GNU_SOURCE 1
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
#include <stdio.h>
#include <stdlib.h>
@@ -507,11 +509,11 @@ tm_format_datetime(char *x, struct timeformat *fmt_spec, bird_clock_t t)
* Sockaddr helper functions
*/
-static inline int sockaddr_length(int af)
+static inline int UNUSED sockaddr_length(int af)
{ return (af == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); }
static inline void
-sockaddr_fill4(struct sockaddr_in *sa, ip_addr a, struct iface *ifa, uint port)
+sockaddr_fill4(struct sockaddr_in *sa, ip_addr a, uint port)
{
memset(sa, 0, sizeof(struct sockaddr_in));
#ifdef HAVE_SIN_LEN
@@ -542,7 +544,7 @@ void
sockaddr_fill(sockaddr *sa, int af, ip_addr a, struct iface *ifa, uint port)
{
if (af == AF_INET)
- sockaddr_fill4((struct sockaddr_in *) sa, a, ifa, port);
+ sockaddr_fill4((struct sockaddr_in *) sa, a, port);
else if (af == AF_INET6)
sockaddr_fill6((struct sockaddr_in6 *) sa, a, ifa, port);
else
@@ -550,7 +552,7 @@ sockaddr_fill(sockaddr *sa, int af, ip_addr a, struct iface *ifa, uint port)
}
static inline void
-sockaddr_read4(struct sockaddr_in *sa, ip_addr *a, struct iface **ifa, uint *port)
+sockaddr_read4(struct sockaddr_in *sa, ip_addr *a, uint *port)
{
*port = ntohs(sa->sin_port);
*a = ipa_from_in4(sa->sin_addr);
@@ -573,7 +575,7 @@ sockaddr_read(sockaddr *sa, int af, ip_addr *a, struct iface **ifa, uint *port)
goto fail;
if (af == AF_INET)
- sockaddr_read4((struct sockaddr_in *) sa, a, ifa, port);
+ sockaddr_read4((struct sockaddr_in *) sa, a, port);
else if (af == AF_INET6)
sockaddr_read6((struct sockaddr_in6 *) sa, a, ifa, port);
else
@@ -770,7 +772,7 @@ sk_set_tos6(sock *s, int tos)
}
static inline int
-sk_set_high_port(sock *s)
+sk_set_high_port(sock *s UNUSED)
{
/* Port range setting is optional, ignore it if not supported */
@@ -2085,6 +2087,7 @@ watchdog_stop(void)
volatile int async_config_flag; /* Asynchronous reconfiguration/dump scheduled */
volatile int async_dump_flag;
+volatile int async_shutdown_flag;
void
io_init(void)
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index d4cb964e..e899671d 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -899,7 +899,7 @@ krt_scan_timer_start(struct krt_proto *p)
}
static void
-krt_scan_timer_stop(struct krt_proto *p)
+krt_scan_timer_stop(struct krt_proto *p UNUSED)
{
krt_scan_count--;
@@ -988,7 +988,7 @@ krt_store_tmp_attrs(rte *rt, struct ea_list *attrs)
}
static int
-krt_import_control(struct proto *P, rte **new, ea_list **attrs, struct linpool *pool)
+krt_import_control(struct proto *P, rte **new, ea_list **attrs UNUSED, struct linpool *pool UNUSED)
{
struct krt_proto *p = (struct krt_proto *) P;
rte *e = *new;
diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c
index e5c5e74e..42c933ef 100644
--- a/sysdep/unix/log.c
+++ b/sysdep/unix/log.c
@@ -288,18 +288,22 @@ log_switch(int debug, list *l, char *new_syslog_name)
current_log_list = l;
#ifdef HAVE_SYSLOG
- char *old_syslog_name = current_syslog_name;
- current_syslog_name = new_syslog_name;
-
- if (old_syslog_name && new_syslog_name &&
- !strcmp(old_syslog_name, new_syslog_name))
+ if (current_syslog_name && new_syslog_name &&
+ !strcmp(current_syslog_name, new_syslog_name))
return;
- if (old_syslog_name)
+ if (current_syslog_name)
+ {
closelog();
+ xfree(current_syslog_name);
+ current_syslog_name = NULL;
+ }
if (new_syslog_name)
- openlog(new_syslog_name, LOG_CONS | LOG_NDELAY, LOG_DAEMON);
+ {
+ current_syslog_name = xstrdup(new_syslog_name);
+ openlog(current_syslog_name, LOG_CONS | LOG_NDELAY, LOG_DAEMON);
+ }
#endif
}
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 9594269d..c1b92b7e 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -8,7 +8,9 @@
#undef LOCAL_DEBUG
-#define _GNU_SOURCE 1
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
#include <stdio.h>
#include <stdlib.h>
@@ -73,7 +75,7 @@ async_dump(void)
#else
static inline void
-drop_uid(uid_t uid)
+drop_uid(uid_t uid UNUSED)
{
die("Cannot change user on this platform");
}
@@ -419,7 +421,7 @@ cli_get_command(cli *c)
}
static int
-cli_rx(sock *s, int size UNUSED)
+cli_rx(sock *s, uint size UNUSED)
{
cli_kick(s->data);
return 0;
@@ -439,7 +441,7 @@ cli_err(sock *s, int err)
}
static int
-cli_connect(sock *s, int size UNUSED)
+cli_connect(sock *s, uint size UNUSED)
{
cli *c;