From: Jennifer Richards Date: Thu, 17 Nov 2016 16:12:12 +0000 (-0500) Subject: Add IPv6 support to tids. X-Git-Tag: v2.1.1~21 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=3f1e01bb27a9a3ba5c462d28203ff1336559c2d4;hp=63eae8581032880cbe406d7dbba94e82f01e754f;p=trust_router.git Add IPv6 support to tids. --- diff --git a/Makefile.am b/Makefile.am index ebd0e8f..a1ae178 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,13 @@ common_srcs = common/tr_name.c \ common/tr_msg.c \ common/tr_dh.c \ common/tr_debug.c \ - common/tr_util.c + common/tr_util.c \ + common/tr_apc.c \ + common/tr_comm.c \ + common/tr_rp.c \ + common/tr_idp.c \ + common/tr_filter.c \ + common/tr_gss.c tid_srcs = tid/tid_resp.c \ tid/tid_req.c \ diff --git a/tid/example/tids_main.c b/tid/example/tids_main.c index c334f41..9d4c879 100644 --- a/tid/example/tids_main.c +++ b/tid/example/tids_main.c @@ -203,10 +203,7 @@ static int tids_req_handler (TIDS_INSTANCE *tids, return -1; } - if (0 == inet_aton(tids->ipaddr, &(resp->servers->aaa_server_addr))) { - tr_debug("tids_req_handler: inet_aton() failed."); - return -1; - } + resp->servers->aaa_server_addr=tids->ipaddr; /* Set the key name */ if (-1 == create_key_id(key_id, sizeof(key_id))) @@ -348,8 +345,11 @@ int main (int argc, TIDS_INSTANCE *tids; TR_NAME *gssname = NULL; struct cmdline_args opts={NULL}; - int tids_socket=-1; - struct pollfd *poll_fds=NULL; +#define MAX_SOCKETS 10 + int tids_socket[MAX_SOCKETS]; + size_t n_sockets; + struct pollfd poll_fds[MAX_SOCKETS]; + size_t ii=0; /* parse the command line*/ argp_parse(&argp, argc, argv, 0, 0, &opts); @@ -383,25 +383,24 @@ int main (int argc, tids->ipaddr = opts.ip_address; /* get listener for tids port */ - tids_socket = tids_get_listener(tids, &tids_req_handler , auth_handler, opts.hostname, TID_PORT, gssname); + n_sockets = tids_get_listener(tids, &tids_req_handler, auth_handler, opts.hostname, TID_PORT, gssname, + tids_socket, MAX_SOCKETS); - poll_fds=malloc(sizeof(*poll_fds)); - if (poll_fds == NULL) { - tr_crit("Could not allocate event polling list, exiting."); - return 1; + for (ii=0; ii 0) { - if (poll_fds[0].revents & POLLIN) { - if (0 != tids_accept(tids, tids_socket)) { - tr_err("Error handling tids request."); + if(poll(poll_fds, n_sockets, 100) > 0) { + for (ii=0; ii