[Click] A few small tweaks
Christian Kreibich
christian at icir.org
Tue Jul 27 16:28:40 EDT 2010
Folks,
Here are some small tweaks I recently found myself wanting. Let me know
what you think.
This first one allows reimplementing the add_flow() method in classes
derived from IPAddrRewriter without reimplementing push(). Was there a
particular reason for fixing the class in the add_flow() call?
diff --git a/elements/ip/ipaddrrewriter.cc b/elements/ip/ipaddrrewriter.cc
index be9007a..a128d5a 100644
--- a/elements/ip/ipaddrrewriter.cc
+++ b/elements/ip/ipaddrrewriter.cc
@@ -160,7 +160,7 @@ IPAddrRewriter::push(int port, Packet *p_in)
IPFlowID rewritten_flowid = IPFlowID::uninitialized_t();
int result = is.rewrite_flowid(flowid, rewritten_flowid, p);
if (result == rw_addmap)
- m = IPAddrRewriter::add_flow(0, flowid, rewritten_flowid, port);
+ m = add_flow(0, flowid, rewritten_flowid, port);
if (!m) {
checked_output_push(result, p);
return;
This one makes dump_mappings_handler() available in subclasses, which
I've found convenient.
diff --git a/elements/ip/ipaddrrewriter.hh b/elements/ip/ipaddrrewriter.hh
index c11035d..8125a99 100644
--- a/elements/ip/ipaddrrewriter.hh
+++ b/elements/ip/ipaddrrewriter.hh
@@ -150,13 +150,13 @@ class IPAddrRewriter : public IPRewriterBase { public:
void add_handlers();
+ static String dump_mappings_handler(Element *, void *);
+
private:
SizedHashAllocator<sizeof(IPAddrFlow)> _allocator;
unsigned _annos;
- static String dump_mappings_handler(Element *, void *);
-
};
And this one fixes reporting of require()'d Click configs that aren't
found.:
diff --git a/lib/lexer.cc b/lib/lexer.cc
index cd111e3..e42af2b 100644
--- a/lib/lexer.cc
+++ b/lib/lexer.cc
@@ -1459,7 +1459,7 @@ Lexer::yrequire_library(const String &value)
dir = ".";
String fn = clickpath_find_file(value, "conf", dir, 0);
if (!fn) {
- lerror("library %<%#s%> not found in CLICKPATH/conf", fn.c_str());
+ lerror("library %<%#s%> not found in CLICKPATH/conf", value.c_str());
return;
}
--
Cheers,
Christian
More information about the click
mailing list