diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-07-08 20:05:29 -0400 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-07-08 20:05:29 -0400 |
commit | 366f556e5b80ee44edb575f51b48dde09874fad8 (patch) | |
tree | d01ada2b2c190fc40ecc11ff6a12629c63b14b16 /node/Filter.cpp | |
parent | e7f20ad5f9345d17f7699d2d5ffab2ca5de335c1 (diff) | |
download | infinitytier-366f556e5b80ee44edb575f51b48dde09874fad8.tar.gz infinitytier-366f556e5b80ee44edb575f51b48dde09874fad8.zip |
Filter work
Diffstat (limited to 'node/Filter.cpp')
-rw-r--r-- | node/Filter.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/node/Filter.cpp b/node/Filter.cpp index 1f81a360..5cd295c3 100644 --- a/node/Filter.cpp +++ b/node/Filter.cpp @@ -167,21 +167,27 @@ std::string Filter::toString(const char *sep) const s.push_back('['); if (i->rule.etherType()) { - sprintf(buf,"%u-%u",i->rule.etherType().start,i->rule.etherType().end); + if (i->rule.etherType().magnitude() > 1) + sprintf(buf,"%u-%u",i->rule.etherType().start,i->rule.etherType().end); + else sprintf(buf,"%u",i->rule.etherType().start); s.append(buf); } else s.push_back('*'); s.push_back(';'); if (i->rule.protocol()) { - sprintf(buf,"%u-%u",i->rule.protocol().start,i->rule.protocol().end); + if (i->rule.protocol().magnitude() > 1) + sprintf(buf,"%u-%u",i->rule.protocol().start,i->rule.protocol().end); + else sprintf(buf,"%u",i->rule.protocol().start); s.append(buf); } else s.push_back('*'); s.push_back(';'); if (i->rule.port()) { - sprintf(buf,"%u-%u",i->rule.port().start,i->rule.port().end); + if (i->rule.port().magnitude() > 1) + sprintf(buf,"%u-%u",i->rule.port().start,i->rule.port().end); + else sprintf(buf,"%u",i->rule.port().start); s.append(buf); } else s.push_back('*'); |