[hipl-commit] [tiny] Rev 3654: Simplified netlink message receiving.

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Wed, 10 Mar 2010 18:21:21 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: Wed Mar 10 17:20:41 2010 +0100
Revision: 3654
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Simplified netlink message receiving.
  
  Removed unused function parameters.

Modified:
  M  hipd/hipd.c
  M  hipd/netdev.c
  M  hipd/netdev.h
  M  lib/tool/nlink.c
  M  lib/tool/nlink.h

=== modified file 'hipd/hipd.c'
--- hipd/hipd.c 2010-03-09 16:53:56 +0000
+++ hipd/hipd.c 2010-03-10 16:20:41 +0000
@@ -459,8 +459,7 @@
             /* Something on IF and address event netlink socket,
              * fetch it. */
             HIP_DEBUG("netlink receive\n");
-            if (hip_netlink_receive(&hip_nl_ipsec,
-                                    hip_netdev_event, NULL)) {
+            if (hip_netlink_receive(&hip_nl_ipsec)) {
                 HIP_ERROR("Netlink receiving failed\n");
             }
         }
@@ -469,8 +468,7 @@
             /* Something on IF and address event netlink socket,
              * fetch it. */
             HIP_DEBUG("netlink route receive\n");
-            if (hip_netlink_receive(&hip_nl_route,
-                                    hip_netdev_event, NULL)) {
+            if (hip_netlink_receive(&hip_nl_route)) {
                 HIP_ERROR("Netlink receiving failed\n");
             }
         }

=== modified file 'hipd/netdev.c'
--- hipd/netdev.c       2010-03-05 17:28:01 +0000
+++ hipd/netdev.c       2010-03-10 16:20:41 +0000
@@ -1166,10 +1166,9 @@
  *
  * @param msg a netlink message
  * @param len the length of the netlink message in bytes
- * @param arg currently unused
  * @return zero on success and non-zero on error
  */
-int hip_netdev_event(const struct nlmsghdr *msg, int len, void *arg)
+int hip_netdev_event(const struct nlmsghdr *msg, int len)
 {
     int err = 0, l = 0, is_add = 0, exists;
     struct sockaddr_storage ss_addr;

=== modified file 'hipd/netdev.h'
--- hipd/netdev.h       2010-03-03 13:16:18 +0000
+++ hipd/netdev.h       2010-03-10 16:20:41 +0000
@@ -39,7 +39,7 @@
 int hip_devaddr2ifindex(struct in6_addr *addr);
 int hip_netdev_init_addresses(struct rtnl_handle *nl);
 void hip_delete_all_addresses(void);
-int hip_netdev_event(const struct nlmsghdr *msg, int len, void *arg);
+int hip_netdev_event(const struct nlmsghdr *msg, int len);
 int hip_add_iface_local_hit(const hip_hit_t *local_hit);
 int hip_add_iface_local_route(const hip_hit_t *local_hit);
 int hip_select_source_address(struct in6_addr *src, const struct in6_addr 
*dst);

=== modified file 'lib/tool/nlink.c'
--- lib/tool/nlink.c    2010-03-05 08:57:28 +0000
+++ lib/tool/nlink.c    2010-03-10 16:20:41 +0000
@@ -93,18 +93,13 @@
  * Retrieve a NETLINK message from a netlink-based file handle
  *
  * @param nl a netlink file handle
- * @param handler a function pointer to the function that handles the message
- *        parameter each by each
- * @param arg an extra value to be passed for the handler function
  * @return always zero
  * @note Unfortunately libnetlink does not provide a generic receive a
  * message function. This is a modified version of the rtnl_listen
  * function that processes only a finite amount of messages and then
  * returns.
  */
-int hip_netlink_receive(struct rtnl_handle *nl,
-                        hip_filter_t handler,
-                        void *arg)
+int hip_netlink_receive(struct rtnl_handle *nl)
 {
     struct nlmsghdr *h;
     struct sockaddr_nl nladdr;
@@ -178,7 +173,7 @@
                 return -1;
             }
 
-            err     = handler(h, len, arg);
+            err     = hip_netdev_event(h, len);
             if (err < 0) {
                 return err;
             }

=== modified file 'lib/tool/nlink.h'
--- lib/tool/nlink.h    2010-03-05 08:47:53 +0000
+++ lib/tool/nlink.h    2010-03-10 16:20:41 +0000
@@ -80,9 +80,7 @@
 int hip_netlink_open(struct rtnl_handle *nl,
                      unsigned subscriptions,
                      int protocol);
-int hip_netlink_receive(struct rtnl_handle *nl,
-                        hip_filter_t handler,
-                        void *arg);
+int hip_netlink_receive(struct rtnl_handle *nl);
 int rtnl_open_byproto(struct rtnl_handle *rth,
                       unsigned subscriptions,
                       int protocol);

Other related posts:

  • » [hipl-commit] [tiny] Rev 3654: Simplified netlink message receiving. - Tim Just