[hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 6343: remove hip_user_sock variable indirection

  • From: noreply@xxxxxxxxxxxxx
  • To: HIPL core team <hipl-dev@xxxxxxxxxxxxx>
  • Date: Tue, 20 Mar 2012 11:11:12 -0000

------------------------------------------------------------
revno: 6343
committer: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2012-03-20 12:09:54 +0100
message:
  remove hip_user_sock variable indirection
modified:
  hipd/hipd.c
  hipd/init.c
  hipd/maintenance.c
  hipd/maintenance.h


--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk

Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to 
https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'hipd/hipd.c'
--- hipd/hipd.c 2012-03-20 10:51:13 +0000
+++ hipd/hipd.c 2012-03-20 11:09:54 +0000
@@ -336,8 +336,6 @@
 
         hip_prepare_fd_set(&read_fdset);
 
-        hipfw_sock = hip_user_sock;
-
 #ifdef CONFIG_HIP_FIREWALL
         if (hipfw_status < 0) {
             hipfw_addr.sin6_family = AF_INET6;

=== modified file 'hipd/init.c'
--- hipd/init.c 2012-03-01 14:06:24 +0000
+++ hipd/init.c 2012-03-20 11:09:54 +0000
@@ -1055,8 +1055,6 @@
         HIP_IFEL(hip_set_lowcapability(), -1, "Failed to set capabilities\n");
     }
 
-    hipfw_sock_lsi_fd = hip_user_sock;
-
     if (hip_get_nsupdate_status()) {
         nsupdate(1);
     }

=== modified file 'hipd/maintenance.c'
--- hipd/maintenance.c  2012-03-20 10:51:13 +0000
+++ hipd/maintenance.c  2012-03-20 11:09:54 +0000
@@ -59,6 +59,7 @@
 #include "hadb.h"
 #include "hidb.h"
 #include "hipd.h"
+#include "hip_socket.h"
 #include "init.h"
 #include "input.h"
 #include "output.h"
@@ -71,11 +72,9 @@
     int      (*func_ptr)(void);
 };
 
-int hipfw_sock_lsi_fd = -1;
 int hipfw_status      = -1;
 
 struct sockaddr_in6 hipfw_addr = { 0 };
-int                 hipfw_sock = 0;
 
 static float precreate_counter  = HIP_R1_PRECREATE_INIT;
 static int   force_exit_counter = FORCE_EXIT_COUNTER_START;
@@ -356,7 +355,7 @@
 int hipfw_set_bex_data(int action, struct in6_addr *hit_s, struct in6_addr 
*hit_r)
 {
     struct hip_common *msg = NULL;
-    int                err = 0, n = 0, r_is_our;
+    int                err = 0, sent = 0, r_is_our;
 
     if (!hipfw_is_alive()) {
         goto out_err;
@@ -377,16 +376,13 @@
                                       r_is_our ? hit_r : hit_s, HIP_PARAM_HIT,
                                       sizeof(struct in6_addr)), -1, "build 
param contents failed\n");
 
-    n = sendto(hipfw_sock_lsi_fd,
-               (char *) msg,
-               hip_get_msg_total_len(msg),
-               0,
-               (struct sockaddr *) &hipfw_addr,
-               sizeof(struct sockaddr_in6));
-
-    HIP_IFEL(n < 0, -1, "Send to firewall failed. str errno %s\n", 
strerror(errno));
-
-    HIP_DEBUG("BEX DATA Send to firewall OK.\n");
+    sent = hip_sendto_firewall(msg);
+    if (sent < 0) {
+        HIP_PERROR("Send to firewall failed: ");
+        err = -1;
+        goto out_err;
+    }
+    HIP_DEBUG("Sent %d bytes to firewall.\n", sent);
 
 out_err:
     free(msg);
@@ -440,7 +436,7 @@
     HIP_DEBUG("CONFIG_HIP_FIREWALL DEFINED AND STATUS IS %d\n",
               hipfw_is_alive());
 
-    n = sendto(hipfw_sock,
+    n = sendto(hip_user_sock,
                msg,
                hip_get_msg_total_len(msg),
                0,

=== modified file 'hipd/maintenance.h'
--- hipd/maintenance.h  2011-12-29 18:37:45 +0000
+++ hipd/maintenance.h  2012-03-20 11:09:54 +0000
@@ -30,10 +30,7 @@
 #include <netinet/in.h>
 #include <sys/time.h>
 
-
-extern int hipfw_sock_lsi_fd;
 extern int hipfw_status;
-extern int hipfw_sock;
 
 int hip_register_maint_function(int (*maint_function)(void),
                                 const uint16_t priority);

Other related posts:

  • » [hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 6343: remove hip_user_sock variable indirection - noreply