def make_sockets():
"""Makes and returns the raw IPv6 and IPv4 ICMP sockets.
This needs to run as root before dropping privileges.
"""
try:
socketv6 = socket.socket(socket.AF_INET6, socket.SOCK_RAW,
socket.getprotobyname('ipv6-icmp'))
except Exception:
LOGGER.error("Could not create v6 socket")
raise
try:
socketv4 = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.getprotobyname('icmp'))
except Exception:
LOGGER.error("Could not create v6 socket")
raise
return [socketv6, socketv4]
评论列表
文章目录