From noreply at github.com Tue Dec 11 11:21:12 2012 From: noreply at github.com (GitHub) Date: Tue, 11 Dec 2012 11:21:12 -0800 Subject: [Xorp-hackers] [greearb/xorp.ct] 48a359: fea: Reduce log spammage. Message-ID: <50c787a8e91eb_70e4132bae45197c@sh3.rs.github.com.mail> Branch: refs/heads/master Home: https://github.com/greearb/xorp.ct Commit: 48a35968146989ef3cb4ad81ec695773d961a28b https://github.com/greearb/xorp.ct/commit/48a35968146989ef3cb4ad81ec695773d961a28b Author: Ben Greear Date: 2012-12-11 (Tue, 11 Dec 2012) Changed paths: M xorp/fea/data_plane/control_socket/netlink_socket_utilities.cc Log Message: ----------- fea: Reduce log spammage. From mackay.jm at gmail.com Fri Dec 14 06:52:44 2012 From: mackay.jm at gmail.com (Jean Michel MacKay) Date: Fri, 14 Dec 2012 09:52:44 -0500 Subject: [Xorp-hackers] Changing the admin distance through the config file Message-ID: Hey everybody, I'm currently working on allowing admin distances to be changed through the config file. I've mapped the token 'distance', currently only in RIP and OSPF, to the RIB's set_protocol_admin_distance. Now the origin table is already created once set_protocol_admin_distance is called, so it fails. I assume that it fails because you shouldn't change the AD once the origin table exists, since it would comprise all the merge tables using that origin table. Is this the case? How I got around this was to implement change_admin_distance in the class OriginTable and only allow the AD to be changed if there are no routes in the OriginTable. Since that should keep the integrity of the merge tables. Does this sound right? I'm worried that I'm missing something about the design and this is not a proper solution. I'll clean up the code and send a patch if you want it. Cheers, JM -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-hackers/attachments/20121214/3cd3a096/attachment.html From greearb at candelatech.com Fri Dec 14 09:25:50 2012 From: greearb at candelatech.com (Ben Greear) Date: Fri, 14 Dec 2012 09:25:50 -0800 Subject: [Xorp-hackers] Changing the admin distance through the config file In-Reply-To: References: Message-ID: <50CB611E.7010905@candelatech.com> On 12/14/2012 06:52 AM, Jean Michel MacKay wrote: > Hey everybody, > I'm currently working on allowing admin distances to be changed through the config file. > > I've mapped the token 'distance', currently only in RIP and OSPF, to the RIB's set_protocol_admin_distance. Now the origin table is already created once > set_protocol_admin_distance is called, so it fails. I assume that it fails because you shouldn't change the AD once the origin table exists, since it > would comprise all the merge tables using that origin table. Is this the case? > > How I got around this was to implement change_admin_distance in the class OriginTable and only allow the AD to be changed if there are no routes in the > OriginTable. Since that should keep the integrity of the merge tables. > > Does this sound right? I'm worried that I'm missing something about the design and this is not a proper solution. > > I'll clean up the code and send a patch if you want it. A patch is welcome, but I don't have time to look into this in detail right now. Maybe someone else will have more time. Thanks, Ben > > Cheers, > JM > > > _______________________________________________ > Xorp-hackers mailing list > Xorp-hackers at icir.org > http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers > -- Ben Greear Candela Technologies Inc http://www.candelatech.com From mackay.jm at gmail.com Fri Dec 14 12:25:49 2012 From: mackay.jm at gmail.com (Jean Michel MacKay) Date: Fri, 14 Dec 2012 15:25:49 -0500 Subject: [Xorp-hackers] Changing the admin distance through the config file In-Reply-To: <50CB611E.7010905@candelatech.com> References: <50CB611E.7010905@candelatech.com> Message-ID: Here is the patch. Cheers, JM On Fri, Dec 14, 2012 at 12:25 PM, Ben Greear wrote: > On 12/14/2012 06:52 AM, Jean Michel MacKay wrote: > >> Hey everybody, >> I'm currently working on allowing admin distances to be changed through >> the config file. >> >> I've mapped the token 'distance', currently only in RIP and OSPF, to the >> RIB's set_protocol_admin_distance. Now the origin table is already created >> once >> set_protocol_admin_distance is called, so it fails. I assume that it >> fails because you shouldn't change the AD once the origin table exists, >> since it >> would comprise all the merge tables using that origin table. Is this the >> case? >> >> How I got around this was to implement change_admin_distance in the class >> OriginTable and only allow the AD to be changed if there are no routes in >> the >> OriginTable. Since that should keep the integrity of the merge tables. >> >> Does this sound right? I'm worried that I'm missing something about the >> design and this is not a proper solution. >> >> I'll clean up the code and send a patch if you want it. >> > > A patch is welcome, but I don't have time to look into this in detail > right now. > > Maybe someone else will have more time. > > Thanks, > Ben > > >> Cheers, >> JM >> >> >> ______________________________**_________________ >> Xorp-hackers mailing list >> Xorp-hackers at icir.org >> http://mailman.ICSI.Berkeley.**EDU/mailman/listinfo/xorp-**hackers >> >> > > -- > Ben Greear > Candela Technologies Inc http://www.candelatech.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-hackers/attachments/20121214/93e74080/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: admin_distance.patch Type: application/octet-stream Size: 2455 bytes Desc: not available Url : http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-hackers/attachments/20121214/93e74080/attachment.obj From mackay.jm at gmail.com Mon Dec 17 04:55:39 2012 From: mackay.jm at gmail.com (Jean Michel MacKay) Date: Mon, 17 Dec 2012 07:55:39 -0500 Subject: [Xorp-hackers] [PATCH] Admin distance set from config for RIP Message-ID: <1355748939-11909-1-git-send-email-mackay.jm@gmail.com> From: Jean Michel MacKay --- xorp/etc/templates/rip.tp | 8 ++++++++ xorp/rib/rib.cc | 10 +++++++--- xorp/rib/rt_tab_origin.hh | 5 +++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/xorp/etc/templates/rip.tp b/xorp/etc/templates/rip.tp index aff2763..8b32f04 100644 --- a/xorp/etc/templates/rip.tp +++ b/xorp/etc/templates/rip.tp @@ -7,6 +7,7 @@ protocols { rip { targetname: txt = "rip"; + distance: u32; traceoptions { flag { all { @@ -95,6 +96,13 @@ protocols { %set:; } + distance { + %help: short "Administrative Distance for RIP"; + %allow-range: $(@) "0" "255" %help: "Administrative Distance for RIP"; + %set: xrl "rib/rib/0.1/set_protocol_admin_distance?protocol:txt=rip&ipv4:bool=true&ipv6:bool=false&unicast:bool=true&multicast:bool=false&admin_distance:u32=$(@)"; + } + + traceoptions { %help: short "Configure the tracing options"; flag { diff --git a/xorp/rib/rib.cc b/xorp/rib/rib.cc index 3137750..8ad07db 100644 --- a/xorp/rib/rib.cc +++ b/xorp/rib/rib.cc @@ -222,11 +222,15 @@ RIB::set_protocol_admin_distance(const string& protocol_name, map::iterator mi = _admin_distances.find(protocol_name); if (mi != _admin_distances.end()) { OriginTable* ot = find_origin_table(protocol_name); - if (NULL != ot) { - XLOG_ERROR("May not set an admin distance for protocol \"%s\", " - "which has already instantiated an origin table.", + if (NULL != ot && ot->route_count() > 0) { + XLOG_ERROR("May not set an admin distance for protocol \"%s\", " + "which has already instantiated an origin table and contains routes.", protocol_name.c_str()); return XORP_ERROR; + }else if(NULL != ot && ot->route_count() == 0) { + ot->change_admin_distance(admin_distance); + XLOG_WARNING("Origin table was set but no routes were set." + " Should be safe to change admin distance."); } } _admin_distances[protocol_name] = admin_distance; diff --git a/xorp/rib/rt_tab_origin.hh b/xorp/rib/rt_tab_origin.hh index 1899289..eb6df6b 100644 --- a/xorp/rib/rt_tab_origin.hh +++ b/xorp/rib/rt_tab_origin.hh @@ -145,6 +145,11 @@ public: RouteRange* lookup_route_range(const A& addr) const; /** + * Changes the admin distance + **/ + void change_admin_distance( uint32_t ad ){ _admin_distance = ad; } + + /** * @return the default administrative distance for this OriginTable */ uint32_t admin_distance() const { return _admin_distance; } -- 1.7.4.1