Adding selection of local interface at the MBMS-GW.

master
Pedro Alvarez 6 years ago committed by Andre Puschmann
parent a42c71f8ee
commit 3ecacdf3a6

@ -51,6 +51,7 @@ typedef struct {
std::string sgi_mb_if_addr; std::string sgi_mb_if_addr;
std::string sgi_mb_if_mask; std::string sgi_mb_if_mask;
std::string m1u_multi_addr; std::string m1u_multi_addr;
std::string m1u_multi_if;
} mbms_gw_args_t; } mbms_gw_args_t;
struct pseudo_hdr struct pseudo_hdr

@ -15,6 +15,7 @@ name = srsmbmsgw01
sgi_mb_if_addr = 172.16.0.254 sgi_mb_if_addr = 172.16.0.254
sgi_mb_if_mask = 255.255.255.255 sgi_mb_if_mask = 255.255.255.255
m1u_multi_addr = 239.255.0.1 m1u_multi_addr = 239.255.0.1
m1u_multi_if = 127.0.1.200
#################################################################### ####################################################################
# Log configuration # Log configuration

@ -85,6 +85,7 @@ parse_args(all_args_t *args, int argc, char* argv[]) {
string mbms_gw_sgi_mb_if_addr; string mbms_gw_sgi_mb_if_addr;
string mbms_gw_sgi_mb_if_mask; string mbms_gw_sgi_mb_if_mask;
string mbms_gw_m1u_multi_addr; string mbms_gw_m1u_multi_addr;
string mbms_gw_m1u_multi_if;
string log_filename; string log_filename;
@ -103,6 +104,7 @@ parse_args(all_args_t *args, int argc, char* argv[]) {
("mbms_gw.sgi_mb_if_addr", bpo::value<string>(&mbms_gw_sgi_mb_if_addr)->default_value("172.16.1.1"), "SGi-mb TUN interface Address.") ("mbms_gw.sgi_mb_if_addr", bpo::value<string>(&mbms_gw_sgi_mb_if_addr)->default_value("172.16.1.1"), "SGi-mb TUN interface Address.")
("mbms_gw.sgi_mb_if_mask", bpo::value<string>(&mbms_gw_sgi_mb_if_mask)->default_value("255.255.255.255"), "SGi-mb TUN interface mask.") ("mbms_gw.sgi_mb_if_mask", bpo::value<string>(&mbms_gw_sgi_mb_if_mask)->default_value("255.255.255.255"), "SGi-mb TUN interface mask.")
("mbms_gw.m1u_multi_addr", bpo::value<string>(&mbms_gw_m1u_multi_addr)->default_value("239.255.0.1"), "M1-u GTPu destination multicast address.") ("mbms_gw.m1u_multi_addr", bpo::value<string>(&mbms_gw_m1u_multi_addr)->default_value("239.255.0.1"), "M1-u GTPu destination multicast address.")
("mbms_gw.m1u_multi_if", bpo::value<string>(&mbms_gw_m1u_multi_if)->default_value("127.0.1.200"), "Local interface IP for M1-U multicast packets.")
("log.all_level", bpo::value<string>(&args->log_args.all_level)->default_value("info"), "ALL log level") ("log.all_level", bpo::value<string>(&args->log_args.all_level)->default_value("info"), "ALL log level")
("log.all_hex_limit", bpo::value<int>(&args->log_args.all_hex_limit)->default_value(32), "ALL log hex dump limit") ("log.all_hex_limit", bpo::value<int>(&args->log_args.all_hex_limit)->default_value(32), "ALL log hex dump limit")
@ -156,6 +158,7 @@ parse_args(all_args_t *args, int argc, char* argv[]) {
args->mbms_gw_args.sgi_mb_if_addr = mbms_gw_sgi_mb_if_addr; args->mbms_gw_args.sgi_mb_if_addr = mbms_gw_sgi_mb_if_addr;
args->mbms_gw_args.sgi_mb_if_mask = mbms_gw_sgi_mb_if_mask; args->mbms_gw_args.sgi_mb_if_mask = mbms_gw_sgi_mb_if_mask;
args->mbms_gw_args.m1u_multi_addr = mbms_gw_m1u_multi_addr; args->mbms_gw_args.m1u_multi_addr = mbms_gw_m1u_multi_addr;
args->mbms_gw_args.m1u_multi_if = mbms_gw_m1u_multi_if;
// Apply all_level to any unset layers // Apply all_level to any unset layers
if (vm.count("log.all_level")) { if (vm.count("log.all_level")) {

@ -234,7 +234,7 @@ mbms_gw::init_m1_u(mbms_gw_args_t *args)
/* Set local interface for outbound multicast packets*/ /* Set local interface for outbound multicast packets*/
/* The IP must be associated with a local multicast capable interface */ /* The IP must be associated with a local multicast capable interface */
struct in_addr local_if; struct in_addr local_if;
local_if.s_addr = inet_addr("127.0.1.200"); local_if.s_addr = inet_addr(args->m1u_multi_if.c_str());
if(setsockopt(m_m1u, IPPROTO_IP, IP_MULTICAST_IF, (char*)&local_if, sizeof(struct in_addr))<0){ if(setsockopt(m_m1u, IPPROTO_IP, IP_MULTICAST_IF, (char*)&local_if, sizeof(struct in_addr))<0){
perror("Error setting multicast interface.\n"); perror("Error setting multicast interface.\n");
} else { } else {

Loading…
Cancel
Save