Commit 412e5c62 authored by Brian Wellington's avatar Brian Wellington
Browse files

Add lwres_udp_port, so that test programs can use a different port.

parent 9550eb2d
......@@ -43,6 +43,8 @@
#define LWRES_SOCKADDR_LEN_T unsigned int
#endif
lwres_uint16_t lwres_udp_port = LWRES_UDP_PORT;
static void *
lwres_malloc(void *, size_t);
......@@ -178,7 +180,7 @@ context_connect(lwres_context_t *ctx) {
memset(&localhost, 0, sizeof(localhost));
localhost.sin_family = AF_INET;
localhost.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
localhost.sin_port = htons(LWRES_UDP_PORT);
localhost.sin_port = htons(lwres_udp_port);
s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s < 0)
......@@ -271,7 +273,7 @@ lwres_context_sendrecv(lwres_context_t *ctx,
* or if someone is sending us random stuff.
*/
if (sin.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
|| sin.sin_port != htons(LWRES_UDP_PORT))
|| sin.sin_port != htons(lwres_udp_port))
goto again;
if (recvd_len != NULL)
......
......@@ -228,6 +228,11 @@ typedef struct {
LWRES_LANG_BEGINDECLS
/*
* This is in host byte order.
*/
extern lwres_uint16_t lwres_udp_port;
lwres_result_t
lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req,
lwres_lwpacket_t *pkt, lwres_buffer_t *b);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment