IPRewriter fix (was: Updated click-viz )

Jose Vasconcellos jvasco at verizon.net
Fri Jan 17 18:36:43 EST 2003


Hi Eddie,

Well, I'm glad that you find the script useful!

On a slightly different subject, I've ran across a problem with IPRewriter;
it does not accept the 'keep' option. I did some digging and came up with
the fix below. Basically, I changed how the two parameters are parsed.

*** iprw.cc 2003-01-17 17:54:01.000000000 -0500
--- iprw.cc.old 2003-01-17 17:52:26.000000000 -0500
***************
*** 517,529 ****
      is.u.output = outnum;

    } else if (word == "keep") {
!     Vector<String> words;
!     cp_spacevec(rest, words);
!
!     if (words.size() != 2
!  || !cp_integer(words[words.size() - 2], &is.u.keep.fport)
!  || !cp_integer(words[words.size() - 1], &is.u.keep.rport)
!  || is.u.keep.fport < 0 || is.u.keep.rport < 0)
        return errh->error("%s: syntax error; expected `keep FOUTPUT
ROUTPUT'", name.cc());
      if (is.u.keep.fport >= noutputs() || is.u.keep.rport >= noutputs())
        return errh->error("%s: output port out of range", name.cc());
--- 517,526 ----
      is.u.output = outnum;

    } else if (word == "keep") {
!     if (cp_va_parse(rest, this, ErrorHandler::silent_handler(),
!       cpUnsigned, "forward output", &is.u.keep.fport,
!       cpUnsigned, "reverse output", &is.u.keep.rport,
!       0) < 0)
        return errh->error("%s: syntax error; expected `keep FOUTPUT
ROUTPUT'", name.cc());
      if (is.u.keep.fport >= noutputs() || is.u.keep.rport >= noutputs())
        return errh->error("%s: output port out of range", name.cc());

Jose




More information about the click mailing list