summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJan Keler <jahekes@gmail.com>2016-01-20 11:10:00 +0100
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-01-30 23:35:28 +0900
commitc1c78269acd501a3bae4c2994c234ecdbce44689 (patch)
treef381ceb03538574e0e97f3e0bd9d9e968569deac
parent73416eacb164236a8ec38d06fdfff1cf613a6dfd (diff)
Fix: "AddrFormatError: address '...' is not an EUIv48"
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_0_parser.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py
index af4cbbbd..4952338e 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -21,6 +21,7 @@ Decoder/Encoder implementations of OpenFlow 1.0.
import struct
import binascii
import six
+import netaddr
from ryu.ofproto.ofproto_parser import StringifyMixin, MsgBase
from ryu.lib import addrconv
@@ -214,7 +215,7 @@ class OFPMatch(StringifyMixin):
self.dl_src = mac.DONTCARE
else:
wc &= ~ofproto.OFPFW_DL_SRC
- if isinstance(dl_src, (six.text_type, str)) and ':' in dl_src:
+ if isinstance(dl_src, (six.text_type, str)) and netaddr.valid_mac(dl_src):
dl_src = addrconv.mac.text_to_bin(dl_src)
if dl_src == 0:
self.dl_src = mac.DONTCARE
@@ -225,7 +226,7 @@ class OFPMatch(StringifyMixin):
self.dl_dst = mac.DONTCARE
else:
wc &= ~ofproto.OFPFW_DL_DST
- if isinstance(dl_dst, (six.text_type, str)) and ':' in dl_dst:
+ if isinstance(dl_dst, (six.text_type, str)) and netaddr.valid_mac(dl_dst):
dl_dst = addrconv.mac.text_to_bin(dl_dst)
if dl_dst == 0:
self.dl_dst = mac.DONTCARE
@@ -517,7 +518,7 @@ class OFPActionStripVlan(OFPAction):
class OFPActionDlAddr(OFPAction):
def __init__(self, dl_addr):
super(OFPActionDlAddr, self).__init__()
- if isinstance(dl_addr, (six.text_type, str)) and ':' in dl_addr:
+ if isinstance(dl_addr, (six.text_type, str)) and netaddr.valid_mac(dl_addr):
dl_addr = addrconv.mac.text_to_bin(dl_addr)
self.dl_addr = dl_addr