summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-02-06 16:43:24 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-02-06 16:43:24 -0800
commit40ef28241dd7c0ca6eebdfb0949d477c417c47c1 (patch)
tree4c52645b97c34ed2f205eaea4c4272b9c1e2d13b /packet
parentd280168106c9ef9ed68ad117b913f52e6bae1827 (diff)
bmp: fix peerheader ip handling
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet')
-rw-r--r--packet/bmp.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/packet/bmp.go b/packet/bmp.go
index 1cb49200..6b1f1ca5 100644
--- a/packet/bmp.go
+++ b/packet/bmp.go
@@ -105,7 +105,7 @@ func (h *BMPPeerHeader) DecodeFromBytes(data []byte) error {
if h.Flags&(1<<7) != 0 {
h.PeerAddress = net.IP(data[10:26]).To16()
} else {
- h.PeerAddress = net.IP(data[10:14]).To4()
+ h.PeerAddress = net.IP(data[22:26]).To4()
}
h.PeerAS = binary.BigEndian.Uint32(data[26:30])
h.PeerBGPID = data[30:34]
@@ -124,7 +124,7 @@ func (h *BMPPeerHeader) Serialize() ([]byte, error) {
if h.Flags&(1<<7) != 0 {
copy(buf[10:26], h.PeerAddress)
} else {
- copy(buf[10:14], h.PeerAddress.To4())
+ copy(buf[22:26], h.PeerAddress.To4())
}
binary.BigEndian.PutUint32(buf[26:30], h.PeerAS)
copy(buf[30:34], h.PeerBGPID)