Committed by
Gerrit Code Review
BGP AS number issue fixes.
Change-Id: I204fdbc4f54917448b79bba453015f64283da125
Showing
3 changed files
with
11 additions
and
11 deletions
| ... | @@ -47,7 +47,7 @@ public interface BgpOpenMsg extends BgpMessage { | ... | @@ -47,7 +47,7 @@ public interface BgpOpenMsg extends BgpMessage { |
| 47 | * | 47 | * |
| 48 | * @return AS Number of Open Message | 48 | * @return AS Number of Open Message |
| 49 | */ | 49 | */ |
| 50 | - short getAsNumber(); | 50 | + long getAsNumber(); |
| 51 | 51 | ||
| 52 | /** | 52 | /** |
| 53 | * Returns BGP Identifier of Open Message. | 53 | * Returns BGP Identifier of Open Message. | ... | ... |
| ... | @@ -84,7 +84,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { | ... | @@ -84,7 +84,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { |
| 84 | (short) OPEN_MSG_MINIMUM_LENGTH, (byte) 0X01); | 84 | (short) OPEN_MSG_MINIMUM_LENGTH, (byte) 0X01); |
| 85 | private BgpHeader bgpMsgHeader; | 85 | private BgpHeader bgpMsgHeader; |
| 86 | private byte version; | 86 | private byte version; |
| 87 | - private short asNumber; | 87 | + private long asNumber; |
| 88 | private short holdTime; | 88 | private short holdTime; |
| 89 | private int bgpId; | 89 | private int bgpId; |
| 90 | private boolean isLargeAsCapabilitySet; | 90 | private boolean isLargeAsCapabilitySet; |
| ... | @@ -114,7 +114,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { | ... | @@ -114,7 +114,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { |
| 114 | * @param bgpId BGP identifier in open message | 114 | * @param bgpId BGP identifier in open message |
| 115 | * @param capabilityTlv capabilities in open message | 115 | * @param capabilityTlv capabilities in open message |
| 116 | */ | 116 | */ |
| 117 | - public BgpOpenMsgVer4(BgpHeader bgpMsgHeader, byte version, short asNumber, short holdTime, | 117 | + public BgpOpenMsgVer4(BgpHeader bgpMsgHeader, byte version, long asNumber, short holdTime, |
| 118 | int bgpId, LinkedList<BgpValueType> capabilityTlv) { | 118 | int bgpId, LinkedList<BgpValueType> capabilityTlv) { |
| 119 | this.bgpMsgHeader = bgpMsgHeader; | 119 | this.bgpMsgHeader = bgpMsgHeader; |
| 120 | this.version = version; | 120 | this.version = version; |
| ... | @@ -145,7 +145,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { | ... | @@ -145,7 +145,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | @Override | 147 | @Override |
| 148 | - public short getAsNumber() { | 148 | + public long getAsNumber() { |
| 149 | return this.asNumber; | 149 | return this.asNumber; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| ... | @@ -169,7 +169,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { | ... | @@ -169,7 +169,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { |
| 169 | 169 | ||
| 170 | byte version; | 170 | byte version; |
| 171 | short holdTime; | 171 | short holdTime; |
| 172 | - short asNumber; | 172 | + long asNumber; |
| 173 | int bgpId; | 173 | int bgpId; |
| 174 | byte optParaLen = 0; | 174 | byte optParaLen = 0; |
| 175 | byte optParaType; | 175 | byte optParaType; |
| ... | @@ -191,8 +191,8 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { | ... | @@ -191,8 +191,8 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | // Read AS number | 193 | // Read AS number |
| 194 | - asNumber = cb.readShort(); | 194 | + asNumber = cb.getUnsignedShort(cb.readerIndex()); |
| 195 | - | 195 | + cb.readShort(); |
| 196 | // Read Hold timer | 196 | // Read Hold timer |
| 197 | holdTime = cb.readShort(); | 197 | holdTime = cb.readShort(); |
| 198 | 198 | ||
| ... | @@ -497,7 +497,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { | ... | @@ -497,7 +497,7 @@ public class BgpOpenMsgVer4 implements BgpOpenMsg { |
| 497 | cb.writeShort(AS_TRANS); | 497 | cb.writeShort(AS_TRANS); |
| 498 | } else { | 498 | } else { |
| 499 | // write AS number in next 2-octet | 499 | // write AS number in next 2-octet |
| 500 | - cb.writeShort(message.asNumber); | 500 | + cb.writeShort((short) message.asNumber); |
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | // write HoldTime in next 2-octet | 503 | // write HoldTime in next 2-octet | ... | ... |
| ... | @@ -169,12 +169,12 @@ public class BgpAppConfig extends Config<ApplicationId> { | ... | @@ -169,12 +169,12 @@ public class BgpAppConfig extends Config<ApplicationId> { |
| 169 | public boolean validateFlowSpec() { | 169 | public boolean validateFlowSpec() { |
| 170 | if (flowSpecCapability() != null) { | 170 | if (flowSpecCapability() != null) { |
| 171 | String flowSpec = flowSpecCapability(); | 171 | String flowSpec = flowSpecCapability(); |
| 172 | - if ((flowSpec.equals("IPV4")) || (flowSpec.equals("VPNV4")) || (flowSpec.equals("IPV4_VPNV4"))) { | 172 | + if ((!flowSpec.equals("IPV4")) && (!flowSpec.equals("VPNV4")) && (!flowSpec.equals("IPV4_VPNV4"))) { |
| 173 | - return true; | 173 | + return false; |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | - return false; | 177 | + return true; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | /** | 180 | /** | ... | ... |
-
Please register or login to post a comment