[Click] A few small tweaks

Eddie Kohler kohler at cs.ucla.edu
Tue Aug 16 14:32:43 EDT 2011


Christian!  Long time!!

Thanks much for these tweaks.  I've applied versions of the 2nd and 3rd.  As 
for the first:

On 07/27/2010 04:28 PM, Christian Kreibich wrote:
> 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?

Yes there was -- avoiding another virtual function call on the push() case. 
That reason may be silly or obsolete; it would be nice if someone did some 
measurements.

Thanks again.
Eddie

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


More information about the click mailing list