(interfaceName)
| 21 | else: |
| 22 | _libc = ctypes.cdll.libc |
| 23 | def if_nametoindex(interfaceName): |
| 24 | # if you have a better way to get the interface index, I'd love to hear |
| 25 | # it... You are supposed to be able to leave the interface number as 0, |
| 26 | # but I get an exception when I try this. (MacOS 10.4) It may be because |
| 27 | # it is a multihomed device... |
| 28 | return _libc.if_nametoindex(interfaceName) |
| 29 | |
| 30 | if if_nametoindex is None: |
| 31 | try: import dl |