summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2018-09-11 21:09:47 +0000
committerMikael Magnusson <mikma@users.sourceforge.net>2019-02-27 21:28:44 +0100
commite14052f9640f0e0b7eb2edf0148591d0eb214fb7 (patch)
tree02e93ca61135089f5a011d70f28896e949899e24
parent7c36eb3e8bd7d06f65dc7319d42b6abe782c5b89 (diff)
WIP ignore interfaceold/ignore-interface
-rw-r--r--sysdep/linux/netlink.c12
-rw-r--r--sysdep/unix/krt.Y2
-rw-r--r--sysdep/unix/krt.c2
-rw-r--r--sysdep/unix/krt.h3
4 files changed, 17 insertions, 2 deletions
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index d773743d..56337e01 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -860,6 +860,7 @@ nl_parse_addr4(struct ifaddrmsg *i, int scan, int new)
{
struct rtattr *a[BIRD_IFA_MAX];
struct iface *ifi;
+ struct kif_iface_config *kifi;
u32 ifa_flags;
int scope;
@@ -883,6 +884,12 @@ nl_parse_addr4(struct ifaddrmsg *i, int scan, int new)
log(L_ERR "KIF: Received address message for unknown interface %d", i->ifa_index);
return;
}
+ kifi = kif_get_iface_config(ifi);
+ if (kifi->flags & KIF_IGNORE)
+ {
+ log(L_ERR "KIF: Ignored interface %s", ifi->name);
+ return;
+ }
if (a[IFA_FLAGS])
ifa_flags = rta_get_u32(a[IFA_FLAGS]);
@@ -902,6 +909,11 @@ nl_parse_addr4(struct ifaddrmsg *i, int scan, int new)
log(L_ERR "KIF: Invalid prefix length for interface %s: %d", ifi->name, i->ifa_prefixlen);
new = 0;
}
+/* if (ipa_equal(ifa.ip, ipa_from_u32(0x0a000001)))
+ {
+ log(L_ERR "KIF: Ignore IP address %I", ifa.ip);
+ new = 0;
+ }*/
if (i->ifa_prefixlen == IP4_MAX_PREFIX_LENGTH)
{
ifa.brd = rta_get_ipa(a[IFA_ADDRESS]);
diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y
index 95b54d65..d651dd45 100644
--- a/sysdep/unix/krt.Y
+++ b/sysdep/unix/krt.Y
@@ -119,7 +119,7 @@ kif_iface_opt_list:
;
kif_iface:
- kif_iface_start iface_patt_list_nopx kif_iface_opt_list;
+ kif_iface_start iface_patt_list kif_iface_opt_list;
dynamic_attr: KRT_SOURCE { $$ = f_new_dynamic_attr(EAF_TYPE_INT, T_INT, EA_KRT_SOURCE); } ;
diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c
index ded5dfe4..da37b345 100644
--- a/sysdep/unix/krt.c
+++ b/sysdep/unix/krt.c
@@ -89,7 +89,7 @@ static struct kif_config *kif_cf;
static timer *kif_scan_timer;
static btime kif_last_shot;
-static struct kif_iface_config kif_default_iface = {};
+static struct kif_iface_config kif_default_iface = {.flags = KIF_IGNORE};
struct kif_iface_config *
kif_get_iface_config(struct iface *iface)
diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h
index 6ace2a86..18ef09d4 100644
--- a/sysdep/unix/krt.h
+++ b/sysdep/unix/krt.h
@@ -103,12 +103,15 @@ struct kif_config {
btime scan_time; /* How often we re-scan interfaces */
};
+#define KIF_IGNORE 1
+
struct kif_iface_config {
struct iface_patt i;
ip_addr pref_v4;
ip_addr pref_v6;
ip_addr pref_ll;
+ unsigned flags;
};
struct kif_proto {