[Xorp-hackers] Some patches for various things.

Ben Greear greearb at candelatech.com
Wed Oct 3 16:17:54 PDT 2007


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);
  }


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)


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



More information about the Xorp-hackers mailing list