Commit 281b157
authored
[fast-reboot-dump] Fix exception in struct.pack (sonic-net#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 <[email protected]>1 parent 269c317 commit 281b157
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| |||
0 commit comments