From dce01abb6633a1b119f42fd041d998b18da0a63b Mon Sep 17 00:00:00 2001
From: John Scipione <jscipione@gmail.com>
Date: Tue, 27 Aug 2013 18:18:05 -0400
Subject: [PATCH] Add length parameter to bind() and connect()
NUL terminate address in src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp
Include but ignore addressLength parameter elsewhere
---
headers/private/net/net_protocol.h | 6 ++++--
src/add-ons/kernel/network/protocols/icmp/icmp.cpp | 6 ++++--
.../kernel/network/protocols/icmp6/icmp6.cpp | 6 ++++--
src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp | 6 ++++--
src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp | 6 ++++--
.../network/protocols/tcp/EndpointManager.cpp | 6 ++++--
.../kernel/network/protocols/tcp/EndpointManager.h | 4 ++--
.../kernel/network/protocols/tcp/TCPEndpoint.cpp | 6 +++---
.../kernel/network/protocols/tcp/TCPEndpoint.h | 4 ++--
src/add-ons/kernel/network/protocols/tcp/tcp.cpp | 10 ++++++----
src/add-ons/kernel/network/protocols/udp/udp.cpp | 21 ++++++++++++---------
.../kernel/network/protocols/unix/UnixEndpoint.cpp | 15 ++++++++++-----
.../kernel/network/protocols/unix/UnixEndpoint.h | 4 ++--
src/add-ons/kernel/network/protocols/unix/unix.cpp | 10 ++++++----
src/add-ons/kernel/network/stack/link.cpp | 12 +++++++-----
src/add-ons/kernel/network/stack/net_socket.cpp | 5 +++--
16 files changed, 77 insertions(+), 50 deletions(-)
diff --git a/headers/private/net/net_protocol.h b/headers/private/net/net_protocol.h
index 352b8a5..6ff9a1b 100644
a
|
b
|
struct net_protocol_module_info {
|
65 | 65 | status_t (*close)(net_protocol* self); |
66 | 66 | status_t (*free)(net_protocol* self); |
67 | 67 | |
68 | | status_t (*connect)(net_protocol* self, const struct sockaddr* address); |
| 68 | status_t (*connect)(net_protocol* self, const struct sockaddr* address, |
| 69 | socklen_t addressLength); |
69 | 70 | status_t (*accept)(net_protocol* self, net_socket** _acceptedSocket); |
70 | 71 | status_t (*control)(net_protocol* self, int level, int option, |
71 | 72 | void* value, size_t* _length); |
… |
… |
struct net_protocol_module_info {
|
74 | 75 | status_t (*setsockopt)(net_protocol* self, int level, int option, |
75 | 76 | const void* value, int length); |
76 | 77 | |
77 | | status_t (*bind)(net_protocol* self, const struct sockaddr* address); |
| 78 | status_t (*bind)(net_protocol* self, const struct sockaddr* address, |
| 79 | socklen_t addressLength); |
78 | 80 | status_t (*unbind)(net_protocol* self, struct sockaddr* address); |
79 | 81 | status_t (*listen)(net_protocol* self, int count); |
80 | 82 | status_t (*shutdown)(net_protocol* self, int direction); |
diff --git a/src/add-ons/kernel/network/protocols/icmp/icmp.cpp b/src/add-ons/kernel/network/protocols/icmp/icmp.cpp
index 2beff1a..f800d32 100644
a
|
b
|
icmp_free(net_protocol* protocol)
|
291 | 291 | |
292 | 292 | |
293 | 293 | status_t |
294 | | icmp_connect(net_protocol* protocol, const struct sockaddr* address) |
| 294 | icmp_connect(net_protocol* protocol, const struct sockaddr* address, |
| 295 | socklen_t addressLength) |
295 | 296 | { |
296 | 297 | return B_ERROR; |
297 | 298 | } |
… |
… |
icmp_setsockopt(net_protocol* protocol, int level, int option,
|
332 | 333 | |
333 | 334 | |
334 | 335 | status_t |
335 | | icmp_bind(net_protocol* protocol, const struct sockaddr* address) |
| 336 | icmp_bind(net_protocol* protocol, const struct sockaddr* address, |
| 337 | socklen_t addressLength) |
336 | 338 | { |
337 | 339 | return B_ERROR; |
338 | 340 | } |
diff --git a/src/add-ons/kernel/network/protocols/icmp6/icmp6.cpp b/src/add-ons/kernel/network/protocols/icmp6/icmp6.cpp
index 4f2dd1d..b01ad20 100644
a
|
b
|
icmp6_free(net_protocol *protocol)
|
80 | 80 | |
81 | 81 | |
82 | 82 | status_t |
83 | | icmp6_connect(net_protocol *protocol, const struct sockaddr *address) |
| 83 | icmp6_connect(net_protocol *protocol, const struct sockaddr *address, |
| 84 | socklen_t addressLength) |
84 | 85 | { |
85 | 86 | return B_ERROR; |
86 | 87 | } |
… |
… |
icmp6_setsockopt(net_protocol *protocol, int level, int option,
|
121 | 122 | |
122 | 123 | |
123 | 124 | status_t |
124 | | icmp6_bind(net_protocol *protocol, const struct sockaddr *address) |
| 125 | icmp6_bind(net_protocol *protocol, const struct sockaddr *address, |
| 126 | socklen_t addressLength) |
125 | 127 | { |
126 | 128 | return B_ERROR; |
127 | 129 | } |
diff --git a/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp b/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp
index 15011da..d4d90be 100644
a
|
b
|
ipv4_free(net_protocol* protocol)
|
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | status_t |
1103 | | ipv4_connect(net_protocol* protocol, const struct sockaddr* address) |
| 1103 | ipv4_connect(net_protocol* protocol, const struct sockaddr* address, |
| 1104 | socklen_t addressLength) |
1104 | 1105 | { |
1105 | 1106 | return B_ERROR; |
1106 | 1107 | } |
… |
… |
ipv4_setsockopt(net_protocol* _protocol, int level, int option,
|
1312 | 1313 | |
1313 | 1314 | |
1314 | 1315 | status_t |
1315 | | ipv4_bind(net_protocol* protocol, const struct sockaddr* address) |
| 1316 | ipv4_bind(net_protocol* protocol, const struct sockaddr* address, |
| 1317 | socklen_t addressLength) |
1316 | 1318 | { |
1317 | 1319 | if (address->sa_family != AF_INET) |
1318 | 1320 | return EAFNOSUPPORT; |
diff --git a/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp b/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp
index 76a5ec5..1607f05 100644
a
|
b
|
ipv6_free(net_protocol* protocol)
|
1040 | 1040 | |
1041 | 1041 | |
1042 | 1042 | status_t |
1043 | | ipv6_connect(net_protocol* protocol, const struct sockaddr* address) |
| 1043 | ipv6_connect(net_protocol* protocol, const struct sockaddr* address, |
| 1044 | socklen_t addressLength) |
1044 | 1045 | { |
1045 | 1046 | return B_ERROR; |
1046 | 1047 | } |
… |
… |
ipv6_setsockopt(net_protocol* _protocol, int level, int option,
|
1180 | 1181 | |
1181 | 1182 | |
1182 | 1183 | status_t |
1183 | | ipv6_bind(net_protocol* protocol, const sockaddr* _address) |
| 1184 | ipv6_bind(net_protocol* protocol, const sockaddr* _address, |
| 1185 | socklen_t addressLength) |
1184 | 1186 | { |
1185 | 1187 | if (_address->sa_family != AF_INET6) |
1186 | 1188 | return EAFNOSUPPORT; |
diff --git a/src/add-ons/kernel/network/protocols/tcp/EndpointManager.cpp b/src/add-ons/kernel/network/protocols/tcp/EndpointManager.cpp
index 1739b63..f8d29ae 100644
a
|
b
|
EndpointManager::FindConnection(sockaddr* local, sockaddr* peer)
|
360 | 360 | |
361 | 361 | |
362 | 362 | status_t |
363 | | EndpointManager::Bind(TCPEndpoint* endpoint, const sockaddr* address) |
| 363 | EndpointManager::Bind(TCPEndpoint* endpoint, const sockaddr* address, |
| 364 | socklen_t addressLength) |
364 | 365 | { |
365 | 366 | // check the family |
366 | 367 | if (!AddressModule()->is_same_family(address)) |
… |
… |
EndpointManager::_Bind(TCPEndpoint* endpoint, const sockaddr* address)
|
494 | 495 | { |
495 | 496 | // Thus far we have checked if the Bind() is allowed |
496 | 497 | |
497 | | status_t status = endpoint->next->module->bind(endpoint->next, address); |
| 498 | status_t status = endpoint->next->module->bind(endpoint->next, address, |
| 499 | sizeof(address)); |
498 | 500 | if (status < B_OK) |
499 | 501 | return status; |
500 | 502 | |
diff --git a/src/add-ons/kernel/network/protocols/tcp/EndpointManager.h b/src/add-ons/kernel/network/protocols/tcp/EndpointManager.h
index ebe2aea..8cccd44 100644
a
|
b
|
public:
|
80 | 80 | const sockaddr* interfaceLocal); |
81 | 81 | status_t SetPassive(TCPEndpoint* endpoint); |
82 | 82 | |
83 | | status_t Bind(TCPEndpoint* endpoint, |
84 | | const sockaddr* address); |
| 83 | status_t Bind(TCPEndpoint* endpoint, const sockaddr* address, |
| 84 | socklen_t addressLength); |
85 | 85 | status_t BindChild(TCPEndpoint* endpoint); |
86 | 86 | status_t Unbind(TCPEndpoint* endpoint); |
87 | 87 | |
diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
index 8c3fae3..03d66fa 100644
a
|
b
|
TCPEndpoint::Free()
|
580 | 580 | until the connection has been established or refused. |
581 | 581 | */ |
582 | 582 | status_t |
583 | | TCPEndpoint::Connect(const sockaddr* address) |
| 583 | TCPEndpoint::Connect(const sockaddr* address, socklen_t addressLength) |
584 | 584 | { |
585 | 585 | TRACE("Connect() on address %s", PrintAddress(address)); |
586 | 586 | |
… |
… |
TCPEndpoint::Accept(struct net_socket** _acceptedSocket)
|
696 | 696 | |
697 | 697 | |
698 | 698 | status_t |
699 | | TCPEndpoint::Bind(const sockaddr *address) |
| 699 | TCPEndpoint::Bind(const sockaddr *address, socklen_t addressLength) |
700 | 700 | { |
701 | 701 | if (address == NULL) |
702 | 702 | return B_BAD_VALUE; |
… |
… |
TCPEndpoint::Bind(const sockaddr *address)
|
708 | 708 | if (fState != CLOSED) |
709 | 709 | return EISCONN; |
710 | 710 | |
711 | | return fManager->Bind(this, address); |
| 711 | return fManager->Bind(this, address, addressLength); |
712 | 712 | } |
713 | 713 | |
714 | 714 | |
diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.h b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.h
index 085e173..35ed4dd 100644
a
|
b
|
public:
|
51 | 51 | status_t Open(); |
52 | 52 | status_t Close(); |
53 | 53 | void Free(); |
54 | | status_t Connect(const struct sockaddr* address); |
| 54 | status_t Connect(const struct sockaddr* address, socklen_t addressLength); |
55 | 55 | status_t Accept(struct net_socket** _acceptedSocket); |
56 | | status_t Bind(const sockaddr* address); |
| 56 | status_t Bind(const sockaddr* address, socklen_t addressLength); |
57 | 57 | status_t Unbind(struct sockaddr* address); |
58 | 58 | status_t Listen(int count); |
59 | 59 | status_t Shutdown(int direction); |
diff --git a/src/add-ons/kernel/network/protocols/tcp/tcp.cpp b/src/add-ons/kernel/network/protocols/tcp/tcp.cpp
index 7c1dbb4..b0c5a62 100644
a
|
b
|
tcp_free(net_protocol* protocol)
|
503 | 503 | |
504 | 504 | |
505 | 505 | status_t |
506 | | tcp_connect(net_protocol* protocol, const struct sockaddr* address) |
| 506 | tcp_connect(net_protocol* protocol, const struct sockaddr* address, |
| 507 | socklen_t addressLength) |
507 | 508 | { |
508 | | return ((TCPEndpoint*)protocol)->Connect(address); |
| 509 | return ((TCPEndpoint*)protocol)->Connect(address, addressLength); |
509 | 510 | } |
510 | 511 | |
511 | 512 | |
… |
… |
tcp_setsockopt(net_protocol* _protocol, int level, int option,
|
577 | 578 | |
578 | 579 | |
579 | 580 | status_t |
580 | | tcp_bind(net_protocol* protocol, const struct sockaddr* address) |
| 581 | tcp_bind(net_protocol* protocol, const struct sockaddr* address, |
| 582 | socklen_t addressLength) |
581 | 583 | { |
582 | | return ((TCPEndpoint*)protocol)->Bind(address); |
| 584 | return ((TCPEndpoint*)protocol)->Bind(address, addressLength); |
583 | 585 | } |
584 | 586 | |
585 | 587 | |
diff --git a/src/add-ons/kernel/network/protocols/udp/udp.cpp b/src/add-ons/kernel/network/protocols/udp/udp.cpp
index 97926b1..d213d7a 100644
a
|
b
|
class UdpEndpoint : public net_protocol, public DatagramSocket<> {
|
75 | 75 | public: |
76 | 76 | UdpEndpoint(net_socket* socket); |
77 | 77 | |
78 | | status_t Bind(const sockaddr* newAddr); |
| 78 | status_t Bind(const sockaddr* newAddr, socklen_t addressLength); |
79 | 79 | status_t Unbind(sockaddr* newAddr); |
80 | | status_t Connect(const sockaddr* newAddr); |
| 80 | status_t Connect(const sockaddr* newAddr, socklen_t addressLength); |
81 | 81 | |
82 | 82 | status_t Open(); |
83 | 83 | status_t Close(); |
… |
… |
UdpDomainSupport::_BindToEphemeral(UdpEndpoint *endpoint,
|
483 | 483 | status_t |
484 | 484 | UdpDomainSupport::_FinishBind(UdpEndpoint *endpoint, const sockaddr *address) |
485 | 485 | { |
486 | | status_t status = endpoint->next->module->bind(endpoint->next, address); |
| 486 | status_t status = endpoint->next->module->bind(endpoint->next, address, |
| 487 | sizeof(address)); |
487 | 488 | if (status < B_OK) |
488 | 489 | return status; |
489 | 490 | |
… |
… |
UdpEndpoint::UdpEndpoint(net_socket *socket)
|
919 | 920 | |
920 | 921 | |
921 | 922 | status_t |
922 | | UdpEndpoint::Bind(const sockaddr *address) |
| 923 | UdpEndpoint::Bind(const sockaddr *address, socklen_t addressLength) |
923 | 924 | { |
924 | 925 | TRACE_EP("Bind(%s)", AddressString(Domain(), address, true).Data()); |
925 | 926 | return fManager->BindEndpoint(this, address); |
… |
… |
UdpEndpoint::Unbind(sockaddr *address)
|
935 | 936 | |
936 | 937 | |
937 | 938 | status_t |
938 | | UdpEndpoint::Connect(const sockaddr *address) |
| 939 | UdpEndpoint::Connect(const sockaddr *address, socklen_t addressLength) |
939 | 940 | { |
940 | 941 | TRACE_EP("Connect(%s)", AddressString(Domain(), address, true).Data()); |
941 | 942 | return fManager->ConnectEndpoint(this, address); |
… |
… |
udp_free(net_protocol *protocol)
|
1141 | 1142 | |
1142 | 1143 | |
1143 | 1144 | status_t |
1144 | | udp_connect(net_protocol *protocol, const struct sockaddr *address) |
| 1145 | udp_connect(net_protocol *protocol, const struct sockaddr *address, |
| 1146 | socklen_t addressLength) |
1145 | 1147 | { |
1146 | | return ((UdpEndpoint *)protocol)->Connect(address); |
| 1148 | return ((UdpEndpoint *)protocol)->Connect(address, addressLength); |
1147 | 1149 | } |
1148 | 1150 | |
1149 | 1151 | |
… |
… |
udp_setsockopt(net_protocol *protocol, int level, int option,
|
1182 | 1184 | |
1183 | 1185 | |
1184 | 1186 | status_t |
1185 | | udp_bind(net_protocol *protocol, const struct sockaddr *address) |
| 1187 | udp_bind(net_protocol *protocol, const struct sockaddr *address, |
| 1188 | socklen_t addressLength) |
1186 | 1189 | { |
1187 | | return ((UdpEndpoint *)protocol)->Bind(address); |
| 1190 | return ((UdpEndpoint *)protocol)->Bind(address, addressLength); |
1188 | 1191 | } |
1189 | 1192 | |
1190 | 1193 | |
diff --git a/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp b/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp
index b2d12b5..c1646d5 100644
a
|
b
|
UnixEndpoint::Free()
|
149 | 149 | |
150 | 150 | |
151 | 151 | status_t |
152 | | UnixEndpoint::Bind(const struct sockaddr *_address) |
| 152 | UnixEndpoint::Bind(const struct sockaddr *_address, socklen_t addressLength) |
153 | 153 | { |
154 | 154 | if (_address->sa_family != AF_UNIX) |
155 | 155 | RETURN_ERROR(EAFNOSUPPORT); |
… |
… |
UnixEndpoint::Bind(const struct sockaddr *_address)
|
189 | 189 | gAddressManager.Add(this); |
190 | 190 | } else { |
191 | 191 | // FS address space |
| 192 | sockaddr_un tempAddress; |
| 193 | |
| 194 | memset(&tempAddress, 0, sizeof(tempAddress)); |
| 195 | memcpy(&tempAddress, address, addressLength); |
| 196 | address = &tempAddress; |
| 197 | |
192 | 198 | size_t pathLen = strnlen(address->sun_path, sizeof(address->sun_path)); |
193 | 199 | if (pathLen == 0 || pathLen == sizeof(address->sun_path)) |
194 | 200 | RETURN_ERROR(B_BAD_VALUE); |
195 | 201 | |
196 | 202 | struct vnode* vnode; |
197 | | status_t error = vfs_create_special_node(address->sun_path, |
198 | | NULL, S_IFSOCK | 0644, 0, !gStackModule->is_syscall(), NULL, |
199 | | &vnode); |
| 203 | status_t error = vfs_create_special_node(address->sun_path, NULL, |
| 204 | S_IFSOCK | 0644, 0, !gStackModule->is_syscall(), NULL, &vnode); |
200 | 205 | if (error != B_OK) |
201 | 206 | RETURN_ERROR(error == B_FILE_EXISTS ? EADDRINUSE : error); |
202 | 207 | |
… |
… |
UnixEndpoint::Listen(int backlog)
|
261 | 266 | |
262 | 267 | |
263 | 268 | status_t |
264 | | UnixEndpoint::Connect(const struct sockaddr *_address) |
| 269 | UnixEndpoint::Connect(const struct sockaddr *_address, socklen_t addressLength) |
265 | 270 | { |
266 | 271 | if (_address->sa_family != AF_UNIX) |
267 | 272 | RETURN_ERROR(EAFNOSUPPORT); |
diff --git a/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.h b/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.h
index 5e09fb0..34d1b57 100644
a
|
b
|
public:
|
60 | 60 | mutex_unlock(&fLock); |
61 | 61 | } |
62 | 62 | |
63 | | status_t Bind(const struct sockaddr *_address); |
| 63 | status_t Bind(const struct sockaddr *_address, socklen_t addressLength); |
64 | 64 | status_t Unbind(); |
65 | 65 | status_t Listen(int backlog); |
66 | | status_t Connect(const struct sockaddr *address); |
| 66 | status_t Connect(const struct sockaddr *_address, socklen_t addressLength); |
67 | 67 | status_t Accept(net_socket **_acceptedSocket); |
68 | 68 | |
69 | 69 | ssize_t Send(const iovec *vecs, size_t vecCount, |
diff --git a/src/add-ons/kernel/network/protocols/unix/unix.cpp b/src/add-ons/kernel/network/protocols/unix/unix.cpp
index eec335b..398903c 100644
a
|
b
|
unix_free(net_protocol *_protocol)
|
110 | 110 | |
111 | 111 | |
112 | 112 | status_t |
113 | | unix_connect(net_protocol *_protocol, const struct sockaddr *address) |
| 113 | unix_connect(net_protocol *_protocol, const struct sockaddr *_address, |
| 114 | socklen_t addressLength) |
114 | 115 | { |
115 | | return ((UnixEndpoint*)_protocol)->Connect(address); |
| 116 | return ((UnixEndpoint*)_protocol)->Connect(_address, addressLength); |
116 | 117 | } |
117 | 118 | |
118 | 119 | |
… |
… |
unix_setsockopt(net_protocol *protocol, int level, int option,
|
176 | 177 | |
177 | 178 | |
178 | 179 | status_t |
179 | | unix_bind(net_protocol *_protocol, const struct sockaddr *_address) |
| 180 | unix_bind(net_protocol *_protocol, const struct sockaddr *_address, |
| 181 | socklen_t addressLength) |
180 | 182 | { |
181 | | return ((UnixEndpoint*)_protocol)->Bind(_address); |
| 183 | return ((UnixEndpoint*)_protocol)->Bind(_address, addressLength); |
182 | 184 | } |
183 | 185 | |
184 | 186 | |
diff --git a/src/add-ons/kernel/network/stack/link.cpp b/src/add-ons/kernel/network/stack/link.cpp
index c88f19b..c50c50f 100644
a
|
b
|
public:
|
50 | 50 | status_t StartMonitoring(const char* deviceName); |
51 | 51 | status_t StopMonitoring(const char* deviceName); |
52 | 52 | |
53 | | status_t Bind(const sockaddr* address); |
| 53 | status_t Bind(const sockaddr* address, socklen_t addressLength); |
54 | 54 | status_t Unbind(); |
55 | 55 | bool IsBound() const |
56 | 56 | { return fBoundToDevice != NULL; } |
… |
… |
LinkProtocol::StopMonitoring(const char* deviceName)
|
140 | 140 | |
141 | 141 | |
142 | 142 | status_t |
143 | | LinkProtocol::Bind(const sockaddr* address) |
| 143 | LinkProtocol::Bind(const sockaddr* address, socklen_t addressLength) |
144 | 144 | { |
145 | 145 | // Only root is allowed to bind to a link layer interface |
146 | 146 | if (address == NULL || geteuid() != 0) |
… |
… |
link_free(net_protocol* protocol)
|
337 | 337 | |
338 | 338 | |
339 | 339 | static status_t |
340 | | link_connect(net_protocol* protocol, const struct sockaddr* address) |
| 340 | link_connect(net_protocol* protocol, const struct sockaddr* address, |
| 341 | socklen_t addressLength) |
341 | 342 | { |
342 | 343 | return B_NOT_SUPPORTED; |
343 | 344 | } |
… |
… |
link_setsockopt(net_protocol* protocol, int level, int option,
|
541 | 542 | |
542 | 543 | |
543 | 544 | static status_t |
544 | | link_bind(net_protocol* _protocol, const struct sockaddr* address) |
| 545 | link_bind(net_protocol* _protocol, const struct sockaddr* address, |
| 546 | socklen_t addressLength) |
545 | 547 | { |
546 | 548 | LinkProtocol* protocol = (LinkProtocol*)_protocol; |
547 | | return protocol->Bind(address); |
| 549 | return protocol->Bind(address, addressLength); |
548 | 550 | } |
549 | 551 | |
550 | 552 | |
diff --git a/src/add-ons/kernel/network/stack/net_socket.cpp b/src/add-ons/kernel/network/stack/net_socket.cpp
index 9d5cfc9..ff2c1d4 100644
a
|
b
|
socket_bind(net_socket* socket, const struct sockaddr* address,
|
1014 | 1014 | socket->address.ss_len = sizeof(sockaddr_storage); |
1015 | 1015 | |
1016 | 1016 | status_t status = socket->first_info->bind(socket->first_protocol, |
1017 | | (sockaddr*)address); |
| 1017 | (sockaddr*)address, addressLength); |
1018 | 1018 | if (status != B_OK) { |
1019 | 1019 | // clear address again, as binding failed |
1020 | 1020 | socket->address.ss_len = 0; |
… |
… |
socket_connect(net_socket* socket, const struct sockaddr* address,
|
1038 | 1038 | return status; |
1039 | 1039 | } |
1040 | 1040 | |
1041 | | return socket->first_info->connect(socket->first_protocol, address); |
| 1041 | return socket->first_info->connect(socket->first_protocol, address, |
| 1042 | addressLength); |
1042 | 1043 | } |
1043 | 1044 | |
1044 | 1045 | |