Extract the mac address from provided address. None is returned on error.
(addr)
| 270 | |
| 271 | |
| 272 | def in6_addrtomac(addr): |
| 273 | # type: (str) -> Optional[str] |
| 274 | """ |
| 275 | Extract the mac address from provided address. None is returned |
| 276 | on error. |
| 277 | """ |
| 278 | mask = inet_pton(socket.AF_INET6, "::ffff:ffff:ffff:ffff") |
| 279 | x = in6_and(mask, inet_pton(socket.AF_INET6, addr)) |
| 280 | ifaceid = inet_ntop(socket.AF_INET6, x)[2:] |
| 281 | return in6_ifaceidtomac(ifaceid) |
| 282 | |
| 283 | |
| 284 | def in6_addrtovendor(addr): |
no test coverage detected