[Xorp-hackers] Some patches for various things.
Pavlin Radoslavov
pavlin at icir.org
Wed Oct 3 17:52:26 PDT 2007
Ben Greear <greearb at candelatech.com> wrote:
> Here are some more small patches. At some time during the last
> few weeks I added these to try to work around problems related to
> dynamically adding/deleting interfaces & ospf configuration. It's
> possible subsequent fixes from Xorp developers have made these un-needed.
>
>
> Treat a duplicate remove as OK instead of an error.
> This fixed some problem with reloading config files...
>
> RCS file: /cvs/xorp/fea/iftree.cc,v
> retrieving revision 1.51
> diff -u -r1.51 iftree.cc
> --- fea/iftree.cc 27 Sep 2007 00:33:33 -0000 1.51
> +++ fea/iftree.cc 3 Oct 2007 23:08:13 -0000
> @@ -1079,7 +1079,7 @@
> IfTreeAddr4* ap = find_addr(addr);
>
> if (ap == NULL)
> - return (XORP_ERROR);
> + return XORP_OK; // Already deleted it seems... (XORP_ERROR);
> ap->mark(DELETED);
> return (XORP_OK);
> }
This is a question of semantics. Currently, trying to delete an IfTree
item (interface, vif and IP address) that doesn't exist is
considered an error. Some of the usage of this is to capture
errors/bugs elsewhere in the code.
Could you send instructions how to replicate the problem with
reloading config files. Only then we can debug the issue and see
whether the real problem is somewhere else or whether it really
requires change of semantics.
Yes, there were some recent fixes to the FEA regarding modifying the
interface configuration, but there are no guarantees they actually
addressed the problem you had seen before.
> I prefer the log files to show the locations as file:line
> instead of the old +line format.
>
> RCS file: /cvs/xorp/libxorp/xlog.h,v
> retrieving revision 1.16
> diff -u -r1.16 xlog.h
> --- libxorp/xlog.h 20 Apr 2007 19:06:21 -0000 1.16
> +++ libxorp/xlog.h 3 Oct 2007 23:08:14 -0000
> @@ -101,8 +101,8 @@
> #define XLOG_FN(fn, fmt...) \
> do { \
> char xlog_where_buf[8000]; \
> - snprintf(xlog_where_buf, sizeof(xlog_where_buf), "+%d %s %s", \
> - __LINE__, __FILE__, __FUNCTION__); \
> + snprintf(xlog_where_buf, sizeof(xlog_where_buf), "%s:%d %s", \
> + __FILE__, __LINE__, __FUNCTION__); \
> xlog_##fn(_XLOG_MODULE_NAME, xlog_where_buf, fmt); \
> } while (0)
The reason the log message has the format "+line file" is that you
can cut-and-paste and open directly the file in an editor like emacs
or vi. E.g.:
emacs +101 libxorp/xlog.h
OR
vi +101 libxorp/xlog.h
will open and show directly the above code.
[Cudos to Orion Hodson for adding this nifty trick which I didn't
know before :)]
Could you provide an example when the "file:line" format can be
useful (apart of probably looking more aesthetic :) )
I will leave the OSPF patch to Atanu.
Thanks,
Pavlin
>
> This fixed an error in ospf. I don't know if this is still needed,
> or even if it was ever the right thing to do. Perhaps the OSPF
> folks could take a look and this...
>
> RCS file: /cvs/xorp/ospf/peer_manager.cc,v
> retrieving revision 1.146
> diff -u -r1.146 peer_manager.cc
> --- ospf/peer_manager.cc 3 Oct 2007 21:23:53 -0000 1.146
> +++ ospf/peer_manager.cc 3 Oct 2007 23:08:16 -0000
> @@ -369,9 +369,12 @@
> debug_msg("Interface %s Vif %s\n", interface.c_str(), vif.c_str());
> string concat = interface + "/" + vif;
>
> - if (0 != _pmap.count(concat))
> - xorp_throw(BadPeer,
> - c_format("Mapping for %s already exists", concat.c_str()));
> + if (0 != _pmap.count(concat)) {
> + // Don't think we really need to error here, just return what we already have. --Ben
> + //xorp_throw(BadPeer,
> + // c_format("Mapping for %s already exists", concat.c_str()));
> + return _pmap[concat];
> + }
>
> OspfTypes::PeerID peerid = _next_peerid++;
> _pmap[concat] = peerid;
>
>
> Thanks,
> Ben
>
>
> --
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc http://www.candelatech.com
>
> _______________________________________________
> Xorp-hackers mailing list
> Xorp-hackers at icir.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers
More information about the Xorp-hackers
mailing list