aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/threads/stroke_interface.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2007-03-03 14:56:24 +0000
committerMartin Willi <martin@strongswan.org>2007-03-03 14:56:24 +0000
commit373b8a607f1238c69f87cd5e86d9a153526a021a (patch)
tree83f75902ec3a2a76e64a8b64f760ecb3c73b7677 /src/charon/threads/stroke_interface.c
parent285bbed59564541e26580ca9d1328b3ee1e701f4 (diff)
downloadstrongswan-373b8a607f1238c69f87cd5e86d9a153526a021a.tar.bz2
strongswan-373b8a607f1238c69f87cd5e86d9a153526a021a.tar.xz
fixed netlink socket receiver code
implemented interface enumeration code with netlink: no getifaddrs reqired anymore
Diffstat (limited to 'src/charon/threads/stroke_interface.c')
-rwxr-xr-xsrc/charon/threads/stroke_interface.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/charon/threads/stroke_interface.c b/src/charon/threads/stroke_interface.c
index c93712bc1..268fe56ca 100755
--- a/src/charon/threads/stroke_interface.c
+++ b/src/charon/threads/stroke_interface.c
@@ -200,6 +200,7 @@ static void stroke_add_conn(stroke_msg_t *msg, FILE *out)
host_t *my_vip = NULL, *other_vip = NULL;
proposal_t *proposal;
traffic_selector_t *my_ts, *other_ts;
+ char *interface;
pop_string(msg, &msg->add_conn.name);
pop_string(msg, &msg->add_conn.me.address);
@@ -253,8 +254,10 @@ static void stroke_add_conn(stroke_msg_t *msg, FILE *out)
my_host->destroy(my_host);
return;
}
-
- if (charon->socket->is_local_address(charon->socket, other_host, NULL))
+
+ interface = charon->kernel_interface->get_interface(charon->kernel_interface,
+ other_host);
+ if (interface)
{
stroke_end_t tmp_end;
host_t *tmp_host;
@@ -268,11 +271,18 @@ static void stroke_add_conn(stroke_msg_t *msg, FILE *out)
tmp_end = msg->add_conn.me;
msg->add_conn.me = msg->add_conn.other;
msg->add_conn.other = tmp_end;
+ free(interface);
}
- else if (!charon->socket->is_local_address(charon->socket, my_host, NULL))
+ if (!interface)
{
- DBG1(DBG_CFG, "left nor right host is our side, aborting\n");
- goto destroy_hosts;
+ interface = charon->kernel_interface->get_interface(
+ charon->kernel_interface, my_host);
+ if (!interface)
+ {
+ DBG1(DBG_CFG, "left nor right host is our side, aborting\n");
+ goto destroy_hosts;
+ }
+ free(interface);
}
my_id = identification_create_from_string(msg->add_conn.me.id ?
@@ -897,7 +907,7 @@ static void stroke_statusall(stroke_msg_t *msg, FILE *out)
charon->job_queue->get_count(charon->job_queue));
fprintf(out, " scheduled events: %d\n",
charon->event_queue->get_count(charon->event_queue));
- list = charon->socket->create_local_address_list(charon->socket);
+ list = charon->kernel_interface->create_address_list(charon->kernel_interface);
fprintf(out, "Listening on %d IP addresses:\n", list->get_count(list));
while (list->remove_first(list, (void**)&host) == SUCCESS)