diff --git a/src/udp.c b/src/udp.c index 239c444..3507c51 100644 --- a/src/udp.c +++ b/src/udp.c @@ -48,7 +48,7 @@ udp_resolve( udp_connection_t *uc, int receiver ) snprintf(port_buf, 6, "%d", uc->port); memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_flags = receiver ? AI_PASSIVE : 0; + hints.ai_flags = (receiver ? AI_PASSIVE : 0) | AI_NUMERICSERV; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; @@ -150,7 +150,7 @@ udp_get_solip( void ) udp_connection_t * udp_bind ( const char *subsystem, const char *name, - const char *bindaddr, int port, + const char *bindaddr, uint16_t port, const char *ifname, int rxsize ) { int fd, ifindex, reuse = 1; @@ -278,13 +278,14 @@ error: int udp_bind_double ( udp_connection_t **_u1, udp_connection_t **_u2, const char *subsystem, const char *name1, - const char *name2, const char *host, int port, + const char *name2, const char *host, uint16_t port, const char *ifname, int rxsize1, int rxsize2 ) { udp_connection_t *u1 = NULL, *u2 = NULL; udp_connection_t *ucs[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - int pos = 0, i, port2; + int pos = 0, i; + uint16_t port2; memset(&ucs, 0, sizeof(ucs)); while (1) { @@ -315,7 +316,7 @@ fail: udp_connection_t * udp_connect ( const char *subsystem, const char *name, - const char *host, int port, + const char *host, uint16_t port, const char *ifname, int txsize ) { int fd, ifindex; diff --git a/src/udp.h b/src/udp.h index be6f062..2650ec8 100644 --- a/src/udp.h +++ b/src/udp.h @@ -27,7 +27,7 @@ typedef struct udp_connection { char *host; - int port; + uint16_t port; int multicast; char *ifname; struct sockaddr_storage ip; @@ -39,16 +39,16 @@ typedef struct udp_connection { udp_connection_t * udp_bind ( const char *subsystem, const char *name, - const char *bindaddr, int port, + const char *bindaddr, uint16_t port, const char *ifname, int rxsize ); int udp_bind_double ( udp_connection_t **_u1, udp_connection_t **_u2, const char *subsystem, const char *name1, - const char *name2, const char *host, int port, + const char *name2, const char *host, uint16_t port, const char *ifname, int rxsize1, int rxsize2 ); udp_connection_t * udp_connect ( const char *subsystem, const char *name, - const char *host, int port, + const char *host, uint16_t port, const char *ifname, int txsize ); void udp_close ( udp_connection_t *uc ); diff --git a/src/url.h b/src/url.h index 4d7da6f..54937b8 100644 --- a/src/url.h +++ b/src/url.h @@ -29,7 +29,7 @@ typedef struct url char *user; char *pass; char *host; - short port; + uint16_t port; char *path; char *query; char *frag;