Ejemplo n.º 1
0
    def multicast(self, value):
        try:
            a = netlink.AbstractAddress(value)
        except ValueError as err:
            raise AttributeError('multicast', err)

        capi.rtnl_addr_set_multicast(self._rtnl_addr, a._nl_addr)
Ejemplo n.º 2
0
    def local(self, value):
        a = netlink.AbstractAddress(value)
        capi.rtnl_addr_set_local(self._rtnl_addr, a._nl_addr)

        # local is immutable but we assume that if _orig does not
        # have a local address specified, it was meant to be given here
        if capi.rtnl_addr_get_local(self._orig) is None:
            capi.rtnl_addr_set_local(self._orig, a._nl_addr)
Ejemplo n.º 3
0
    def lookup(self, ifindex, local):
        if type(local) is str:
            local = netlink.AbstractAddress(local)

        addr = capi.rtnl_addr_get(self._nl_cache, ifindex, local._nl_addr)
        if addr is None:
            raise KeyError()

        return Address._from_capi(addr)
Ejemplo n.º 4
0
 def broadcast(self):
     """Hardware broadcast address"""
     a = capi.rtnl_link_get_broadcast(self._rtnl_link)
     return netlink.AbstractAddress(a)
Ejemplo n.º 5
0
 def address(self):
     """Hardware address (MAC address)"""
     a = capi.rtnl_link_get_addr(self._rtnl_link)
     return netlink.AbstractAddress(a)
Ejemplo n.º 6
0
 def dst(self):
     # return nladdr.Address( capir.rtnl_route_get_dst(self._nl_route) )
     addr = netlink.AbstractAddress(capir.rtnl_route_get_dst(
         self._nl_route))
     return addr
Ejemplo n.º 7
0
 def src(self):
     # rtnl_route_get_src
     # get_src returns a nl_addr
     addr = netlink.AbstractAddress(capir.rtnl_route_get_src(
         self._nl_route))
     return addr
Ejemplo n.º 8
0
 def gateway(self, gw):
     addr_gw = netlink.AbstractAddress(gw)
     capir.rtnl_route_nh_set_gateway(self._nh, addr_gw._nl_addr)
Ejemplo n.º 9
0
 def anycast(self, value):
     a = netlink.AbstractAddress(value)
     capi.rtnl_addr_set_anycast(self._rtnl_addr, a._nl_addr)
Ejemplo n.º 10
0
 def anycast(self):
     """anycast address"""
     a = capi.rtnl_addr_get_anycast(self._rtnl_addr)
     return netlink.AbstractAddress(a)
Ejemplo n.º 11
0
 def multicast(self):
     """multicast address"""
     a = capi.rtnl_addr_get_multicast(self._rtnl_addr)
     return netlink.AbstractAddress(a)
Ejemplo n.º 12
0
 def broadcast(self):
     """Broadcast address"""
     a = capi.rtnl_addr_get_broadcast(self._rtnl_addr)
     return netlink.AbstractAddress(a)
Ejemplo n.º 13
0
 def peer(self, value):
     a = netlink.AbstractAddress(value)
     capi.rtnl_addr_set_peer(self._rtnl_addr, a._nl_addr)
Ejemplo n.º 14
0
 def peer(self):
     """Peer address"""
     a = capi.rtnl_addr_get_peer(self._rtnl_addr)
     return netlink.AbstractAddress(a)
Ejemplo n.º 15
0
 def local(self):
     """Local address"""
     a = capi.rtnl_addr_get_local(self._rtnl_addr)
     return netlink.AbstractAddress(a)