diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2012-03-23 00:26:26 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2012-03-23 00:26:26 +0100 |
commit | 72aed1a00ba9e18116d6fd907f7e1a36d0a0a583 (patch) | |
tree | c753fb8b35af591812c5d64eeccdb6f9c9ff0c30 /sysdep/bsd | |
parent | 89647357af0d8507652f257f1e8f5679fe9a7078 (diff) |
Adds krt_source route attribute.
Thanks Jeremie Dimino for the original patch.
Diffstat (limited to 'sysdep/bsd')
-rw-r--r-- | sysdep/bsd/krt-sock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c index 4ee5495f..eb92d908 100644 --- a/sysdep/bsd/krt-sock.c +++ b/sysdep/bsd/krt-sock.c @@ -255,10 +255,11 @@ krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) ip_addr idst, igate, imask; void *body = (char *)msg->buf; int new = (msg->rtm.rtm_type == RTM_ADD); - int src; char *errmsg = "KRT: Invalid route received"; int flags = msg->rtm.rtm_flags; int addrs = msg->rtm.rtm_addrs; + int src; + byte src2; if (!(flags & RTF_UP) && scan) SKIP("not up in scan\n"); @@ -302,12 +303,17 @@ krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) u32 self_mask = RTF_PROTO1; u32 alien_mask = RTF_STATIC | RTF_PROTO1 | RTF_GATEWAY; + src2 = (flags & RTF_STATIC) ? 1 : 0; + src2 |= (flags & RTF_PROTO1) ? 2 : 0; + #ifdef RTF_PROTO2 alien_mask |= RTF_PROTO2; + src2 |= (flags & RTF_PROTO2) ? 4 : 0; #endif #ifdef RTF_PROTO3 alien_mask |= RTF_PROTO3; + src2 |= (flags & RTF_PROTO3) ? 8 : 0; #endif #ifdef RTF_REJECT @@ -397,9 +403,9 @@ krt_read_rt(struct ks_msg *msg, struct krt_proto *p, int scan) e = rte_get_temp(&a); e->net = net; e->u.krt.src = src; + e->u.krt.proto = src2; /* These are probably too Linux-specific */ - e->u.krt.proto = 0; e->u.krt.type = 0; e->u.krt.metric = 0; |