From db15bee60cdc91df65742bc2650d886e2c899dad Mon Sep 17 00:00:00 2001 From: tgoff0 Date: Mon, 9 Mar 2015 15:20:42 +0000 Subject: [PATCH] daemon: Include MAC addresses in CORE API link messages. --- daemon/core/bsd/nodes.py | 6 ++++++ daemon/core/coreobj.py | 4 ++++ daemon/core/netns/nodes.py | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/daemon/core/bsd/nodes.py b/daemon/core/bsd/nodes.py index 7ffecd36..2eea4815 100644 --- a/daemon/core/bsd/nodes.py +++ b/daemon/core/bsd/nodes.py @@ -68,6 +68,9 @@ class PtpNet(NetgraphPipeNet): tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF1NUM, \ if1.node.getifindex(if1)) + if if1.hwaddr: + tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF1MAC, + if1.hwaddr) for addr in if1.addrlist: (ip, sep, mask) = addr.partition('/') mask = int(mask) @@ -86,6 +89,9 @@ class PtpNet(NetgraphPipeNet): tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2NUM, \ if2.node.getifindex(if2)) + if if2.hwaddr: + tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2MAC, + if2.hwaddr) for addr in if2.addrlist: (ip, sep, mask) = addr.partition('/') mask = int(mask) diff --git a/daemon/core/coreobj.py b/daemon/core/coreobj.py index 0a51d3da..6b04be8a 100644 --- a/daemon/core/coreobj.py +++ b/daemon/core/coreobj.py @@ -371,6 +371,10 @@ class PyCoreNet(PyCoreObj): 1) tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2NUM, otherobj.getifindex(netif)) + if netif.hwaddr: + tlvdata += \ + coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2MAC, + netif.hwaddr) for addr in netif.addrlist: (ip, sep, mask) = addr.partition('/') mask = int(mask) diff --git a/daemon/core/netns/nodes.py b/daemon/core/netns/nodes.py index 73edddef..2d3cf515 100644 --- a/daemon/core/netns/nodes.py +++ b/daemon/core/netns/nodes.py @@ -108,6 +108,9 @@ class PtpNet(LxBrNet): tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF1NUM, \ if1.node.getifindex(if1)) + if if1.hwaddr: + tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF1MAC, + if1.hwaddr) for addr in if1.addrlist: (ip, sep, mask) = addr.partition('/') mask = int(mask) @@ -126,6 +129,9 @@ class PtpNet(LxBrNet): tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2NUM, \ if2.node.getifindex(if2)) + if if2.hwaddr: + tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2MAC, + if2.hwaddr) for addr in if2.addrlist: (ip, sep, mask) = addr.partition('/') mask = int(mask)