From 71ca77169d5d3e67459e46841b8bdb95accd8c2a Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 13 Apr 2011 12:32:27 +0200 Subject: Adds support for several Linux kernel route attributes. --- sysdep/unix/krt.c | 21 +++++++++++++++++++++ sysdep/unix/krt.h | 4 ++++ 2 files changed, 25 insertions(+) (limited to 'sysdep/unix') diff --git a/sysdep/unix/krt.c b/sysdep/unix/krt.c index 562dc71..7057070 100644 --- a/sysdep/unix/krt.c +++ b/sysdep/unix/krt.c @@ -890,6 +890,7 @@ krt_init(struct proto_config *c) p->p.accept_ra_types = RA_OPTIMAL; p->p.import_control = krt_import_control; p->p.rt_notify = krt_notify; + return &p->p; } @@ -907,15 +908,35 @@ krt_reconfigure(struct proto *p, struct proto_config *new) ; } + +static int +krt_get_attr(eattr * a, byte * buf, int buflen UNUSED) +{ + switch (a->id) + { + case EA_KRT_PREFSRC: + bsprintf(buf, "prefsrc"); + return GA_NAME; + case EA_KRT_REALM: + bsprintf(buf, "realm"); + return GA_NAME; + default: + return GA_UNKNOWN; + } +} + + struct protocol proto_unix_kernel = { name: "Kernel", template: "kernel%d", + attr_class: EAP_KRT, preconfig: krt_preconfig, postconfig: krt_postconfig, init: krt_init, start: krt_start, shutdown: krt_shutdown, reconfigure: krt_reconfigure, + get_attr: krt_get_attr, #ifdef KRT_ALLOW_LEARN dump: krt_dump, dump_attrs: krt_dump_attrs, diff --git a/sysdep/unix/krt.h b/sysdep/unix/krt.h index ed61621..c88bc48 100644 --- a/sysdep/unix/krt.h +++ b/sysdep/unix/krt.h @@ -30,6 +30,10 @@ struct kif_proto; #define KRF_INSTALLED 0x80 /* This route should be installed in the kernel */ + +#define EA_KRT_PREFSRC EA_CODE(EAP_KRT, 0) +#define EA_KRT_REALM EA_CODE(EAP_KRT, 1) + /* Whenever we recognize our own routes, we allow learing of foreign routes */ #ifdef CONFIG_SELF_CONSCIOUS -- cgit v1.2.3