[hipl-commit] [trunk] Rev 3634: rtnl_tab_initialize() is useless, removed.

  • From: Miika Komu <miika@xxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Mon, 15 Feb 2010 15:04:15 +0200

Committer: Miika Komu <miika@xxxxxx>
Date: Mon Feb 15 15:05:01 2010 +0200
Revision: 3634
Revision-id: miika@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  rtnl_tab_initialize() is useless, removed.

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

=== modified file 'hipd/netdev.c'
--- hipd/netdev.c       2010-02-12 10:47:40 +0000
+++ hipd/netdev.c       2010-02-15 13:05:01 +0000
@@ -1515,17 +1515,9 @@
 {
     int err                   = 0;
     int family                = AF_INET6;
-/* TODO: There is lots of commented code here delete it? */
-//     int rtnl_rtdsfield_init;
-//     char *rtnl_rtdsfield_tab[256] = { 0 };
     struct idxmap *idxmap[16] = { 0 };
     struct in6_addr lpback    = IN6ADDR_LOOPBACK_INIT;
 
-    /* rtnl_rtdsfield_initialize() */
-//     rtnl_rtdsfield_init = 1;
-
-//     rtnl_tab_initialize("/etc/iproute2/rt_dsfield", rtnl_rtdsfield_tab, 
256);
-
     _HIP_DEBUG_IN6ADDR("Source", src);
     HIP_DEBUG_IN6ADDR("dst", dst);
 
@@ -1588,14 +1580,12 @@
 
 int hip_get_default_lsi(struct in_addr *lsi)
 {
-    int err                       = 0, family = AF_INET, i;
-    char *rtnl_rtdsfield_tab[256] = { 0 };
+    int err                       = 0, family = AF_INET;
     struct idxmap *idxmap[16]     = { 0 };
     struct in6_addr lsi_addr;
     struct in6_addr lsi_aux6;
     hip_lsi_t lsi_tmpl;
 
-    rtnl_tab_initialize("/etc/iproute2/rt_dsfield", rtnl_rtdsfield_tab, 256);
     memset(&lsi_tmpl, 0, sizeof(lsi_tmpl));
     set_lsi_prefix(&lsi_tmpl);
     IPV4_TO_IPV6_MAP(&lsi_tmpl, &lsi_addr);
@@ -1608,12 +1598,6 @@
     }
 out_err:
 
-    for (i = 0; i < 256; i++) {
-        if (rtnl_rtdsfield_tab[i]) {
-            free(rtnl_rtdsfield_tab[i]);
-        }
-    }
-
     return err;
 }
 

=== modified file 'lib/tool/nlink.c'
--- lib/tool/nlink.c    2010-02-15 11:49:59 +0000
+++ lib/tool/nlink.c    2010-02-15 13:05:01 +0000
@@ -1377,47 +1377,6 @@
     return 0;
 }
 
-void rtnl_tab_initialize(char *file, char **tab, int size)
-{
-    char buf[512];
-    FILE *fp;
-
-    fp = fopen(file, "r");
-    if (!fp) {
-        return;
-    }
-
-    while (fgets(buf, sizeof(buf), fp)) {
-        char *p = buf;
-        int id;
-        char namebuf[512];
-
-        while (*p == ' ' || *p == '\t') {
-            p++;
-        }
-
-        if (*p == '#' || *p == '\n' || *p == 0) {
-            continue;
-        }
-
-        if (sscanf(p, "0x%x %s\n", &id, namebuf) != 2 &&
-            sscanf(p, "0x%x %s #", &id, namebuf) != 2 &&
-            sscanf(p, "%d %s\n", &id, namebuf) != 2 &&
-            sscanf(p, "%d %s #", &id, namebuf) != 2) {
-            HIP_ERROR("Database %s is corrupted at %s\n", file, p);
-            return;
-        }
-
-        if (id < 0 || id > size) {
-            continue;
-        }
-
-        tab[id] = strdup(namebuf);
-    }
-
-    fclose(fp);
-}
-
 int ll_remember_index(const struct sockaddr_nl *who,
                       struct nlmsghdr *n, void **arg)
 {

=== modified file 'lib/tool/nlink.h'
--- lib/tool/nlink.h    2010-02-11 00:01:07 +0000
+++ lib/tool/nlink.h    2010-02-15 13:05:01 +0000
@@ -95,8 +95,6 @@
                     const struct in6_addr *dst_addr, char *idev, char *odev,
                     int family, struct idxmap **idxmap);
 
-
-void rtnl_tab_initialize(char *file, char **tab, int size);
 int xfrm_init_lft(struct xfrm_lifetime_cfg *lft);
 int xfrm_fill_selector(struct xfrm_selector *sel,
                        const struct in6_addr *id_our,

Other related posts:

  • » [hipl-commit] [trunk] Rev 3634: rtnl_tab_initialize() is useless, removed. - Miika Komu