summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-03-19 10:23:43 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-03-19 10:23:43 +0000
commitb860e97dd423cf165913bcec8f4e8478001e2614 (patch)
tree04b11b5bae3c3254797d9c343a8ca1850b43818b /usr.sbin
parentb67f6a9f90a9325f0d15b09bd5723878165fc9b3 (diff)
Doh! If we support "redistribute rtlabel" we should actually track the
routing labels in ripd's kroute code. Just steal the code from ospfd which does it right. OK michele@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ripd/kroute.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/usr.sbin/ripd/kroute.c b/usr.sbin/ripd/kroute.c
index e07cc9a194d..d1f71637b89 100644
--- a/usr.sbin/ripd/kroute.c
+++ b/usr.sbin/ripd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.6 2007/03/13 16:50:58 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.7 2007/03/19 10:23:42 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -178,6 +178,8 @@ kr_change(struct kroute *kroute)
action = RTM_CHANGE;
kr->r.flags = kroute->flags | F_RIPD_INSERTED;
kr->r.ifindex = 0;
+ rtlabel_unref(kr->r.rtlabel);
+ kr->r.rtlabel = 0;
}
}
@@ -454,6 +456,7 @@ kroute_remove(struct kroute_node *kr)
}
kr_redistribute(IMSG_NETWORK_DEL, &kr->r);
+ rtlabel_unref(kr->r.rtlabel);
free(kr);
return (0);
@@ -778,6 +781,7 @@ fetchtable(void)
struct rt_msghdr *rtm;
struct sockaddr *sa, *rti_info[RTAX_MAX];
struct sockaddr_in *sa_in;
+ struct sockaddr_rtlabel *label;
struct kroute_node *kr;
struct iface *iface = NULL;
@@ -880,8 +884,13 @@ fetchtable(void)
if (rtm->rtm_flags & RTF_PROTO3) {
send_rtmsg(kr_state.fd, RTM_DELETE, &kr->r);
free(kr);
- } else
+ } else {
+ if ((label = (struct sockaddr_rtlabel *)
+ rti_info[RTAX_LABEL]) != NULL)
+ kr->r.rtlabel =
+ rtlabel_name2id(label->sr_label);
kroute_insert(kr);
+ }
}
free(buf);
@@ -973,6 +982,7 @@ dispatch_rtmsg(void)
struct if_msghdr ifm;
struct sockaddr *sa, *rti_info[RTAX_MAX];
struct sockaddr_in *sa_in;
+ struct sockaddr_rtlabel *label;
struct kroute_node *kr;
struct in_addr prefix, nexthop, netmask;
int flags;
@@ -1079,6 +1089,13 @@ dispatch_rtmsg(void)
kr->r.flags = flags;
kr->r.ifindex = ifindex;
+ rtlabel_unref(kr->r.rtlabel);
+ kr->r.rtlabel = 0;
+ if ((label = (struct sockaddr_rtlabel *)
+ rti_info[RTAX_LABEL]) != NULL)
+ kr->r.rtlabel =
+ rtlabel_name2id(label->sr_label);
+
if (kif_validate(kr->r.ifindex))
kr->r.flags &= ~F_DOWN;
else
@@ -1098,6 +1115,11 @@ dispatch_rtmsg(void)
kr->r.flags = flags;
kr->r.ifindex = ifindex;
+ if ((label = (struct sockaddr_rtlabel *)
+ rti_info[RTAX_LABEL]) != NULL)
+ kr->r.rtlabel =
+ rtlabel_name2id(label->sr_label);
+
kroute_insert(kr);
}
break;