From c37692cb10242b76eee04c53fca8ba112360c18f Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 14 Aug 2014 18:37:02 +0900 Subject: [PATCH] bgp: simplify CLUSTER_LIST attribute parser Signed-off-by: FUJITA Tomonori --- ryu/lib/packet/bgp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index adeda92c..ad08d9e8 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -1722,14 +1722,14 @@ class BGPPathAttributeClusterList(_PathAttribute): def serialize_value(self): buf = bytearray() + offset = 0 for cluster_id in self.value: - cluster_id_bin = bytearray() msg_pack_into( self._VALUE_PACK_STR, - cluster_id_bin, - 0, + buf, + offset, addrconv.ipv4.text_to_bin(cluster_id)) - buf += cluster_id_bin + offset += struct.calcsize(self._VALUE_PACK_STR) return buf