]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
nlmanager: nlpacket: update AttributeMACAddress decode comments
authorJulien Fortin <julien@cumulusnetworks.com>
Wed, 27 Jun 2018 18:46:38 +0000 (21:46 +0300)
committerGitHub <noreply@github.com>
Wed, 27 Jun 2018 18:46:38 +0000 (21:46 +0300)
this commit adds some explanation/comments in the decode function of the
AttributeMACAddress class. Some comments are moved around and placed
in the right location.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdown2/nlmanager/nlpacket.py

index 94463d0ac0a67bb924598c9708afcdf3d3d9b3ff..f2cf6002c9bf1678d5f6bc649d982a19977aa787 100644 (file)
@@ -533,14 +533,17 @@ class AttributeMACAddress(Attribute):
 
     def decode(self, parent_msg, data):
         self.decode_length_type(data)
-
+        
+        # IFLA_ADDRESS and IFLA_BROADCAST attributes for all interfaces has been a
+        # 6-byte MAC address. But the GRE interface uses a 4-byte IP address and 
+        # GREv6 uses a 16-byte IPv6 address for this attribute.
         try:
-            # MAC Address 
+            # GRE interface uses a 4-byte IP address for this attribute
             if self.length == 8:
                 self.value = IPv4Address(unpack('>L', self.data[4:])[0])
                 self.value_int = int(self.value)
                 self.value_int_str = str(self.value_int)
-            # GRE interface uses a 4-byte IP address for this attribute
+            # MAC Address 
             elif self.length == 10:
                 (data1, data2) = unpack(self.PACK, self.data[4:])
                 self.value = mac_int_to_str(data1 << 16 | data2)