use rtnl_link_set/get_type()

This commit is contained in:
Thomas Graf 2011-07-21 17:52:43 +02:00
parent bf1b5d28c0
commit 20e9797652
3 changed files with 6 additions and 4 deletions

2
python/.gitignore vendored
View file

@ -1 +1,3 @@
build
capi_wrap.c
capi.py

View file

@ -142,8 +142,8 @@ extern int rtnl_link_get_num_vf(struct rtnl_link *, uint32_t *);
extern uint64_t rtnl_link_get_stat(struct rtnl_link *, int);
extern int rtnl_link_set_stat(struct rtnl_link *, const unsigned int, const uint64_t);
extern int rtnl_link_set_info_type(struct rtnl_link *, const char *);
extern char *rtnl_link_get_info_type(struct rtnl_link *);
extern int rtnl_link_set_type(struct rtnl_link *, const char *);
extern char *rtnl_link_get_type(struct rtnl_link *);
/* <netlink/route/link/vlan.h> */

View file

@ -386,11 +386,11 @@ class Link(netlink.Object):
@property
def type(self):
"""Link type"""
return capi.rtnl_link_get_info_type(self._rtnl_link)
return capi.rtnl_link_get_type(self._rtnl_link)
@type.setter
def type(self, value):
if capi.rtnl_link_set_info_type(self._rtnl_link, value) < 0:
if capi.rtnl_link_set_type(self._rtnl_link, value) < 0:
raise NameError("unknown info type")
self._module_lookup('netlink.route.links.' + value)