[hipl-commit] [tiny] Rev 3726: Removed dependency from lib/tool to hipd.

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Fri, 26 Mar 2010 17:59:47 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: 26/03/2010 at 17:59:47
Revision: 3726
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Removed dependency from lib/tool to hipd.
  
  This should fix OpenWRT and scratchbox builds.

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

=== modified file 'hipd/hip_socket.c'
--- hipd/hip_socket.c   2010-03-25 10:47:44 +0000
+++ hipd/hip_socket.c   2010-03-26 15:59:15 +0000
@@ -99,7 +99,8 @@
 static int hip_handle_nl_ipsec_sock(struct hip_packet_context *packet_ctx)
 {
     HIP_DEBUG("netlink receive\n");
-    if (hip_netlink_receive(&hip_nl_ipsec)) {
+    if (hip_netlink_receive(&hip_nl_ipsec,
+                            hip_netdev_event, NULL)) {
         HIP_ERROR("Netlink receiving failed\n");
         return -1;
     }
@@ -110,7 +111,8 @@
 static int hip_handle_nl_route_sock(struct hip_packet_context *packet_ctx)
 {
     HIP_DEBUG("netlink route receive\n");
-    if (hip_netlink_receive(&hip_nl_route)) {
+    if (hip_netlink_receive(&hip_nl_route,
+                            hip_netdev_event, NULL)) {
         HIP_ERROR("Netlink receiving failed\n");
         return -1;
     }

=== modified file 'hipd/netdev.c'
--- hipd/netdev.c       2010-03-19 14:29:54 +0000
+++ hipd/netdev.c       2010-03-26 15:59:15 +0000
@@ -1169,7 +1169,7 @@
  * @param len the length of the netlink message in bytes
  * @return zero on success and non-zero on error
  */
-int hip_netdev_event(const struct nlmsghdr *msg, int len)
+int hip_netdev_event(const struct nlmsghdr *msg, int len, void *arg)
 {
     int err = 0, l = 0, is_add = 0, exists;
     struct sockaddr_storage ss_addr;

=== modified file 'hipd/netdev.h'
--- hipd/netdev.h       2010-03-19 14:29:54 +0000
+++ hipd/netdev.h       2010-03-26 15:59:15 +0000
@@ -41,7 +41,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);
+int hip_netdev_event(const struct nlmsghdr *msg, int len, void *arg);
 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-19 14:29:54 +0000
+++ lib/tool/nlink.c    2010-03-26 15:59:15 +0000
@@ -37,7 +37,6 @@
 #include "config.h"
 #include "lib/core/hip_udp.h"
 #include "nlink.h"
-#include "hipd/netdev.h"
 
 /* New one to prevent netlink overrun */
 #if 0
@@ -95,13 +94,18 @@
  * 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)
+int hip_netlink_receive(struct rtnl_handle *nl,
+                        hip_filter_t handler,
+                        void *arg)
 {
     struct nlmsghdr *h;
     struct sockaddr_nl nladdr;
@@ -175,7 +179,7 @@
                 return -1;
             }
 
-            err     = hip_netdev_event(h, len);
+            err     = handler(h, len, arg);
             if (err < 0) {
                 return err;
             }

=== modified file 'lib/tool/nlink.h'
--- lib/tool/nlink.h    2010-03-11 08:07:12 +0000
+++ lib/tool/nlink.h    2010-03-26 15:59:15 +0000
@@ -81,7 +81,9 @@
 int hip_netlink_open(struct rtnl_handle *nl,
                      unsigned subscriptions,
                      int protocol);
-int hip_netlink_receive(struct rtnl_handle *nl);
+int hip_netlink_receive(struct rtnl_handle *nl,
+                        hip_filter_t handler,
+                        void *arg);
 int rtnl_open_byproto(struct rtnl_handle *rth,
                       unsigned subscriptions,
                       int protocol);

Other related posts:

  • » [hipl-commit] [tiny] Rev 3726: Removed dependency from lib/tool to hipd. - Tim Just