The BNetworkRoute class manages a route_entry and the sockaddr's associated with it. It replaces the direct use of route_entry in the BNetworkInterface API. Using route_entry is fragile and inconvenient as it only holds pointers to the sockaddr's. When getting a list of routes from the kernel, each route_entry is set up so that its pointers point into the single flat buffer that is passed around. Creating a copy of the route_entry and then deleting the flat buffer makes the pointers in the copy stale. Returning these route entries therefore always lead to a use-after-free when they were eventually used. BNetworkRoute also takes over the code and functionallity of getting routes from RouteSupport. The corresponding method in BNetworkRoster is replaced by a static method in BNetworkRoute. Also distinguish between the default route and gateway of an interface. GetDefaultRoute() now gets the default BNetworkRoute for the interface while GetDefaultGateway() gets the associated gateway address within that default route. Adjust network preferences panel to this change. Note that we currently only seem to have per interface default routes and not an actual global default route. This was already the case before these changes and I did not further investigate what this means.
109 lines
2.7 KiB
Plaintext
109 lines
2.7 KiB
Plaintext
SubDir HAIKU_TOP src kits network libnetapi ;
|
|
|
|
UsePrivateHeaders app net shared storage support ;
|
|
UsePrivateHeaders locale shared ;
|
|
|
|
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ]
|
|
: true ;
|
|
UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_wlan ] : true ;
|
|
UseHeaders [ FDirName $(HAIKU_TOP) headers os add-ons network_settings ]
|
|
: true ;
|
|
|
|
local architectureObject ;
|
|
for architectureObject in [ MultiArchSubDirSetup ] {
|
|
on $(architectureObject) {
|
|
local sslSources ;
|
|
local md5Sources ;
|
|
|
|
UsePrivateSystemHeaders ;
|
|
|
|
if [ FIsBuildFeatureEnabled openssl ] {
|
|
SubDirC++Flags -DOPENSSL_ENABLED ;
|
|
UseBuildFeatureHeaders openssl ;
|
|
sslSources = SSL.cpp ;
|
|
md5Sources = ;
|
|
Includes [ FGristFiles $(sslSources) SecureSocket.cpp
|
|
HttpAuthentication.cpp Certificate.cpp ]
|
|
: [ BuildFeatureAttribute openssl : headers ] ;
|
|
# Dependency needed to trigger downloading/unzipping the package before
|
|
# compiling the files.
|
|
SetupFeatureObjectsDir ssl ;
|
|
} else {
|
|
# As we don't have md5 from ssl, use our own
|
|
md5Sources = md5.c ;
|
|
SetupFeatureObjectsDir no-ssl ;
|
|
}
|
|
|
|
# BUrl uses ICU to perform IDNA conversions (unicode domain names)
|
|
UseBuildFeatureHeaders icu ;
|
|
Includes [ FGristFiles Url.cpp ]
|
|
: [ BuildFeatureAttribute icu : headers ] ;
|
|
|
|
SharedLibrary [ MultiArchDefaultGristFiles libbnetapi.so ] :
|
|
init.cpp
|
|
DynamicBuffer.cpp
|
|
NetEndpoint.cpp
|
|
NetAddress.cpp
|
|
NetBuffer.cpp
|
|
NetDebug.cpp
|
|
|
|
$(sslSources)
|
|
Certificate.cpp
|
|
|
|
NetworkAddress.cpp
|
|
NetworkAddressResolver.cpp
|
|
NetworkCookie.cpp
|
|
NetworkCookieJar.cpp
|
|
NetworkDevice.cpp
|
|
NetworkInterface.cpp
|
|
NetworkRoster.cpp
|
|
NetworkRoute.cpp
|
|
NetworkSettings.cpp
|
|
|
|
AbstractSocket.cpp
|
|
DatagramSocket.cpp
|
|
Socket.cpp
|
|
SecureSocket.cpp
|
|
|
|
# TODO: another add-on for file:// (a much simpler one)
|
|
FileRequest.cpp
|
|
|
|
# TODO: another add-on for gopher://
|
|
GopherRequest.cpp
|
|
|
|
# TODO: The HTTP stuff should all go into an add-on. It needs
|
|
# linking against libcrypto.so and only the add-on should link
|
|
# against it.
|
|
DataRequest.cpp
|
|
HttpAuthentication.cpp
|
|
HttpHeaders.cpp
|
|
HttpForm.cpp
|
|
HttpRequest.cpp
|
|
HttpResult.cpp
|
|
HttpTime.cpp
|
|
|
|
getifaddrs.cpp
|
|
notifications.cpp
|
|
|
|
$(md5Sources)
|
|
|
|
NetworkRequest.cpp
|
|
Url.cpp
|
|
UrlContext.cpp
|
|
UrlProtocolAsynchronousListener.cpp
|
|
UrlProtocolDispatchingListener.cpp
|
|
UrlProtocolListener.cpp
|
|
UrlProtocolRoster.cpp
|
|
UrlRequest.cpp
|
|
UrlResult.cpp
|
|
UrlSynchronousRequest.cpp
|
|
|
|
:
|
|
be $(TARGET_NETWORK_LIBS) [ TargetLibstdc++ ] [ TargetLibsupc++ ]
|
|
[ BuildFeatureAttribute openssl : libraries ]
|
|
[ BuildFeatureAttribute icu : libraries ]
|
|
[ MultiArchDefaultGristFiles libshared.a ]
|
|
;
|
|
}
|
|
}
|