Implementation of IPv4 specific link attributes.
More...
|
const char * | rtnl_link_inet_devconf2str (int type, char *buf, size_t len) |
|
int | rtnl_link_inet_str2devconf (const char *name) |
|
int | rtnl_link_inet_get_conf (struct rtnl_link *link, const unsigned int cfgid, uint32_t *res) |
| Get value of a ipv4 link configuration setting. More...
|
|
int | rtnl_link_inet_set_conf (struct rtnl_link *link, const unsigned int cfgid, uint32_t value) |
| Change value of a ipv4 link configuration setting. More...
|
|
Implementation of IPv4 specific link attributes.
- Example: Reading the value of IPV4_DEVCONF_FORWARDING
struct nl_cache *cache;
uint32_t value;
printf("forwarding is %s\n", value ? "enabled" : "disabled");
int rtnl_link_inet_get_conf(struct rtnl_link *link, const unsigned int cfgid, uint32_t *res)
Get value of a ipv4 link configuration setting.
struct rtnl_link * rtnl_link_get_by_name(struct nl_cache *cache, const char *name)
Lookup link in cache by link name.
int rtnl_link_alloc_cache(struct nl_sock *sk, int family, struct nl_cache **result)
Allocate link cache and fill in all configured links.
- Example: Changing the value of IPV4_DEVCONF_FOWARDING
int rtnl_link_inet_set_conf(struct rtnl_link *link, const unsigned int cfgid, uint32_t value)
Change value of a ipv4 link configuration setting.
struct rtnl_link * rtnl_link_alloc(void)
Allocate link object.
int rtnl_link_change(struct nl_sock *sk, struct rtnl_link *orig, struct rtnl_link *changes, int flags)
Change link.
◆ rtnl_link_inet_get_conf()
int rtnl_link_inet_get_conf |
( |
struct rtnl_link * |
link, |
|
|
const unsigned int |
cfgid, |
|
|
uint32_t * |
res |
|
) |
| |
Get value of a ipv4 link configuration setting.
- Parameters
-
link | Link object |
cfgid | Configuration identifier |
res | Result pointer |
Stores the value of the specified configuration setting in the provided result pointer.
- Returns
- 0 on success or a negative error code.
-
-NLE_RANGE cfgid is out of range, 1..IPV4_DEVCONF_MAX
-
-NLE_NOATTR configuration setting not available
-
-NLE_INVAL cfgid not set. If the link was received via netlink, it means that the cfgid is not supported.
Definition at line 232 of file inet.c.
References rtnl_link_af_data().
◆ rtnl_link_inet_set_conf()
int rtnl_link_inet_set_conf |
( |
struct rtnl_link * |
link, |
|
|
const unsigned int |
cfgid, |
|
|
uint32_t |
value |
|
) |
| |
Change value of a ipv4 link configuration setting.
- Parameters
-
link | Link object |
cfgid | Configuration identifier |
value | New value |
Changes the value in the per link ipv4 configuration array.
- Returns
- 0 on success or a negative error code.
-
-NLE_RANGE cfgid is out of range, 1..IPV4_DEVCONF_MAX
-
-NLE_NOMEM memory allocation failed
Definition at line 262 of file inet.c.
References rtnl_link_af_alloc().