summaryrefslogtreecommitdiff
path: root/srclib/apr/network_io/os2/sockets.c
diff options
context:
space:
mode:
Diffstat (limited to 'srclib/apr/network_io/os2/sockets.c')
-rw-r--r--srclib/apr/network_io/os2/sockets.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/srclib/apr/network_io/os2/sockets.c b/srclib/apr/network_io/os2/sockets.c
index f1c00b5b..bb951e4c 100644
--- a/srclib/apr/network_io/os2/sockets.c
+++ b/srclib/apr/network_io/os2/sockets.c
@@ -1,9 +1,9 @@
-/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -62,9 +62,11 @@ static void alloc_socket(apr_socket_t **new, apr_pool_t *p)
(*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
sizeof(apr_sockaddr_t));
(*new)->local_addr->pool = p;
+
(*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
sizeof(apr_sockaddr_t));
(*new)->remote_addr->pool = p;
+ (*new)->remote_addr_unknown = 1;
/* Create a pollset with room for one descriptor. */
/* ### check return codes */
@@ -140,6 +142,10 @@ APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock,
return APR_OS2_STATUS(sock_errno());
else {
sock->local_addr = sa;
+ /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */
+ if (sock->local_addr->sa.sin.sin_port == 0) { /* no need for ntohs() when comparing w/ 0 */
+ sock->local_port_unknown = 1; /* kernel got us an ephemeral port */
+ }
return APR_SUCCESS;
}
}