summaryrefslogtreecommitdiffstats
path: root/lib/route
diff options
context:
space:
mode:
Diffstat (limited to 'lib/route')
-rw-r--r--lib/route/addr.c29
-rw-r--r--lib/route/class.c20
-rw-r--r--lib/route/classifier.c35
-rw-r--r--lib/route/link.c24
-rw-r--r--lib/route/neigh.c39
-rw-r--r--lib/route/neightbl.c16
-rw-r--r--lib/route/qdisc.c34
-rw-r--r--lib/route/route.c22
-rw-r--r--lib/route/rtnl.c8
-rw-r--r--lib/route/rule.c23
10 files changed, 121 insertions, 129 deletions
diff --git a/lib/route/addr.c b/lib/route/addr.c
index 1edcd69..3e86bde 100644
--- a/lib/route/addr.c
+++ b/lib/route/addr.c
@@ -58,7 +58,7 @@
* // block until the operation has been completed. Alternatively the required
* // netlink message can be built using rtnl_addr_build_add_request() to be
* // sent out using nl_send_auto_complete().
- * rtnl_addr_add(handle, addr, 0);
+ * rtnl_addr_add(sk, addr, 0);
*
* // Free the memory
* rtnl_addr_put(addr);
@@ -99,7 +99,7 @@
* // block until the operation has been completed. Alternatively the required
* // netlink message can be built using rtnl_addr_build_delete_request()
* // to be sent out using nl_send_auto_complete().
- * rtnl_addr_delete(handle, addr, 0);
+ * rtnl_addr_delete(sk, addr, 0);
*
* // Free the memory
* rtnl_addr_put(addr);
@@ -297,9 +297,9 @@ errout_nomem:
goto errout;
}
-static int addr_request_update(struct nl_cache *cache, struct nl_handle *handle)
+static int addr_request_update(struct nl_cache *cache, struct nl_sock *sk)
{
- return nl_rtgen_request(handle, RTM_GETADDR, AF_UNSPEC, NLM_F_DUMP);
+ return nl_rtgen_request(sk, RTM_GETADDR, AF_UNSPEC, NLM_F_DUMP);
}
static int addr_dump_brief(struct nl_object *obj, struct nl_dump_params *p)
@@ -640,9 +640,9 @@ void rtnl_addr_put(struct rtnl_addr *addr)
* @{
*/
-int rtnl_addr_alloc_cache(struct nl_handle *sock, struct nl_cache **result)
+int rtnl_addr_alloc_cache(struct nl_sock *sk, struct nl_cache **result)
{
- return nl_cache_alloc_and_fill(&rtnl_addr_ops, sock, result);
+ return nl_cache_alloc_and_fill(&rtnl_addr_ops, sk, result);
}
/** @} */
@@ -742,7 +742,7 @@ int rtnl_addr_build_add_request(struct rtnl_addr *addr, int flags,
/**
* Request addition of new address
- * @arg handle Netlink handle.
+ * @arg sk Netlink socket.
* @arg addr Address object representing the new address.
* @arg flags Additional netlink message flags.
*
@@ -754,7 +754,7 @@ int rtnl_addr_build_add_request(struct rtnl_addr *addr, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_addr_add(struct nl_handle *handle, struct rtnl_addr *addr, int flags)
+int rtnl_addr_add(struct nl_sock *sk, struct rtnl_addr *addr, int flags)
{
struct nl_msg *msg;
int err;
@@ -762,12 +762,12 @@ int rtnl_addr_add(struct nl_handle *handle, struct rtnl_addr *addr, int flags)
if ((err = rtnl_addr_build_add_request(addr, flags, &msg)) < 0)
return err;
- err = nl_send_auto_complete(handle, msg);
+ err = nl_send_auto_complete(sk, msg);
nlmsg_free(msg);
if (err < 0)
return err;
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -814,7 +814,7 @@ int rtnl_addr_build_delete_request(struct rtnl_addr *addr, int flags,
/**
* Request deletion of an address
- * @arg handle Netlink handle.
+ * @arg sk Netlink socket.
* @arg addr Address object to be deleted.
* @arg flags Additional netlink message flags.
*
@@ -826,8 +826,7 @@ int rtnl_addr_build_delete_request(struct rtnl_addr *addr, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_addr_delete(struct nl_handle *handle, struct rtnl_addr *addr,
- int flags)
+int rtnl_addr_delete(struct nl_sock *sk, struct rtnl_addr *addr, int flags)
{
struct nl_msg *msg;
int err;
@@ -835,12 +834,12 @@ int rtnl_addr_delete(struct nl_handle *handle, struct rtnl_addr *addr,
if ((err = rtnl_addr_build_delete_request(addr, flags, &msg)) < 0)
return err;
- err = nl_send_auto_complete(handle, msg);
+ err = nl_send_auto_complete(sk, msg);
nlmsg_free(msg);
if (err < 0)
return err;
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
diff --git a/lib/route/class.c b/lib/route/class.c
index 9a1784f..cdf4232 100644
--- a/lib/route/class.c
+++ b/lib/route/class.c
@@ -64,15 +64,14 @@ errout:
return err;
}
-static int class_request_update(struct nl_cache *cache,
- struct nl_handle *handle)
+static int class_request_update(struct nl_cache *cache, struct nl_sock *sk)
{
struct tcmsg tchdr = {
.tcm_family = AF_UNSPEC,
.tcm_ifindex = cache->c_iarg1,
};
- return nl_send_simple(handle, RTM_GETTCLASS, NLM_F_DUMP, &tchdr,
+ return nl_send_simple(sk, RTM_GETTCLASS, NLM_F_DUMP, &tchdr,
sizeof(tchdr));
}
@@ -134,7 +133,7 @@ int rtnl_class_build_add_request(struct rtnl_class *class, int flags,
/**
* Add a new class
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg class class to delete
* @arg flags additional netlink message flags
*
@@ -147,8 +146,7 @@ int rtnl_class_build_add_request(struct rtnl_class *class, int flags,
*
* @return 0 on success or a negative error code
*/
-int rtnl_class_add(struct nl_handle *handle, struct rtnl_class *class,
- int flags)
+int rtnl_class_add(struct nl_sock *sk, struct rtnl_class *class, int flags)
{
struct nl_msg *msg;
int err;
@@ -156,11 +154,11 @@ int rtnl_class_add(struct nl_handle *handle, struct rtnl_class *class,
if ((err = rtnl_class_build_add_request(class, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -172,7 +170,7 @@ int rtnl_class_add(struct nl_handle *handle, struct rtnl_class *class,
/**
* Build a class cache including all classes attached to the specified interface
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg ifindex interface index of the link the classes are
* attached to.
*
@@ -181,7 +179,7 @@ int rtnl_class_add(struct nl_handle *handle, struct rtnl_class *class,
*
* @return The cache or NULL if an error has occured.
*/
-int rtnl_class_alloc_cache(struct nl_handle *handle, int ifindex,
+int rtnl_class_alloc_cache(struct nl_sock *sk, int ifindex,
struct nl_cache **result)
{
struct nl_cache * cache;
@@ -193,7 +191,7 @@ int rtnl_class_alloc_cache(struct nl_handle *handle, int ifindex,
cache->c_iarg1 = ifindex;
- if (handle && (err = nl_cache_refill(handle, cache)) < 0) {
+ if (sk && (err = nl_cache_refill(sk, cache)) < 0) {
nl_cache_free(cache);
return err;
}
diff --git a/lib/route/classifier.c b/lib/route/classifier.c
index 8008bc4..0f60358 100644
--- a/lib/route/classifier.c
+++ b/lib/route/classifier.c
@@ -75,7 +75,7 @@ errout:
return err;
}
-static int cls_request_update(struct nl_cache *cache, struct nl_handle *handle)
+static int cls_request_update(struct nl_cache *cache, struct nl_sock *sk)
{
struct tcmsg tchdr = {
.tcm_family = AF_UNSPEC,
@@ -83,7 +83,7 @@ static int cls_request_update(struct nl_cache *cache, struct nl_handle *handle)
.tcm_parent = cache->c_iarg2,
};
- return nl_send_simple(handle, RTM_GETTFILTER, NLM_F_DUMP, &tchdr,
+ return nl_send_simple(sk, RTM_GETTFILTER, NLM_F_DUMP, &tchdr,
sizeof(tchdr));
}
@@ -151,7 +151,7 @@ int rtnl_cls_build_add_request(struct rtnl_cls *cls, int flags,
/**
* Add a new classifier
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg cls classifier to add
* @arg flags additional netlink message flags
*
@@ -161,7 +161,7 @@ int rtnl_cls_build_add_request(struct rtnl_cls *cls, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_cls_add(struct nl_handle *handle, struct rtnl_cls *cls, int flags)
+int rtnl_cls_add(struct nl_sock *sk, struct rtnl_cls *cls, int flags)
{
struct nl_msg *msg;
int err;
@@ -169,11 +169,11 @@ int rtnl_cls_add(struct nl_handle *handle, struct rtnl_cls *cls, int flags)
if ((err = rtnl_cls_build_add_request(cls, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/**
@@ -197,7 +197,7 @@ int rtnl_cls_build_change_request(struct rtnl_cls *cls, int flags,
/**
* Change a classifier
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg cls classifier to change
* @arg flags additional netlink message flags
*
@@ -207,8 +207,7 @@ int rtnl_cls_build_change_request(struct rtnl_cls *cls, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_cls_change(struct nl_handle *handle, struct rtnl_cls *cls,
- int flags)
+int rtnl_cls_change(struct nl_sock *sk, struct rtnl_cls *cls, int flags)
{
struct nl_msg *msg;
int err;
@@ -216,11 +215,11 @@ int rtnl_cls_change(struct nl_handle *handle, struct rtnl_cls *cls,
if ((err = rtnl_cls_build_change_request(cls, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/**
@@ -245,7 +244,7 @@ int rtnl_cls_build_delete_request(struct rtnl_cls *cls, int flags,
/**
* Delete a classifier
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg cls classifier to delete
* @arg flags additional netlink message flags
*
@@ -255,7 +254,7 @@ int rtnl_cls_build_delete_request(struct rtnl_cls *cls, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_cls_delete(struct nl_handle *handle, struct rtnl_cls *cls, int flags)
+int rtnl_cls_delete(struct nl_sock *sk, struct rtnl_cls *cls, int flags)
{
struct nl_msg *msg;
int err;
@@ -263,11 +262,11 @@ int rtnl_cls_delete(struct nl_handle *handle, struct rtnl_cls *cls, int flags)
if ((err = rtnl_cls_build_delete_request(cls, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -280,7 +279,7 @@ int rtnl_cls_delete(struct nl_handle *handle, struct rtnl_cls *cls, int flags)
/**
* Build a classifier cache including all classifiers attached to the
* specified class/qdisc on eht specified interface.
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg ifindex interface index of the link the classes are
* attached to.
* @arg parent parent qdisc/class
@@ -293,7 +292,7 @@ int rtnl_cls_delete(struct nl_handle *handle, struct rtnl_cls *cls, int flags)
* cache after using it.
* @return 0 on success or a negative error code.
*/
-int rtnl_cls_alloc_cache(struct nl_handle *handle, int ifindex, uint32_t parent, struct nl_cache **result)
+int rtnl_cls_alloc_cache(struct nl_sock *sk, int ifindex, uint32_t parent, struct nl_cache **result)
{
struct nl_cache * cache;
int err;
@@ -304,7 +303,7 @@ int rtnl_cls_alloc_cache(struct nl_handle *handle, int ifindex, uint32_t parent,
cache->c_iarg1 = ifindex;
cache->c_iarg2 = parent;
- if (handle && (err = nl_cache_refill(handle, cache)) < 0) {
+ if (sk && (err = nl_cache_refill(sk, cache)) < 0) {
nl_cache_free(cache);
return err;
}
diff --git a/lib/route/link.c b/lib/route/link.c
index 510932f..34bc83b 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -78,7 +78,7 @@
* @code
* // The first step is to retrieve a list of all available interfaces within
* // the kernel and put them into a cache.
- * struct nl_cache *cache = rtnl_link_alloc_cache(nl_handle);
+ * struct nl_cache *cache = rtnl_link_alloc_cache(sk);
*
* // In a second step, a specific link may be looked up by either interface
* // index or interface name.
@@ -112,12 +112,12 @@
* // Two ways exist to commit this change request, the first one is to
* // build the required netlink message and send it out in one single
* // step:
- * rtnl_link_change(nl_handle, old, request);
+ * rtnl_link_change(sk, old, request);
*
* // An alternative way is to build the netlink message and send it
* // out yourself using nl_send_auto_complete()
* struct nl_msg *msg = rtnl_link_build_change_request(old, request);
- * nl_send_auto_complete(nl_handle, nlmsg_hdr(msg));
+ * nl_send_auto_complete(sk, nlmsg_hdr(msg));
* nlmsg_free(msg);
*
* // Don't forget to give back the link object ;->
@@ -427,9 +427,9 @@ errout:
return err;
}
-static int link_request_update(struct nl_cache *c, struct nl_handle *h)
+static int link_request_update(struct nl_cache *cache, struct nl_sock *sk)
{
- return nl_rtgen_request(h, RTM_GETLINK, AF_UNSPEC, NLM_F_DUMP);
+ return nl_rtgen_request(sk, RTM_GETLINK, AF_UNSPEC, NLM_F_DUMP);
}
static int link_dump_brief(struct nl_object *obj, struct nl_dump_params *p)
@@ -861,7 +861,7 @@ void rtnl_link_put(struct rtnl_link *link)
/**
* Allocate link cache and fill in all configured links.
- * @arg handle Netlink handle.
+ * @arg sk Netlink socket.
* @arg result Pointer to store resulting cache.
*
* Allocates a new link cache, initializes it properly and updates it
@@ -869,9 +869,9 @@ void rtnl_link_put(struct rtnl_link *link)
*
* @return 0 on success or a negative error code.
*/
-int rtnl_link_alloc_cache(struct nl_handle *sock, struct nl_cache **result)
+int rtnl_link_alloc_cache(struct nl_sock *sk, struct nl_cache **result)
{
- return nl_cache_alloc_and_fill(&rtnl_link_ops, sock, result);
+ return nl_cache_alloc_and_fill(&rtnl_link_ops, sk, result);
}
/**
@@ -1025,7 +1025,7 @@ nla_put_failure:
/**
* Change link attributes
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg old link to be changed
* @arg tmpl template with requested changes
* @arg flags additional netlink message flags
@@ -1038,7 +1038,7 @@ nla_put_failure:
* @note Not all attributes can be changed, see
* \ref link_changeable "Changeable Attributes" for more details.
*/
-int rtnl_link_change(struct nl_handle *handle, struct rtnl_link *old,
+int rtnl_link_change(struct nl_sock *sk, struct rtnl_link *old,
struct rtnl_link *tmpl, int flags)
{
struct nl_msg *msg;
@@ -1047,11 +1047,11 @@ int rtnl_link_change(struct nl_handle *handle, struct rtnl_link *old,
if ((err = rtnl_link_build_change_request(old, tmpl, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
diff --git a/lib/route/neigh.c b/lib/route/neigh.c
index 3c8fb1c..adb1596 100644
--- a/lib/route/neigh.c
+++ b/lib/route/neigh.c
@@ -61,7 +61,7 @@
* @code
* // The first step is to retrieve a list of all available neighbour within
* // the kernel and put them into a cache.
- * struct nl_cache *cache = rtnl_neigh_alloc_cache(handle);
+ * struct nl_cache *cache = rtnl_neigh_alloc_cache(sk);
*
* // Neighbours can then be looked up by the interface and destination
* // address:
@@ -86,7 +86,7 @@
* // block until the operation has been completed. Alternatively the required
* // netlink message can be built using rtnl_neigh_build_add_request()
* // to be sent out using nl_send_auto_complete().
- * rtnl_neigh_add(nl_handle, neigh, NLM_F_REPLACE);
+ * rtnl_neigh_add(sk, neigh, NLM_F_REPLACE);
*
* // Free the memory
* rtnl_neigh_put(neigh);
@@ -109,7 +109,7 @@
* // block until the operation has been completed. Alternatively the required
* // netlink message can be built using rtnl_neigh_build_delete_request()
* // to be sent out using nl_send_auto_complete().
- * rtnl_neigh_delete(handle, neigh, 0);
+ * rtnl_neigh_delete(sk, neigh, 0);
*
* // Free the memory
* rtnl_neigh_put(neigh);
@@ -139,7 +139,7 @@
* // block until the operation has been completed. Alternatively the required
* // netlink message can be built using rtnl_neigh_build_change_request()
* // to be sent out using nl_send_auto_complete().
- * rtnl_neigh_change(handle, neigh, 0);
+ * rtnl_neigh_change(sk, neigh, 0);
*
* // Free the memory
* rtnl_neigh_put(neigh);
@@ -327,7 +327,7 @@ errout:
return err;
}
-static int neigh_request_update(struct nl_cache *c, struct nl_handle *h)
+static int neigh_request_update(struct nl_cache *c, struct nl_sock *h)
{
return nl_rtgen_request(h, RTM_GETNEIGH, AF_UNSPEC, NLM_F_DUMP);
}
@@ -524,7 +524,7 @@ void rtnl_neigh_put(struct rtnl_neigh *neigh)
/**
* Build a neighbour cache including all neighbours currently configured in the kernel.
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg result Pointer to store resulting cache.
*
* Allocates a new neighbour cache, initializes it properly and updates it
@@ -532,7 +532,7 @@ void rtnl_neigh_put(struct rtnl_neigh *neigh)
*
* @return 0 on success or a negative error code.
*/
-int rtnl_neigh_alloc_cache(struct nl_handle *sock, struct nl_cache **result)
+int rtnl_neigh_alloc_cache(struct nl_sock *sock, struct nl_cache **result)
{
return nl_cache_alloc_and_fill(&rtnl_neigh_ops, sock, result);
}
@@ -629,7 +629,7 @@ int rtnl_neigh_build_add_request(struct rtnl_neigh *tmpl, int flags,
/**
* Add a new neighbour
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg tmpl template with requested changes
* @arg flags additional netlink message flags
*
@@ -645,7 +645,7 @@ int rtnl_neigh_build_add_request(struct rtnl_neigh *tmpl, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_neigh_add(struct nl_handle *handle, struct rtnl_neigh *tmpl, int flags)
+int rtnl_neigh_add(struct nl_sock *sk, struct rtnl_neigh *tmpl, int flags)
{
int err;
struct nl_msg *msg;
@@ -653,11 +653,11 @@ int rtnl_neigh_add(struct nl_handle *handle, struct rtnl_neigh *tmpl, int flags)
if ((err = rtnl_neigh_build_add_request(tmpl, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -689,7 +689,7 @@ int rtnl_neigh_build_delete_request(struct rtnl_neigh *neigh, int flags,
/**
* Delete a neighbour
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg neigh neighbour to delete
* @arg flags additional netlink message flags
*
@@ -699,7 +699,7 @@ int rtnl_neigh_build_delete_request(struct rtnl_neigh *neigh, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_neigh_delete(struct nl_handle *handle, struct rtnl_neigh *neigh,
+int rtnl_neigh_delete(struct nl_sock *sk, struct rtnl_neigh *neigh,
int flags)
{
struct nl_msg *msg;
@@ -708,11 +708,11 @@ int rtnl_neigh_delete(struct nl_handle *handle, struct rtnl_neigh *neigh,
if ((err = rtnl_neigh_build_delete_request(neigh, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -747,7 +747,7 @@ int rtnl_neigh_build_change_request(struct rtnl_neigh *neigh, int flags,
/**
* Change neighbour attributes
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg neigh neighbour to be changed
* @arg flags additional netlink message flags
*
@@ -759,8 +759,7 @@ int rtnl_neigh_build_change_request(struct rtnl_neigh *neigh, int flags,
* @note Not all attributes can be changed, see
* \ref neigh_changeable "Changeable Attributes" for a list.
*/
-int rtnl_neigh_change(struct nl_handle *handle, struct rtnl_neigh *neigh,
- int flags)
+int rtnl_neigh_change(struct nl_sock *sk, struct rtnl_neigh *neigh, int flags)
{
struct nl_msg *msg;
int err;
@@ -768,11 +767,11 @@ int rtnl_neigh_change(struct nl_handle *handle, struct rtnl_neigh *neigh,
if ((err = rtnl_neigh_build_change_request(neigh, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
diff --git a/lib/route/neightbl.c b/lib/route/neightbl.c
index 6010da0..e58aef6 100644
--- a/lib/route/neightbl.c
+++ b/lib/route/neightbl.c
@@ -226,7 +226,7 @@ errout:
return err;
}
-static int neightbl_request_update(struct nl_cache *c, struct nl_handle *h)
+static int neightbl_request_update(struct nl_cache *c, struct nl_sock *h)
{
return nl_rtgen_request(h, RTM_GETNEIGHTBL, AF_UNSPEC, NLM_F_DUMP);
}
@@ -394,7 +394,7 @@ void rtnl_neightbl_put(struct rtnl_neightbl *neightbl)
/**
* Build a neighbour table cache including all neighbour tables currently configured in the kernel.
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg result Pointer to store resulting cache.
*
* Allocates a new neighbour table cache, initializes it properly and
@@ -403,9 +403,9 @@ void rtnl_neightbl_put(struct rtnl_neightbl *neightbl)
*
* @return 0 on success or a negative error code.
*/
-int rtnl_neightbl_alloc_cache(struct nl_handle *sock, struct nl_cache **result)
+int rtnl_neightbl_alloc_cache(struct nl_sock *sk, struct nl_cache **result)
{
- return nl_cache_alloc_and_fill(&rtnl_neightbl_ops, sock, result);
+ return nl_cache_alloc_and_fill(&rtnl_neightbl_ops, sk, result);
}
/**
@@ -570,7 +570,7 @@ nla_put_failure:
/**
* Change neighbour table attributes
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg old neighbour table to be changed
* @arg tmpl template with requested changes
*
@@ -581,7 +581,7 @@ nla_put_failure:
*
* @return 0 on success or a negative error code
*/
-int rtnl_neightbl_change(struct nl_handle *handle, struct rtnl_neightbl *old,
+int rtnl_neightbl_change(struct nl_sock *sk, struct rtnl_neightbl *old,
struct rtnl_neightbl *tmpl)
{
struct nl_msg *msg;
@@ -590,11 +590,11 @@ int rtnl_neightbl_change(struct nl_handle *handle, struct rtnl_neightbl *old,
if ((err = rtnl_neightbl_build_change_request(old, tmpl, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
diff --git a/lib/route/qdisc.c b/lib/route/qdisc.c
index 8b2de2f..b23d72d 100644
--- a/lib/route/qdisc.c
+++ b/lib/route/qdisc.c
@@ -133,14 +133,14 @@ errout:
return err;
}
-static int qdisc_request_update(struct nl_cache *c, struct nl_handle *h)
+static int qdisc_request_update(struct nl_cache *c, struct nl_sock *sk)
{
struct tcmsg tchdr = {
.tcm_family = AF_UNSPEC,
.tcm_ifindex = c->c_iarg1,
};
- return nl_send_simple(h, RTM_GETQDISC, NLM_F_DUMP, &tchdr,
+ return nl_send_simple(sk, RTM_GETQDISC, NLM_F_DUMP, &tchdr,
sizeof(tchdr));
}
@@ -211,7 +211,7 @@ int rtnl_qdisc_build_add_request(struct rtnl_qdisc *qdisc, int flags,
/**
* Add a new qdisc
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg qdisc qdisc to delete
* @arg flags additional netlink message flags
*
@@ -224,7 +224,7 @@ int rtnl_qdisc_build_add_request(struct rtnl_qdisc *qdisc, int flags,
*
* @return 0 on success or a negative error code
*/
-int rtnl_qdisc_add(struct nl_handle *handle, struct rtnl_qdisc *qdisc,
+int rtnl_qdisc_add(struct nl_sock *sk, struct rtnl_qdisc *qdisc,
int flags)
{
struct nl_msg *msg;
@@ -233,11 +233,11 @@ int rtnl_qdisc_add(struct nl_handle *handle, struct rtnl_qdisc *qdisc,
if ((err = rtnl_qdisc_build_add_request(qdisc, flags, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -269,7 +269,7 @@ int rtnl_qdisc_build_change_request(struct rtnl_qdisc *qdisc,
/**
* Change attributes of a qdisc
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg qdisc qdisc to change
* @arg new new qdisc attributes
*
@@ -279,7 +279,7 @@ int rtnl_qdisc_build_change_request(struct rtnl_qdisc *qdisc,
*
* @return 0 on success or a negative error code
*/
-int rtnl_qdisc_change(struct nl_handle *handle, struct rtnl_qdisc *qdisc,
+int rtnl_qdisc_change(struct nl_sock *sk, struct rtnl_qdisc *qdisc,
struct rtnl_qdisc *new)
{
struct nl_msg *msg;
@@ -288,11 +288,11 @@ int rtnl_qdisc_change(struct nl_handle *handle, struct rtnl_qdisc *qdisc,
if ((err = rtnl_qdisc_build_change_request(qdisc, new, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -343,7 +343,7 @@ int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *qdisc,
/**
* Delete a qdisc
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg qdisc qdisc to delete
*
* Builds a netlink message by calling rtnl_qdisc_build_delete_request(),
@@ -352,7 +352,7 @@ int rtnl_qdisc_build_delete_request(struct rtnl_qdisc *qdisc,
*
* @return 0 on success or a negative error code
*/
-int rtnl_qdisc_delete(struct nl_handle *handle, struct rtnl_qdisc *qdisc)
+int rtnl_qdisc_delete(struct nl_sock *sk, struct rtnl_qdisc *qdisc)
{
struct nl_msg *msg;
int err;
@@ -360,11 +360,11 @@ int rtnl_qdisc_delete(struct nl_handle *handle, struct rtnl_qdisc *qdisc)
if ((err = rtnl_qdisc_build_delete_request(qdisc, &msg)) < 0)
return err;
- if ((err = nl_send_auto_complete(handle, msg)) < 0)
+ if ((err = nl_send_auto_complete(sk, msg)) < 0)
return err;
nlmsg_free(msg);
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -377,7 +377,7 @@ int rtnl_qdisc_delete(struct nl_handle *handle, struct rtnl_qdisc *qdisc)
/**
* Build a qdisc cache including all qdiscs currently configured in
* the kernel
- * @arg sock netlink handle
+ * @arg sk Netlink socket.
* @arg result Pointer to store resulting message.
*
* Allocates a new cache, initializes it properly and updates it to
@@ -385,9 +385,9 @@ int rtnl_qdisc_delete(struct nl_handle *handle, struct rtnl_qdisc *qdisc)
*
* @return 0 on success or a negative error code.
*/
-int rtnl_qdisc_alloc_cache(struct nl_handle *sock, struct nl_cache **result)
+int rtnl_qdisc_alloc_cache(struct nl_sock *sk, struct nl_cache **result)
{
- return nl_cache_alloc_and_fill(&rtnl_qdisc_ops, sock, result);
+ return nl_cache_alloc_and_fill(&rtnl_qdisc_ops, sk, result);
}
/**
diff --git a/lib/route/route.c b/lib/route/route.c
index 823d695..1c13e6e 100644
--- a/lib/route/route.c
+++ b/lib/route/route.c
@@ -46,7 +46,7 @@ errout:
return err;
}
-static int route_request_update(struct nl_cache *c, struct nl_handle *h)
+static int route_request_update(struct nl_cache *c, struct nl_sock *h)
{
struct rtmsg rhdr = {
.rtm_family = c->c_iarg1,
@@ -65,7 +65,7 @@ static int route_request_update(struct nl_cache *c, struct nl_handle *h)
/**
* Build a route cache holding all routes currently configured in the kernel
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg family Address family of routes to cover or AF_UNSPEC
* @arg flags Flags
*
@@ -76,7 +76,7 @@ static int route_request_update(struct nl_cache *c, struct nl_handle *h)
* cache after using it.
* @return The cache or NULL if an error has occured.
*/
-int rtnl_route_alloc_cache(struct nl_handle *handle, int family, int flags,
+int rtnl_route_alloc_cache(struct nl_sock *sk, int family, int flags,
struct nl_cache **result)
{
struct nl_cache *cache;
@@ -88,7 +88,7 @@ int rtnl_route_alloc_cache(struct nl_handle *handle, int family, int flags,
cache->c_iarg1 = family;
cache->c_iarg2 = flags;
- if (handle && (err = nl_cache_refill(handle, cache)) < 0) {
+ if (sk && (err = nl_cache_refill(sk, cache)) < 0) {
free(cache);
return err;
}
@@ -129,8 +129,7 @@ int rtnl_route_build_add_request(struct rtnl_route *tmpl, int flags,
result);
}
-int rtnl_route_add(struct nl_handle *handle, struct rtnl_route *route,
- int flags)
+int rtnl_route_add(struct nl_sock *sk, struct rtnl_route *route, int flags)
{
struct nl_msg *msg;
int err;
@@ -138,12 +137,12 @@ int rtnl_route_add(struct nl_handle *handle, struct rtnl_route *route,
if ((err = rtnl_route_build_add_request(route, flags, &msg)) < 0)
return err;
- err = nl_send_auto_complete(handle, msg);
+ err = nl_send_auto_complete(sk, msg);
nlmsg_free(msg);
if (err < 0)
return err;
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
int rtnl_route_build_del_request(struct rtnl_route *tmpl, int flags,
@@ -152,8 +151,7 @@ int rtnl_route_build_del_request(struct rtnl_route *tmpl, int flags,
return build_route_msg(tmpl, RTM_DELROUTE, flags, result);
}
-int rtnl_route_delete(struct nl_handle *handle, struct rtnl_route *route,
- int flags)
+int rtnl_route_delete(struct nl_sock *sk, struct rtnl_route *route, int flags)
{
struct nl_msg *msg;
int err;
@@ -161,12 +159,12 @@ int rtnl_route_delete(struct nl_handle *handle, struct rtnl_route *route,
if ((err = rtnl_route_build_del_request(route, flags, &msg)) < 0)
return err;
- err = nl_send_auto_complete(handle, msg);
+ err = nl_send_auto_complete(sk, msg);
nlmsg_free(msg);
if (err < 0)
return err;
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
diff --git a/lib/route/rtnl.c b/lib/route/rtnl.c
index 81ddf94..f87c5f5 100644
--- a/lib/route/rtnl.c
+++ b/lib/route/rtnl.c
@@ -6,7 +6,7 @@
* License as published by the Free Software Foundation version 2.1
* of the License.
*
- * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
*/
/**
@@ -27,7 +27,7 @@
/**
* Send routing netlink request message
- * @arg handle Netlink handle.
+ * @arg sk Netlink socket.
* @arg type Netlink message type.
* @arg family Address family.
* @arg flags Additional netlink message flags.
@@ -37,13 +37,13 @@
*
* @return 0 on success or a negative error code.
*/
-int nl_rtgen_request(struct nl_handle *handle, int type, int family, int flags)
+int nl_rtgen_request(struct nl_sock *sk, int type, int family, int flags)
{
struct rtgenmsg gmsg = {
.rtgen_family = family,
};
- return nl_send_simple(handle, type, flags, &gmsg, sizeof(gmsg));
+ return nl_send_simple(sk, type, flags, &gmsg, sizeof(gmsg));
}
/** @} */
diff --git a/lib/route/rule.c b/lib/route/rule.c
index 4d3c629..00163b0 100644
--- a/lib/route/rule.c
+++ b/lib/route/rule.c
@@ -169,7 +169,7 @@ errout_enomem:
goto errout;
}
-static int rule_request_update(struct nl_cache *c, struct nl_handle *h)
+static int rule_request_update(struct nl_cache *c, struct nl_sock *h)
{
return nl_rtgen_request(h, RTM_GETRULE, AF_UNSPEC, NLM_F_DUMP);
}
@@ -435,7 +435,7 @@ void rtnl_rule_put(struct rtnl_rule *rule)
/**
* Build a rule cache including all rules currently configured in the kernel.
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg family Address family or AF_UNSPEC.
* @arg result Pointer to store resulting cache.
*
@@ -444,7 +444,7 @@ void rtnl_rule_put(struct rtnl_rule *rule)
*
* @return 0 on success or a negative error code.
*/
-int rtnl_rule_alloc_cache(struct nl_handle *sock, int family,
+int rtnl_rule_alloc_cache(struct nl_sock *sock, int family,
struct nl_cache **result)
{
struct nl_cache * cache;
@@ -555,7 +555,7 @@ int rtnl_rule_build_add_request(struct rtnl_rule *tmpl, int flags,
/**
* Add a new rule
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg tmpl template with requested changes
* @arg flags additional netlink message flags
*
@@ -565,7 +565,7 @@ int rtnl_rule_build_add_request(struct rtnl_rule *tmpl, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_rule_add(struct nl_handle *handle, struct rtnl_rule *tmpl, int flags)
+int rtnl_rule_add(struct nl_sock *sk, struct rtnl_rule *tmpl, int flags)
{
struct nl_msg *msg;
int err;
@@ -573,12 +573,12 @@ int rtnl_rule_add(struct nl_handle *handle, struct rtnl_rule *tmpl, int flags)
if ((err = rtnl_rule_build_add_request(tmpl, flags, &msg)) < 0)
return err;
- err = nl_send_auto_complete(handle, msg);
+ err = nl_send_auto_complete(sk, msg);
nlmsg_free(msg);
if (err < 0)
return err;
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */
@@ -609,7 +609,7 @@ int rtnl_rule_build_delete_request(struct rtnl_rule *rule, int flags,
/**
* Delete a rule
- * @arg handle netlink handle
+ * @arg sk Netlink socket.
* @arg rule rule to delete
* @arg flags additional netlink message flags
*
@@ -619,8 +619,7 @@ int rtnl_rule_build_delete_request(struct rtnl_rule *rule, int flags,
*
* @return 0 on sucess or a negative error if an error occured.
*/
-int rtnl_rule_delete(struct nl_handle *handle, struct rtnl_rule *rule,
- int flags)
+int rtnl_rule_delete(struct nl_sock *sk, struct rtnl_rule *rule, int flags)
{
struct nl_msg *msg;
int err;
@@ -628,12 +627,12 @@ int rtnl_rule_delete(struct nl_handle *handle, struct rtnl_rule *rule,
if ((err = rtnl_rule_build_delete_request(rule, flags, &msg)) < 0)
return err;
- err = nl_send_auto_complete(handle, msg);
+ err = nl_send_auto_complete(sk, msg);
nlmsg_free(msg);
if (err < 0)
return err;
- return nl_wait_for_ack(handle);
+ return nl_wait_for_ack(sk);
}
/** @} */