summaryrefslogtreecommitdiff
path: root/zebra/zebra_netns_id.c
diff options
context:
space:
mode:
authorJakub Urbańczyk <xthaid@gmail.com>2020-06-08 23:37:26 +0200
committerJakub Urbańczyk <xthaid@gmail.com>2020-06-13 22:53:24 +0200
commit312a6beed67017e53679673a763c7693514cdd7e (patch)
tree9afc490bb0d334007aa9f7a8673c8d44e8d81187 /zebra/zebra_netns_id.c
parentf8e30433f6fb130d17cf43efb693a04e3399a9e8 (diff)
zebra: clean up netlink api
* Rename netlink utility functions like addattr to be less ambiguous * Replace rta_attr_* functions with nl_attr_* since they introduced inconsistencies in the code * Add helper functions for adding rtnexthop struct to the Netlink message Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
Diffstat (limited to 'zebra/zebra_netns_id.c')
-rw-r--r--zebra/zebra_netns_id.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/zebra/zebra_netns_id.c b/zebra/zebra_netns_id.c
index 0d86421b9e..79121bb086 100644
--- a/zebra/zebra_netns_id.c
+++ b/zebra/zebra_netns_id.c
@@ -216,8 +216,8 @@ ns_id_t zebra_ns_id_get(const char *netnspath, int fd_param)
nlh->nlmsg_len += NETLINK_ALIGN(sizeof(struct rtgenmsg));
rt->rtgen_family = AF_UNSPEC;
- addattr32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_FD, fd);
- addattr32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_NSID, ns_id);
+ nl_attr_put32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_FD, fd);
+ nl_attr_put32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_NSID, ns_id);
ret = send_receive(sock, nlh, seq, buf);
if (ret < 0) {
@@ -282,8 +282,9 @@ ns_id_t zebra_ns_id_get(const char *netnspath, int fd_param)
nlh->nlmsg_len += NETLINK_ALIGN(sizeof(struct rtgenmsg));
rt->rtgen_family = AF_UNSPEC;
- addattr32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_FD, fd);
- addattr32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_NSID, ns_id);
+ nl_attr_put32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_FD, fd);
+ nl_attr_put32(nlh, NETLINK_SOCKET_BUFFER_SIZE, NETNSA_NSID,
+ ns_id);
ret = send_receive(sock, nlh, seq, buf);
if (ret < 0) {