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)
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)
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)
def broadcast(self): """Hardware broadcast address""" a = capi.rtnl_link_get_broadcast(self._rtnl_link) return netlink.AbstractAddress(a)
def address(self): """Hardware address (MAC address)""" a = capi.rtnl_link_get_addr(self._rtnl_link) return netlink.AbstractAddress(a)
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
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
def gateway(self, gw): addr_gw = netlink.AbstractAddress(gw) capir.rtnl_route_nh_set_gateway(self._nh, addr_gw._nl_addr)
def anycast(self, value): a = netlink.AbstractAddress(value) capi.rtnl_addr_set_anycast(self._rtnl_addr, a._nl_addr)
def anycast(self): """anycast address""" a = capi.rtnl_addr_get_anycast(self._rtnl_addr) return netlink.AbstractAddress(a)
def multicast(self): """multicast address""" a = capi.rtnl_addr_get_multicast(self._rtnl_addr) return netlink.AbstractAddress(a)
def broadcast(self): """Broadcast address""" a = capi.rtnl_addr_get_broadcast(self._rtnl_addr) return netlink.AbstractAddress(a)
def peer(self, value): a = netlink.AbstractAddress(value) capi.rtnl_addr_set_peer(self._rtnl_addr, a._nl_addr)
def peer(self): """Peer address""" a = capi.rtnl_addr_get_peer(self._rtnl_addr) return netlink.AbstractAddress(a)
def local(self): """Local address""" a = capi.rtnl_addr_get_local(self._rtnl_addr) return netlink.AbstractAddress(a)