diff options
author | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-12-03 19:07:32 +0000 |
---|---|---|
committer | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-12-03 19:07:32 +0000 |
commit | b2b6dc4587616ef3e18ba469ed17158b1099c4ee (patch) | |
tree | 8f11d70aa094f7c67fd6856b26ecf04c6050c3dd | |
parent | ce86cefa5e51082153e52b1a99e8f69f5242c012 (diff) | |
download | gnunet-b2b6dc4587616ef3e18ba469ed17158b1099c4ee.tar.gz gnunet-b2b6dc4587616ef3e18ba469ed17158b1099c4ee.zip |
Fix W32 interface listing, and correctly copy addr in test-nat (patch by LRN)
-rw-r--r-- | src/nat/test_nat.c | 20 | ||||
-rw-r--r-- | src/util/os_network.c | 4 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c index 6f2226929..c71623c2e 100644 --- a/src/nat/test_nat.c +++ b/src/nat/test_nat.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | struct addr_cls | 46 | struct addr_cls |
47 | { | 47 | { |
48 | const struct sockaddr *addr; | 48 | struct sockaddr *addr; |
49 | socklen_t addrlen; | 49 | socklen_t addrlen; |
50 | }; | 50 | }; |
51 | 51 | ||
@@ -76,22 +76,16 @@ process_if (void *cls, | |||
76 | { | 76 | { |
77 | struct addr_cls *data = cls; | 77 | struct addr_cls *data = cls; |
78 | 78 | ||
79 | if (addr) | 79 | if (addr && addrlen > 0) |
80 | { | 80 | { |
81 | data->addr = addr; | 81 | if (data->addr) |
82 | GNUNET_free (data->addr); | ||
83 | data->addr = memcpy (GNUNET_malloc (addrlen), addr, addrlen); | ||
82 | data->addrlen = addrlen; | 84 | data->addrlen = addrlen; |
85 | if (isDefault) | ||
86 | return GNUNET_SYSERR; | ||
83 | } | 87 | } |
84 | |||
85 | if (strcmp (name, "eth1") == 0 && addr->sa_family == AF_INET) | ||
86 | return GNUNET_SYSERR; | ||
87 | |||
88 | return GNUNET_OK; | 88 | return GNUNET_OK; |
89 | |||
90 | |||
91 | if (isDefault && addr) | ||
92 | return GNUNET_SYSERR; | ||
93 | else | ||
94 | return GNUNET_OK; | ||
95 | } | 89 | } |
96 | 90 | ||
97 | static void | 91 | static void |
diff --git a/src/util/os_network.c b/src/util/os_network.c index 453eea6f8..498f6ac9c 100644 --- a/src/util/os_network.c +++ b/src/util/os_network.c | |||
@@ -153,9 +153,9 @@ GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, | |||
153 | if (GNUNET_OK != | 153 | if (GNUNET_OK != |
154 | proc (proc_cls, | 154 | proc (proc_cls, |
155 | szEntry, | 155 | szEntry, |
156 | pAddrTable->table[dwIfIdx].dwIndex == dwExternalNIC, | 156 | pTable->table[dwIfIdx].dwIndex == dwExternalNIC, |
157 | (const struct sockaddr *) &sa, | 157 | (const struct sockaddr *) &sa, |
158 | 0)) | 158 | sizeof (sa))) |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | } | 161 | } |