Committed by
Gerrit Code Review
Bugfix: Criteria.toString() does not convert unsigned variables properly.
For example, in the response of 'flows' command, the ethType of IPv6 (0x86dd) is shown as ff..ff86dd instead of 86dd Note: VlanId/VlanPcp still remains in signed format in this commit since: * VLAN tag is actually 12 bits. There should be no problem even if it is printed as signed short. * VLAN PCP is actually 3 bits. There should be no problem even if it is printed as signed short. * -1 is used in many places to indicate untagged vlan Change-Id: Ib68161d552a0011e6a6666970907cf9ca846f620
Showing
1 changed file
with
8 additions
and
6 deletions
... | @@ -298,7 +298,8 @@ public final class Criteria { | ... | @@ -298,7 +298,8 @@ public final class Criteria { |
298 | @Override | 298 | @Override |
299 | public String toString() { | 299 | public String toString() { |
300 | return toStringHelper(type().toString()) | 300 | return toStringHelper(type().toString()) |
301 | - .add("ethType", Long.toHexString(ethType)).toString(); | 301 | + .add("ethType", Long.toHexString(ethType & 0xffff)) |
302 | + .toString(); | ||
302 | } | 303 | } |
303 | 304 | ||
304 | @Override | 305 | @Override |
... | @@ -396,7 +397,8 @@ public final class Criteria { | ... | @@ -396,7 +397,8 @@ public final class Criteria { |
396 | @Override | 397 | @Override |
397 | public String toString() { | 398 | public String toString() { |
398 | return toStringHelper(type().toString()) | 399 | return toStringHelper(type().toString()) |
399 | - .add("protocol", Long.toHexString(proto)).toString(); | 400 | + .add("protocol", Long.toHexString(proto & 0xff)) |
401 | + .toString(); | ||
400 | } | 402 | } |
401 | 403 | ||
402 | @Override | 404 | @Override |
... | @@ -542,7 +544,7 @@ public final class Criteria { | ... | @@ -542,7 +544,7 @@ public final class Criteria { |
542 | @Override | 544 | @Override |
543 | public String toString() { | 545 | public String toString() { |
544 | return toStringHelper(type().toString()) | 546 | return toStringHelper(type().toString()) |
545 | - .add("tcpPort", tcpPort).toString(); | 547 | + .add("tcpPort", tcpPort & 0xffff).toString(); |
546 | } | 548 | } |
547 | 549 | ||
548 | @Override | 550 | @Override |
... | @@ -589,7 +591,7 @@ public final class Criteria { | ... | @@ -589,7 +591,7 @@ public final class Criteria { |
589 | @Override | 591 | @Override |
590 | public String toString() { | 592 | public String toString() { |
591 | return toStringHelper(type().toString()) | 593 | return toStringHelper(type().toString()) |
592 | - .add("mpls", mplsLabel.intValue()).toString(); | 594 | + .add("mpls", mplsLabel & 0xffffffffL).toString(); |
593 | } | 595 | } |
594 | 596 | ||
595 | @Override | 597 | @Override |
... | @@ -639,7 +641,7 @@ public final class Criteria { | ... | @@ -639,7 +641,7 @@ public final class Criteria { |
639 | @Override | 641 | @Override |
640 | public String toString() { | 642 | public String toString() { |
641 | return toStringHelper(type().toString()) | 643 | return toStringHelper(type().toString()) |
642 | - .add("lambda", lambda).toString(); | 644 | + .add("lambda", lambda & 0xffff).toString(); |
643 | } | 645 | } |
644 | 646 | ||
645 | @Override | 647 | @Override |
... | @@ -686,7 +688,7 @@ public final class Criteria { | ... | @@ -686,7 +688,7 @@ public final class Criteria { |
686 | @Override | 688 | @Override |
687 | public String toString() { | 689 | public String toString() { |
688 | return toStringHelper(type().toString()) | 690 | return toStringHelper(type().toString()) |
689 | - .add("signalType", signalType).toString(); | 691 | + .add("signalType", signalType & 0xffff).toString(); |
690 | } | 692 | } |
691 | 693 | ||
692 | @Override | 694 | @Override | ... | ... |
-
Please register or login to post a comment