Shashikanth VH
Committed by Gerrit Code Review

BGP handle multiple update message processing

Change-Id: I61cba87876e27be63a8dfa5539d321e3e6273c09
...@@ -75,8 +75,9 @@ public abstract class BGPMessageVer4 { ...@@ -75,8 +75,9 @@ public abstract class BGPMessageVer4 {
75 } 75 }
76 } 76 }
77 short length = cb.readShort(); 77 short length = cb.readShort();
78 - if (length != (cb.readableBytes() + HEADER_AND_MSG_LEN)) { 78 + if (length > cb.readableBytes() + HEADER_AND_MSG_LEN) {
79 - Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH, length); 79 + Validation.validateLen(BGPErrorType.MESSAGE_HEADER_ERROR,
80 + BGPErrorType.BAD_MESSAGE_LENGTH, length);
80 } 81 }
81 bgpHeader.setLength(length); 82 bgpHeader.setLength(length);
82 byte type = cb.readByte(); 83 byte type = cb.readByte();
...@@ -93,7 +94,7 @@ public abstract class BGPMessageVer4 { ...@@ -93,7 +94,7 @@ public abstract class BGPMessageVer4 {
93 return BGPKeepaliveMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader); 94 return BGPKeepaliveMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
94 case UPDATE_MSG_TYPE: 95 case UPDATE_MSG_TYPE:
95 log.debug("UPDATE MESSAGE is received"); 96 log.debug("UPDATE MESSAGE is received");
96 - // TODO: Update message version 4 97 + return BgpUpdateMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
97 case NOTIFICATION_MSG_TYPE: 98 case NOTIFICATION_MSG_TYPE:
98 log.debug("NOTIFICATION MESSAGE is received"); 99 log.debug("NOTIFICATION MESSAGE is received");
99 return BGPNotificationMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader); 100 return BGPNotificationMsgVer4.READER.readFrom(cb.readBytes(len), bgpHeader);
...@@ -102,7 +103,8 @@ public abstract class BGPMessageVer4 { ...@@ -102,7 +103,8 @@ public abstract class BGPMessageVer4 {
102 return null; 103 return null;
103 } 104 }
104 } catch (IndexOutOfBoundsException e) { 105 } catch (IndexOutOfBoundsException e) {
105 - throw new BGPParseException(BGPErrorType.MESSAGE_HEADER_ERROR, BGPErrorType.BAD_MESSAGE_LENGTH, null); 106 + throw new BGPParseException(BGPErrorType.MESSAGE_HEADER_ERROR,
107 + BGPErrorType.BAD_MESSAGE_LENGTH, null);
106 } 108 }
107 } 109 }
108 } 110 }
......