diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-01-30 14:49:42 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-13 00:17:57 +0100 |
commit | d4eb9c36754afcfbfbf758afd80816ee71a57362 (patch) | |
tree | 5b5a0b658035bc9cef2f8058616f4f351370364f /src/main/java/com/lumaserv/bgp/protocol/message/BGPOpen.java | |
parent | 45143e7d7ad17e149d4df8f5502a15c3222691e4 (diff) |
WIP multiprotocol capability and IPv6
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/protocol/message/BGPOpen.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/protocol/message/BGPOpen.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/com/lumaserv/bgp/protocol/message/BGPOpen.java b/src/main/java/com/lumaserv/bgp/protocol/message/BGPOpen.java index 875f7bc..e83b751 100644 --- a/src/main/java/com/lumaserv/bgp/protocol/message/BGPOpen.java +++ b/src/main/java/com/lumaserv/bgp/protocol/message/BGPOpen.java @@ -22,13 +22,30 @@ public class BGPOpen { } public byte[] build() { - byte[] message = new byte[6 + identifier.length]; + byte[] message = new byte[5 + identifier.length + 1 + 2 + 2 * 6]; message[0] = version; message[1] = (byte) (asn >> 8); message[2] = (byte) (asn & 0xFF); message[3] = (byte) (holdTime >> 8); message[4] = (byte) (holdTime & 0xFF); System.arraycopy(identifier, 0, message, 5, identifier.length); + message[5 + identifier.length + 0] = 14; // Length (0E) + message[5 + identifier.length + 1] = 2; // Parameter Type: capability (02) + message[5 + identifier.length + 2] = 12; // Length (0C) + + message[5 + identifier.length + 3] = 1; // Type: multiprotocol (01) + message[5 + identifier.length + 4] = 4; // Length (04) + message[5 + identifier.length + 5] = 0; // IPv6 (0002) + message[5 + identifier.length + 6] = 2; // + message[5 + identifier.length + 7] = 0; // Reserved + message[5 + identifier.length + 8] = 1; // Unicast (01) + + message[5 + identifier.length + 9] = 1; // Type: multiprotocol (01) + message[5 + identifier.length +10] = 4; // Length (04) + message[5 + identifier.length +11] = 0; // IPv4 (0001) + message[5 + identifier.length +12] = 1; // + message[5 + identifier.length +13] = 0; // Reserved + message[5 + identifier.length +14] = 1; // Unicast (01) return message; } |