From: Jennifer Richards Date: Fri, 25 May 2018 15:57:51 +0000 (-0400) Subject: Normalize port naming (tids_, trps_, and mons_port) and use signed int X-Git-Tag: 3.4.0~1^2~18^2~9 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=commitdiff_plain;h=fe3b5cb31ab0d19c2ead6465f82ceb749bf05b75 Normalize port naming (tids_, trps_, and mons_port) and use signed int This cleans up the port names in various functions and data structures. Tries to get rid of ambiguous "port" fields. A few changes will be in the next commit which has some functional updates as well. --- diff --git a/common/tr_config_internal.c b/common/tr_config_internal.c index d06dc51..b8d3bbb 100644 --- a/common/tr_config_internal.c +++ b/common/tr_config_internal.c @@ -150,7 +150,7 @@ static void set_defaults(TR_CFG_INTERNAL *cfg) cfg->max_tree_depth = TR_DEFAULT_MAX_TREE_DEPTH; cfg->tids_port = TR_DEFAULT_TIDS_PORT; cfg->trps_port = TR_DEFAULT_TRPS_PORT; - cfg->monitoring_port = TR_DEFAULT_MONITORING_PORT; + cfg->mons_port = TR_DEFAULT_MONITORING_PORT; cfg->cfg_poll_interval = TR_CFGWATCH_DEFAULT_POLL; cfg->cfg_settling_time = TR_CFGWATCH_DEFAULT_SETTLE; cfg->trp_connect_interval = TR_DEFAULT_TRP_CONNECT_INTERVAL; @@ -177,7 +177,7 @@ static TR_CFG_RC tr_cfg_parse_monitoring(TR_CFG *trc, json_t *jmon) NOPARSE_UNLESS(tr_cfg_parse_boolean(jmon, "enabled", &enabled)); if (enabled) { - NOPARSE_UNLESS(tr_cfg_parse_unsigned(jmon, "port", &(trc->internal->monitoring_port))); + NOPARSE_UNLESS(tr_cfg_parse_unsigned(jmon, "port", &(trc->internal->mons_port))); NOPARSE_UNLESS(tr_cfg_parse_gss_names(trc->internal, json_object_get(jmon, "authorized_credentials"), &(trc->internal->monitoring_credentials))); diff --git a/common/tr_gss_client.c b/common/tr_gss_client.c index 7b61acb..f45af3a 100644 --- a/common/tr_gss_client.c +++ b/common/tr_gss_client.c @@ -68,10 +68,15 @@ void tr_gssc_instance_free(TR_GSSC_INSTANCE *tr_gssc) * @param port TCP port to connect * @return 0 on success, -1 on failure */ -int tr_gssc_open_connection(TR_GSSC_INSTANCE *gssc, const char *server, unsigned int port) +int tr_gssc_open_connection(TR_GSSC_INSTANCE *gssc, const char *server, int port) { + if ((port <= 0) || (port > 65535)) { + tr_err("tr_gssc_open_connection: invalid port requested (%d)", port); + return -1; + } + tr_debug("tr_gssc_open_connection: opening connection to %s:%d", server, port); - if (0 != gsscon_connect(server, port, gssc->service_name, &(gssc->conn), gssc->gss_ctx)) + if (0 != gsscon_connect(server, (unsigned int) port, gssc->service_name, &(gssc->conn), gssc->gss_ctx)) return -1; return 0; /* success */ diff --git a/common/tr_socket.c b/common/tr_socket.c index 1bb3cc2..a45ff31 100644 --- a/common/tr_socket.c +++ b/common/tr_socket.c @@ -55,7 +55,7 @@ * @param max_fd maximum number of file descriptors to write * @return number of file descriptors written into the output array */ -nfds_t tr_sock_listen_all(unsigned int port, int *fd_out, nfds_t max_fd) +nfds_t tr_sock_listen_all(int port, int *fd_out, nfds_t max_fd) { int rc = 0; int conn = -1; diff --git a/include/mon_internal.h b/include/mon_internal.h index 6e42750..6d94a60 100644 --- a/include/mon_internal.h +++ b/include/mon_internal.h @@ -127,7 +127,7 @@ struct mon_resp { /* Monitoring server instance */ struct mons_instance { const char *hostname; - unsigned int port; + int mon_port; TR_GSS_NAMES *authorized_gss_names; TIDS_INSTANCE *tids; TRPS_INSTANCE *trps; @@ -178,14 +178,20 @@ MON_RESP * mon_resp_decode(TALLOC_CTX *mem_ctx, json_t *resp_json); /* mons.c */ MONS_INSTANCE *mons_new(TALLOC_CTX *mem_ctx); -int mons_get_listener(MONS_INSTANCE *mons, MONS_REQ_FUNC *req_handler, MONS_AUTH_FUNC *auth_handler, const char *hostname, - unsigned int port, void *cookie, int *fd_out, size_t max_fd); +int mons_get_listener(MONS_INSTANCE *mons, + MONS_REQ_FUNC *req_handler, + MONS_AUTH_FUNC *auth_handler, + const char *hostname, + int port, + void *cookie, + int *fd_out, + size_t max_fd); int mons_accept(MONS_INSTANCE *mons, int listen); /* monc.c */ MONC_INSTANCE *monc_new(TALLOC_CTX *mem_ctx); void monc_free(MONC_INSTANCE *monc); -int monc_open_connection(MONC_INSTANCE *monc, const char *server, unsigned int port); +int monc_open_connection(MONC_INSTANCE *monc, const char *server, int port); MON_RESP *monc_send_request(TALLOC_CTX *mem_ctx, MONC_INSTANCE *monc, MON_REQ *req); #endif //TRUST_ROUTER_MON_REQ_H diff --git a/include/tid_internal.h b/include/tid_internal.h index ecaf647..220775b 100644 --- a/include/tid_internal.h +++ b/include/tid_internal.h @@ -104,7 +104,7 @@ struct tids_instance { TIDS_REQ_FUNC *req_handler; tids_auth_func *auth_handler; void *cookie; - unsigned int tids_port; + int tids_port; TR_NAME *gss_name; /* GSS name client used for authentication */ GArray *pids; /* PIDs of active tids processes */ }; @@ -114,7 +114,7 @@ struct tids_instance { reference they already hold to the TID_REQ.*/ void tid_req_cleanup_json(TID_REQ *, json_t *json); -int tid_req_add_path(TID_REQ *, const char *this_system, unsigned port); +int tid_req_add_path(TID_REQ *req, const char *this_system, int port); TID_SRVR_BLK *tid_srvr_blk_new(TALLOC_CTX *mem_ctx); void tid_srvr_blk_free(TID_SRVR_BLK *srvr); diff --git a/include/tr_config.h b/include/tr_config.h index 8dc66c4..47be960 100644 --- a/include/tr_config.h +++ b/include/tr_config.h @@ -76,9 +76,9 @@ typedef enum tr_cfg_rc { typedef struct tr_cfg_internal { unsigned int max_tree_depth; - unsigned int tids_port; - unsigned int trps_port; - unsigned int monitoring_port; + int tids_port; + int trps_port; + int mons_port; const char *hostname; int log_threshold; int console_threshold; diff --git a/include/tr_gss_client.h b/include/tr_gss_client.h index 3353184..2b24200 100644 --- a/include/tr_gss_client.h +++ b/include/tr_gss_client.h @@ -50,7 +50,7 @@ struct tr_gssc_instance { /* tr_gss_client.c */ TR_GSSC_INSTANCE *tr_gssc_instance_new(TALLOC_CTX *mem_ctx); void tr_gssc_instance_free(TR_GSSC_INSTANCE *tr_gssc); -int tr_gssc_open_connection(TR_GSSC_INSTANCE *gssc, const char *server, unsigned int port); +int tr_gssc_open_connection(TR_GSSC_INSTANCE *gssc, const char *server, int port); TR_MSG *tr_gssc_exchange_msgs(TALLOC_CTX *mem_ctx, TR_GSSC_INSTANCE *gssc, TR_MSG *req_msg); #endif //TRUST_ROUTER_TR_GSS_CLIENT_H diff --git a/include/tr_socket.h b/include/tr_socket.h index e90a912..73c8d15 100644 --- a/include/tr_socket.h +++ b/include/tr_socket.h @@ -39,7 +39,7 @@ #include // for nfds_t #include -nfds_t tr_sock_listen_all(unsigned int port, int *fd_out, nfds_t max_fd); +nfds_t tr_sock_listen_all(int port, int *fd_out, nfds_t max_fd); int tr_sock_accept(int sock); #endif //TRUST_ROUTER_TR_SOCKET_H diff --git a/include/trp_internal.h b/include/trp_internal.h index b48706c..0655a62 100644 --- a/include/trp_internal.h +++ b/include/trp_internal.h @@ -140,7 +140,7 @@ struct trpc_instance { TRPC_INSTANCE *next; TR_NAME *gssname; char *server; - unsigned int port; + int port; TRP_CONNECTION *conn; TR_MQ *mq; /* msgs from master to trpc */ }; @@ -148,7 +148,8 @@ struct trpc_instance { /* TRP Server Instance Data */ struct trps_instance { char *hostname; - unsigned int port; + int trps_port; + int tids_port; /* used for route advertisements; must agree with our tids configuration */ TRP_AUTH_FUNC auth_handler; TRPS_MSG_FUNC msg_handler; void *cookie; @@ -189,7 +190,7 @@ TRP_CONNECTION *trp_connection_remove(TRP_CONNECTION *conn, TRP_CONNECTION *remo void trp_connection_append(TRP_CONNECTION *conn, TRP_CONNECTION *new); int trp_connection_auth(TRP_CONNECTION *conn, TRP_AUTH_FUNC auth_callback, void *callback_data); TRP_CONNECTION *trp_connection_accept(TALLOC_CTX *mem_ctx, int listen, TR_NAME *gss_servicename); -TRP_RC trp_connection_initiate(TRP_CONNECTION *conn, char *server, unsigned int port); +TRP_RC trp_connection_initiate(TRP_CONNECTION *conn, char *server, int port); TRPC_INSTANCE *trpc_new (TALLOC_CTX *mem_ctx); void trpc_free (TRPC_INSTANCE *trpc); @@ -204,7 +205,7 @@ void trpc_set_server(TRPC_INSTANCE *trpc, char *server); TR_NAME *trpc_get_gssname(TRPC_INSTANCE *trpc); void trpc_set_gssname(TRPC_INSTANCE *trpc, TR_NAME *gssname); unsigned int trpc_get_port(TRPC_INSTANCE *trpc); -void trpc_set_port(TRPC_INSTANCE *trpc, unsigned int port); +void trpc_set_port(TRPC_INSTANCE *trpc, int port); TRP_CONNECTION_STATUS trpc_get_status(TRPC_INSTANCE *trpc); TR_MQ *trpc_get_mq(TRPC_INSTANCE *trpc); void trpc_set_mq(TRPC_INSTANCE *trpc, TR_MQ *mq); @@ -240,7 +241,7 @@ int trps_get_listener(TRPS_INSTANCE *trps, TRPS_MSG_FUNC msg_handler, TRP_AUTH_FUNC auth_handler, const char *hostname, - unsigned int port, + int port, void *cookie, int *fd_out, size_t max_fd); diff --git a/include/trp_peer.h b/include/trp_peer.h index 8886bef..557e2a3 100644 --- a/include/trp_peer.h +++ b/include/trp_peer.h @@ -50,7 +50,7 @@ struct trp_peer { char *server; TR_GSS_NAMES *gss_names; TR_NAME *servicename; - unsigned int port; + int port; unsigned int linkcost; struct timespec last_conn_attempt; TRP_PEER_CONN_STATUS outgoing_status; @@ -73,8 +73,8 @@ void trp_peer_set_gss_names(TRP_PEER *peer, TR_GSS_NAMES *gss_names); TR_GSS_NAMES *trp_peer_get_gss_names(TRP_PEER *peer); TR_NAME *trp_peer_get_servicename(TRP_PEER *peer); TR_NAME *trp_peer_dup_servicename(TRP_PEER *peer); -unsigned int trp_peer_get_port(TRP_PEER *peer); -void trp_peer_set_port(TRP_PEER *peer, unsigned int port); +int trp_peer_get_port(TRP_PEER *peer); +void trp_peer_set_port(TRP_PEER *peer, int port); unsigned int trp_peer_get_linkcost(TRP_PEER *peer); struct timespec *trp_peer_get_last_conn_attempt(TRP_PEER *peer); void trp_peer_set_last_conn_attempt(TRP_PEER *peer, struct timespec *time); diff --git a/include/trust_router/tid.h b/include/trust_router/tid.h index 38833f1..33f530c 100644 --- a/include/trust_router/tid.h +++ b/include/trust_router/tid.h @@ -148,7 +148,7 @@ TR_EXPORT int tid_srvr_get_key_expiration(const TID_SRVR_BLK *, struct timeval * /* TID Client functions, in tid/tidc.c */ TR_EXPORT TIDC_INSTANCE *tidc_create (void); -TR_EXPORT int tidc_open_connection (TIDC_INSTANCE *tidc, const char *server, unsigned int port, gss_ctx_id_t *gssctx); +TR_EXPORT int tidc_open_connection(TIDC_INSTANCE *tidc, const char *server, int port, gss_ctx_id_t *gssctx); TR_EXPORT int tidc_send_request (TIDC_INSTANCE *tidc, int conn, gss_ctx_id_t gssctx, const char *rp_realm, const char *realm, const char *coi, TIDC_RESP_FUNC *resp_handler, void *cookie); TR_EXPORT int tidc_fwd_request (TIDC_INSTANCE *tidc, TID_REQ *req, TIDC_RESP_FUNC *resp_handler, void *cookie); TR_EXPORT DH *tidc_get_dh(TIDC_INSTANCE *); @@ -158,12 +158,12 @@ TR_EXPORT void tidc_destroy(TIDC_INSTANCE *tidc); /* TID Server functions, in tid/tids.c */ TIDS_INSTANCE *tids_new(TALLOC_CTX *mem_ctx); TR_EXPORT TIDS_INSTANCE *tids_create (void); -TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, - tids_auth_func *auth_handler, const char *hostname, - unsigned int port, void *cookie); +TR_EXPORT int tids_start(TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, + tids_auth_func *auth_handler, const char *hostname, + int port, void *cookie); TR_EXPORT nfds_t tids_get_listener(TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, tids_auth_func *auth_handler, const char *hostname, - unsigned int port, void *cookie, int *fd_out, size_t max_fd); + int port, void *cookie, int *fd_out, size_t max_fd); TR_EXPORT int tids_accept(TIDS_INSTANCE *tids, int listen); TR_EXPORT int tids_send_response (TIDS_INSTANCE *tids, TID_REQ *req, TID_RESP *resp); TR_EXPORT int tids_send_err_response (TIDS_INSTANCE *tids, TID_REQ *req, const char *err_msg); diff --git a/include/trust_router/trp.h b/include/trust_router/trp.h index d0020a0..b650cf8 100644 --- a/include/trust_router/trp.h +++ b/include/trust_router/trp.h @@ -91,7 +91,7 @@ void trp_upd_set_comm(TRP_UPD *upd, TR_NAME *comm); TR_EXPORT TR_NAME *trp_upd_get_peer(TRP_UPD *upd); TR_NAME *trp_upd_dup_peer(TRP_UPD *upd); void trp_upd_set_peer(TRP_UPD *upd, TR_NAME *peer); -void trp_upd_set_next_hop(TRP_UPD *upd, const char *hostname, unsigned int port); +void trp_upd_set_next_hop(TRP_UPD *upd, const char *hostname, int port); void trp_upd_add_to_provenance(TRP_UPD *upd, TR_NAME *name); /* Functions for TRP_REQ structures */ diff --git a/mon/monc.c b/mon/monc.c index 6e5b26a..c16d328 100644 --- a/mon/monc.c +++ b/mon/monc.c @@ -65,7 +65,7 @@ void monc_free(MONC_INSTANCE *monc) int monc_open_connection(MONC_INSTANCE *monc, const char *server, - unsigned int port) + int port) { return tr_gssc_open_connection(monc->gssc, server, port); } diff --git a/mon/mons.c b/mon/mons.c index 1d157af..c2f6ca0 100644 --- a/mon/mons.c +++ b/mon/mons.c @@ -73,7 +73,7 @@ MONS_INSTANCE *mons_new(TALLOC_CTX *mem_ctx) if (mons) { mons->hostname = NULL; - mons->port = 0; + mons->mon_port = 0; mons->tids = NULL; mons->trps = NULL; mons->req_handler = NULL; @@ -175,13 +175,19 @@ cleanup: * @param max_fd * @return */ -int mons_get_listener(MONS_INSTANCE *mons, MONS_REQ_FUNC *req_handler, MONS_AUTH_FUNC *auth_handler, const char *hostname, - unsigned int port, void *cookie, int *fd_out, size_t max_fd) +int mons_get_listener(MONS_INSTANCE *mons, + MONS_REQ_FUNC *req_handler, + MONS_AUTH_FUNC *auth_handler, + const char *hostname, + int port, + void *cookie, + int *fd_out, + size_t max_fd) { size_t n_fd=0; size_t ii=0; - mons->port = port; + mons->mon_port = port; n_fd = tr_sock_listen_all(port, fd_out, max_fd); if (n_fd<=0) tr_err("mons_get_listener: Error opening port %d"); diff --git a/tid/tid_req.c b/tid/tid_req.c index 002b720..1bfce70 100644 --- a/tid/tid_req.c +++ b/tid/tid_req.c @@ -253,7 +253,7 @@ void tid_req_free(TID_REQ *req) } int tid_req_add_path(TID_REQ *req, - const char *this_system, unsigned port) + const char *this_system, int port) { char *path_element = talloc_asprintf(req, "%s:%u", this_system, port); diff --git a/tid/tidc.c b/tid/tidc.c index 1cff6f0..9578f3d 100644 --- a/tid/tidc.c +++ b/tid/tidc.c @@ -79,12 +79,12 @@ void tidc_destroy(TIDC_INSTANCE *tidc) talloc_free(tidc); } -int tidc_open_connection (TIDC_INSTANCE *tidc, - const char *server, - unsigned int port, - gss_ctx_id_t *gssctx) +int tidc_open_connection(TIDC_INSTANCE *tidc, + const char *server, + int port, + gss_ctx_id_t *gssctx) { - unsigned int use_port = 0; + int use_port = 0; tidc->gssc->gss_ctx = gssctx; if (0 == port) diff --git a/tid/tids.c b/tid/tids.c index f6da08d..7b486d4 100644 --- a/tid/tids.c +++ b/tid/tids.c @@ -356,7 +356,7 @@ nfds_t tids_get_listener(TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, tids_auth_func *auth_handler, const char *hostname, - unsigned int port, + int port, void *cookie, int *fd_out, size_t max_fd) @@ -574,12 +574,12 @@ void tids_sweep_procs(TIDS_INSTANCE *tids) } /* Process tids requests forever. Should not return except on error. */ -int tids_start (TIDS_INSTANCE *tids, - TIDS_REQ_FUNC *req_handler, - tids_auth_func *auth_handler, - const char *hostname, - unsigned int port, - void *cookie) +int tids_start(TIDS_INSTANCE *tids, + TIDS_REQ_FUNC *req_handler, + tids_auth_func *auth_handler, + const char *hostname, + int port, + void *cookie) { int fd[TR_MAX_SOCKETS]={0}; nfds_t n_fd=0; diff --git a/tr/tr_mon.c b/tr/tr_mon.c index 84ab353..1327082 100644 --- a/tr/tr_mon.c +++ b/tr/tr_mon.c @@ -144,7 +144,7 @@ int tr_mons_event_init(struct event_base *base, goto cleanup; } - if (cfg_mgr->active->internal->monitoring_port == 0) { + if (cfg_mgr->active->internal->mons_port == 0) { tr_notice("tr_mons_event_init: monitoring is disabled, not enabling events or opening sockets"); retval = 0; goto cleanup; @@ -166,7 +166,7 @@ int tr_mons_event_init(struct event_base *base, mons_ev->n_sock_fd = mons_get_listener(mons, tr_mons_req_handler, tr_mons_auth_handler, cfg_mgr->active->internal->hostname, - cfg_mgr->active->internal->monitoring_port, + cfg_mgr->active->internal->mons_port, (void *) cookie, mons_ev->sock_fd, TR_MAX_SOCKETS); if (mons_ev->n_sock_fd==0) { diff --git a/tr/tr_tid.c b/tr/tr_tid.c index 0020a05..9d32edc 100644 --- a/tr/tr_tid.c +++ b/tr/tr_tid.c @@ -179,8 +179,8 @@ static void *tr_tids_req_fwd_thread(void *arg) if (-1==(args->fwd_req->conn = tidc_open_connection(tidc, aaa_hostname, - (unsigned int) aaa_port, /* we checked, it's > 0 */ - &(args->fwd_req->gssctx)))) { + aaa_port, + &(args->fwd_req->gssctx)))) { tr_notice("tr_tids_req_fwd_thread: Error in tidc_open_connection."); /* tids_send_err_response(tids, orig_req, "Can't open connection to next hop TIDS"); */ /* TODO: encode reason for failure */ diff --git a/tr/trmon_main.c b/tr/trmon_main.c index 761b433..7ec6a4f 100644 --- a/tr/trmon_main.c +++ b/tr/trmon_main.c @@ -66,7 +66,7 @@ static const struct argp_option cmdline_options[] = { /* structure for communicating with option parser */ struct cmdline_args { char *server; - unsigned int port; + int port; MON_CMD command; MON_OPT_TYPE options[MAX_OPTIONS]; unsigned int n_options; @@ -97,7 +97,7 @@ static error_t parse_option(int key, char *arg, struct argp_state *state) if (errno || (tmp_l < 0) || (tmp_l > 65535)) /* max valid port */ argp_usage(state); - arguments->port=(unsigned int) tmp_l; + arguments->port = (int) tmp_l; /* we already checked the range */ break; case 2: diff --git a/trp/test/ptbl_test.c b/trp/test/ptbl_test.c index 5853895..05c3997 100644 --- a/trp/test/ptbl_test.c +++ b/trp/test/ptbl_test.c @@ -48,7 +48,7 @@ struct peer_entry { char *server; char *gss_name; - unsigned int port; + int port; unsigned int linkcost; }; diff --git a/trp/trp_conn.c b/trp/trp_conn.c index 1cf326d..370d5b1 100644 --- a/trp/trp_conn.c +++ b/trp/trp_conn.c @@ -364,11 +364,11 @@ TRP_CONNECTION *trp_connection_accept(TALLOC_CTX *mem_ctx, int listen, TR_NAME * } /* Initiate connection */ -TRP_RC trp_connection_initiate(TRP_CONNECTION *conn, char *server, unsigned int port) +TRP_RC trp_connection_initiate(TRP_CONNECTION *conn, char *server, int port) { int err = 0; int fd=-1; - unsigned int use_port=0; + int use_port=0; if (0 == port) use_port = TRP_PORT; diff --git a/trp/trp_peer.c b/trp/trp_peer.c index c98cf47..34d4296 100644 --- a/trp/trp_peer.c +++ b/trp/trp_peer.c @@ -173,12 +173,12 @@ TR_NAME *trp_peer_dup_servicename(TRP_PEER *peer) return tr_dup_name(peer->servicename); } -unsigned int trp_peer_get_port(TRP_PEER *peer) +int trp_peer_get_port(TRP_PEER *peer) { return peer->port; } -void trp_peer_set_port(TRP_PEER *peer, unsigned int port) +void trp_peer_set_port(TRP_PEER *peer, int port) { peer->port=port; } diff --git a/trp/trp_peer_encoders.c b/trp/trp_peer_encoders.c index a1cc64f..48f74c5 100644 --- a/trp/trp_peer_encoders.c +++ b/trp/trp_peer_encoders.c @@ -51,7 +51,7 @@ char *trp_peer_to_str(TALLOC_CTX *memctx, TRP_PEER *peer, const char *sep) } /* helper for encoding to json */ -static json_t *server_to_json_string(const char *server, unsigned int port) +static json_t *server_to_json_string(const char *server, int port) { char *s = talloc_asprintf(NULL, "%s:%u", server, port); json_t *jstr = json_string(s); diff --git a/trp/trp_upd.c b/trp/trp_upd.c index 26b976e..2c6e3a2 100644 --- a/trp/trp_upd.c +++ b/trp/trp_upd.c @@ -802,7 +802,7 @@ void trp_upd_set_peer(TRP_UPD *upd, TR_NAME *peer) upd->peer=peer; } -void trp_upd_set_next_hop(TRP_UPD *upd, const char *hostname, unsigned int port) +void trp_upd_set_next_hop(TRP_UPD *upd, const char *hostname, int port) { TRP_INFOREC *rec=NULL; TR_NAME *cpy=NULL; diff --git a/trp/trpc.c b/trp/trpc.c index aef5f7b..04a8ca2 100644 --- a/trp/trpc.c +++ b/trp/trpc.c @@ -153,7 +153,7 @@ unsigned int trpc_get_port(TRPC_INSTANCE *trpc) return trpc->port; } -void trpc_set_port(TRPC_INSTANCE *trpc, unsigned int port) +void trpc_set_port(TRPC_INSTANCE *trpc, int port) { trpc->port=port; }