summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-11-25 18:42:47 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2013-11-25 18:42:47 +0100
commit283c7dfada53a6dee6a8a17ecab492ffafd44b66 (patch)
tree5edfb9df61c3b625967f3c65317f27c5051a8a4d /sysdep
parent736e143fa50607fcd88132291e96089b899af979 (diff)
parent0bb4e37db317a1290bad24fe430cac6569a9bd8c (diff)
Merge branch 'master' into add-path
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/bsd/krt-sock.c33
-rw-r--r--sysdep/config.h2
-rw-r--r--sysdep/linux/krt-sys.h2
-rw-r--r--sysdep/linux/netlink.c13
-rw-r--r--sysdep/unix/config.Y4
-rw-r--r--sysdep/unix/krt.c3
-rw-r--r--sysdep/unix/krt.h1
7 files changed, 43 insertions, 15 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 69a476d9..176e11ed 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -1058,3 +1058,36 @@ kif_sys_shutdown(struct kif_proto *p)
krt_buffer_release(&p->p);
}
+
+struct ifa *
+kif_get_primary_ip(struct iface *i)
+{
+#ifndef IPV6
+ static int fd = -1;
+
+ if (fd < 0)
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+
+ struct ifreq ifr;
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, i->name, IFNAMSIZ);
+
+ int rv = ioctl(fd, SIOCGIFADDR, (char *) &ifr);
+ if (rv < 0)
+ return NULL;
+
+ ip_addr addr;
+ struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
+ memcpy(&addr, &sin->sin_addr.s_addr, sizeof(ip_addr));
+ ipa_ntoh(addr);
+
+ struct ifa *a;
+ WALK_LIST(a, i->addrs)
+ {
+ if (ipa_equal(a->ip, addr))
+ return a;
+ }
+#endif
+
+ return NULL;
+}
diff --git a/sysdep/config.h b/sysdep/config.h
index 914c1090..eb5606ac 100644
--- a/sysdep/config.h
+++ b/sysdep/config.h
@@ -7,7 +7,7 @@
#define _BIRD_CONFIG_H_
/* BIRD version */
-#define BIRD_VERSION "1.3.12"
+#define BIRD_VERSION "1.4.0"
/* Include parameters determined by configure script */
#include "sysdep/autoconf.h"
diff --git a/sysdep/linux/krt-sys.h b/sysdep/linux/krt-sys.h
index 7b3043a7..7e97968a 100644
--- a/sysdep/linux/krt-sys.h
+++ b/sysdep/linux/krt-sys.h
@@ -27,6 +27,8 @@ 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; }
+
/* Kernel routes */
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index 90443ed6..ed8769b7 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -862,19 +862,6 @@ nl_parse_route(struct nlmsghdr *h, int scan)
else
{
ra.dest = RTD_DEVICE;
-
- /*
- * In Linux IPv6, 'native' device routes have proto
- * RTPROT_BOOT and not RTPROT_KERNEL (which they have in
- * IPv4 and which is expected). We cannot distinguish
- * 'native' and user defined device routes, so we ignore all
- * such device routes and for consistency, we have the same
- * behavior in IPv4. Anyway, users should use RTPROT_STATIC
- * for their 'alien' routes.
- */
-
- if (i->rtm_protocol == RTPROT_BOOT)
- src = KRT_SRC_KERNEL;
}
break;
diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y
index 7bade918..1bba9a0d 100644
--- a/sysdep/unix/config.Y
+++ b/sysdep/unix/config.Y
@@ -14,7 +14,7 @@ CF_HDR
CF_DECLS
CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG, STDERR, SOFT)
-CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, BASE, NAME, CONFIRM, UNDO, CHECK, TIMEOUT)
+CF_KEYWORDS(TIMEFORMAT, ISO, OLD, SHORT, LONG, BASE, NAME, CONFIRM, UNDO, CHECK, TIMEOUT)
%type <i> log_mask log_mask_list log_cat cfg_timeout
%type <g> log_file
@@ -96,6 +96,8 @@ timeformat_spec:
| timeformat_which TEXT expr TEXT { *$1 = (struct timeformat){$2, $4, $3}; }
| timeformat_which ISO SHORT { *$1 = (struct timeformat){"%T", "%F", 20*3600}; }
| timeformat_which ISO LONG { *$1 = (struct timeformat){"%F %T", NULL, 0}; }
+ | timeformat_which OLD SHORT { *$1 = (struct timeformat){NULL, NULL, 0}; }
+ | timeformat_which OLD LONG { *$1 = (struct timeformat){"%d-%m-%Y %T", NULL, 0}; }
;
timeformat_base:
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index 3f9e1479..6fdef619 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -159,6 +159,9 @@ kif_choose_primary(struct iface *i)
return a;
}
+ if (a = kif_get_primary_ip(i))
+ return a;
+
return find_preferred_ifa(i, IPA_NONE, IPA_NONE);
}
diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h
index 446914d2..99983ccd 100644
--- a/sysdep/unix/krt.h
+++ b/sysdep/unix/krt.h
@@ -142,5 +142,6 @@ void kif_sys_copy_config(struct kif_config *, struct kif_config *);
void kif_do_scan(struct kif_proto *);
+struct ifa *kif_get_primary_ip(struct iface *i);
#endif