Lines Matching full:netlink

17 # Generic Netlink code which should really be in some library, but I can't quickly find one.
21 class Netlink: class
22 # Netlink socket
30 # Netlink message
84 return f"Netlink error: {os.strerror(-self.nl_msg.error)}\n{self.nl_msg}"
102 self.type = self._type & ~Netlink.NLA_TYPE_MASK
199 if self.nl_type == Netlink.NLMSG_ERROR:
203 elif self.nl_type == Netlink.NLMSG_DONE:
209 if self.nl_flags & Netlink.NLM_F_ACK_TLVS and extack_off:
213 if extack.type == Netlink.NLMSGERR_ATTR_MSG:
215 elif extack.type == Netlink.NLMSGERR_ATTR_MISS_TYPE:
217 elif extack.type == Netlink.NLMSGERR_ATTR_MISS_NEST:
219 elif extack.type == Netlink.NLMSGERR_ATTR_OFFS:
280 with socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, Netlink.NETLINK_GENERIC) as sock:
281 sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_CAP_ACK, 1)
283 msg = _genl_msg(Netlink.GENL_ID_CTRL,
284 Netlink.NLM_F_REQUEST | Netlink.NLM_F_ACK | Netlink.NLM_F_DUMP,
285 Netlink.CTRL_CMD_GETFAMILY, 1)
298 print("Netlink error:", nl_msg.error)
306 if attr.type == Netlink.CTRL_ATTR_FAMILY_ID:
308 elif attr.type == Netlink.CTRL_ATTR_FAMILY_NAME:
310 elif attr.type == Netlink.CTRL_ATTR_MAXATTR:
312 elif attr.type == Netlink.CTRL_ATTR_MCAST_GROUPS:
318 if entry_attr.type == Netlink.CTRL_ATTR_MCAST_GRP_NAME:
320 elif entry_attr.type == Netlink.CTRL_ATTR_MCAST_GRP_ID:
379 super().__init__(family_name, Netlink.NETLINK_GENERIC)
414 if self.proto == "netlink-raw":
423 self.sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_CAP_ACK, 1)
424 self.sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_EXT_ACK, 1)
425 self.sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_GET_STRICT_CHK, 1)
442 self.sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_ADD_MEMBERSHIP,
452 nl_type |= Netlink.NLA_F_NESTED
637 print("Netlink error in ntf!?", os.strerror(-nl_msg.error))
641 print("Netlink done while checking for ntf!?")
665 nl_flags = Netlink.NLM_F_REQUEST | Netlink.NLM_F_ACK
669 nl_flags |= Netlink.NLM_F_DUMP
699 print("Netlink warning:")