From 271961ecb1b7eea779fb760c3c83aaa42418013d Mon Sep 17 00:00:00 2001 From: Shinpei Muraoka Date: Tue, 21 Mar 2017 09:50:46 +0900 Subject: [PATCH] packet/bgp: Add the address converter for Flow Specification Argument "addr" of "_FlowSpecPrefixBase" must be specified in the network address. If argument "addr" specified in the host address, this patch converts the given address into the network address. Signed-off-by: Shinpei Muraoka Signed-off-by: FUJITA Tomonori --- ryu/lib/packet/bgp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index d22bb0ed..794e0456 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -2332,7 +2332,8 @@ class _FlowSpecPrefixBase(_FlowSpecComponentBase, IPAddrPrefix): def __init__(self, length, addr, type_=None): super(_FlowSpecPrefixBase, self).__init__(type_) self.length = length - self.addr = addr + prefix = "%s/%s" % (addr, length) + self.addr = str(netaddr.ip.IPNetwork(prefix).network) @classmethod def parse_body(cls, buf):