mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr.git
synced 2025-11-02 21:23:30 +00:00
Compare commits
2 Commits
6784ed14b7
...
osmith/ski
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80dcbcdeca | ||
|
|
c1d2f10cf6 |
@@ -17,7 +17,8 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
|
|||||||
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
|
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libosmo-gsup-client.pc
|
pkgconfig_DATA = libosmo-gsup-client.pc \
|
||||||
|
libosmo-mslookup.pc
|
||||||
|
|
||||||
@RELMAKE@
|
@RELMAKE@
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -189,11 +190,45 @@ static void test_server_client()
|
|||||||
client_stop();
|
client_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_multicast_enabled()
|
||||||
|
{
|
||||||
|
bool ret = true;
|
||||||
|
struct addrinfo *ai;
|
||||||
|
int sock;
|
||||||
|
struct addrinfo hints = {0};
|
||||||
|
struct ip_mreq multicast_req = {0};
|
||||||
|
in_addr_t iface = INADDR_ANY;
|
||||||
|
|
||||||
|
hints.ai_family = PF_UNSPEC;
|
||||||
|
hints.ai_socktype = SOCK_DGRAM;
|
||||||
|
hints.ai_flags = (AI_PASSIVE | AI_NUMERICHOST);
|
||||||
|
assert(getaddrinfo("239.192.23.42", "4266", &hints, &ai) == 0);
|
||||||
|
|
||||||
|
sock = socket(ai->ai_family, ai->ai_socktype, 0);
|
||||||
|
assert(sock != -1);
|
||||||
|
assert(setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (char*)&iface, sizeof(iface)) != -1);
|
||||||
|
|
||||||
|
memcpy(&multicast_req.imr_multiaddr, &((struct sockaddr_in*)(ai->ai_addr))->sin_addr,
|
||||||
|
sizeof(multicast_req.imr_multiaddr));
|
||||||
|
multicast_req.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
||||||
|
if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&multicast_req, sizeof(multicast_req)) == -1)
|
||||||
|
ret = false;
|
||||||
|
|
||||||
|
freeaddrinfo(ai);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Run all tests
|
* Run all tests
|
||||||
*/
|
*/
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
if (!is_multicast_enabled()) {
|
||||||
|
fprintf(stderr, "WARNING: multicast is disabled, skipping the test! (OS#4361)");
|
||||||
|
return 77;
|
||||||
|
}
|
||||||
|
|
||||||
talloc_enable_null_tracking();
|
talloc_enable_null_tracking();
|
||||||
ctx = talloc_named_const(NULL, 0, "main");
|
ctx = talloc_named_const(NULL, 0, "main");
|
||||||
osmo_init_logging2(ctx, NULL);
|
osmo_init_logging2(ctx, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user