Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fast-reboot-dump] Fix exception in struct.pack (#1309)
This commit fix the exception thrown by struct.pack when attempting to pack a unicode string. The script ```fast-reboot-dump.py``` will throw an exception in python3 because ```struct.pack``` requires ```bytes``` for ```s```. ``` Traceback: Traceback (most recent call last): #12 File "/usr/local/bin/fast-reboot-dump.py", line 299, in <module> #12 res = main() #12 File "/usr/local/bin/fast-reboot-dump.py", line 292, in main #12 send_garp_nd(neighbor_entries, map_mac_ip_per_vlan) #12 File "/usr/local/bin/fast-reboot-dump.py", line 221, in send_garp_nd #12 src_ip_addrs = {vlan_name:get_iface_ip_addr(vlan_name) for vlan_name,_,_ in neighbor_entries} #12 File "/usr/local/bin/fast-reboot-dump.py", line 221, in <dictcomp> #12 src_ip_addrs = {vlan_name:get_iface_ip_addr(vlan_name) for vlan_name,_,_ in neighbor_entries} #12 File "/usr/local/bin/fast-reboot-dump.py", line 195, in get_iface_ip_addr #12 return get_if(iff, SIOCGIFADDR)[20:24] #12 File "/usr/local/bin/fast-reboot-dump.py", line 185, in get_if #12 ifreq = ioctl(s, cmd, struct.pack("16s16x",iff)) #12 struct.error: argument for 's' must be a bytes object ``` Signed-off-by: bingwang <bingwang@microsoft.com>
- Loading branch information