Ease SIOCGIF* ioctl calls
(iff, cmd)
| 32 | |
| 33 | |
| 34 | def get_if(iff, cmd): |
| 35 | # type: (str, int) -> bytes |
| 36 | """Ease SIOCGIF* ioctl calls""" |
| 37 | |
| 38 | sck = socket.socket() |
| 39 | try: |
| 40 | return ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8"))) |
| 41 | finally: |
| 42 | sck.close() |
| 43 | |
| 44 | |
| 45 | def get_if_raw_hwaddr(iff, # type: str |
no test coverage detected