Esempio n. 1
0
    def delete(self, socket=None):
        """Attempt to delete this link in the kernel"""
        if not socket:
            socket = netlink.lookup_socket(netlink.NETLINK_ROUTE)

        ret = capi.rtnl_link_delete(socket._sock, self._rtnl_link)
        if ret < 0:
            raise netlink.KernelError(ret)
Esempio n. 2
0
	def change(self, socket=None, flags=0):
		"""Commit changes made to the link object"""
        	if not socket:
                        socket = netlink.lookup_socket(netlink.NETLINK_ROUTE)

		if not self._orig:
			raise NetlinkError("Original link not available")
        	ret = capi.rtnl_link_change(socket._sock, self._orig, self._rtnl_link, flags)
                if ret < 0:
                        raise netlink.KernelError(ret)
Esempio n. 3
0
    def add(self, socket=None, flags=None):
        if not socket:
            socket = netlink.lookup_socket(netlink.NETLINK_ROUTE)

        if not flags:
            flags = netlink.NLM_F_CREATE

        ret = capi.rtnl_link_add(socket._sock, self._rtnl_link, flags)
        if ret < 0:
            raise netlink.KernelError(ret)
Esempio n. 4
0
 def delete(self, socket):
     """Attempt to delete this link in the kernel"""
     ret = capi.rtnl_addr_delete(socket._sock, self._addr)
     if ret < 0:
         raise netlink.KernelError(ret)