diff --git a/src/actions/gobgp_action.cpp b/src/actions/gobgp_action.cpp index 1408b8c..ce24b6c 100644 --- a/src/actions/gobgp_action.cpp +++ b/src/actions/gobgp_action.cpp @@ -84,9 +84,6 @@ void gobgp_action_init() { fastnetmon_global_configuration.gobgp_community_host_ipv6 = configuration_map["gobgp_community_host_ipv6"]; } - logger << log4cpp::Priority::INFO << "GoBGP host IPv6 community: " << bgp_community_host_ipv6.asn_number << ":" - << bgp_community_host_ipv6.community_number; - if (configuration_map.count("gobgp_community_subnet_ipv6")) { fastnetmon_global_configuration.gobgp_community_subnet_ipv6 = configuration_map["gobgp_community_subnet_ipv6"]; } diff --git a/src/gobgp_client/gobgp_client.cpp b/src/gobgp_client/gobgp_client.cpp index df273cf..31d77a9 100644 --- a/src/gobgp_client/gobgp_client.cpp +++ b/src/gobgp_client/gobgp_client.cpp @@ -124,73 +124,4 @@ bool GrpcClient::AnnounceUnicastPrefixIPv4(std::string announced_address, return true; } -bool GrpcClient::AnnounceUnicastPrefixIPv6(const subnet_ipv6_cidr_mask_t& client_ipv6, - const subnet_ipv6_cidr_mask_t& ipv6_next_hop, - bool is_withdrawal, - uint32_t community_as_32bit_int) { - grpc::ClientContext context; - // Set timeout for API - std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::seconds(gobgp_client_connection_timeout); - context.set_deadline(deadline); - - auto gobgp_ipv6_unicast_route_family = new apipb::Family; - gobgp_ipv6_unicast_route_family->set_afi(apipb::Family::AFI_IP6); - gobgp_ipv6_unicast_route_family->set_safi(apipb::Family::SAFI_UNICAST); - - apipb::AddPathRequest request; - request.set_table_type(apipb::TableType::GLOBAL); - - apipb::Path* current_path = new apipb::Path; - - current_path->set_allocated_family(gobgp_ipv6_unicast_route_family); - - if (is_withdrawal) { - current_path->set_is_withdraw(true); - } - - // Configure required announce - google::protobuf::Any* current_nlri = new google::protobuf::Any; - apipb::IPAddressPrefix current_ipaddrprefix; - current_ipaddrprefix.set_prefix(print_ipv6_address(client_ipv6.subnet_address)); - current_ipaddrprefix.set_prefix_len(client_ipv6.cidr_prefix_length); - - current_nlri->PackFrom(current_ipaddrprefix); - current_path->set_allocated_nlri(current_nlri); - - // Updating OriginAttribute info for current_path - google::protobuf::Any* current_origin = current_path->add_pattrs(); - apipb::OriginAttribute current_origin_t; - current_origin_t.set_origin(0); - current_origin->PackFrom(current_origin_t); - - // Updating NextHopAttribute info for current_path - google::protobuf::Any* current_next_hop = current_path->add_pattrs(); - apipb::NextHopAttribute current_next_hop_t; - current_next_hop_t.set_next_hop(print_ipv6_address(ipv6_next_hop.subnet_address)); - current_next_hop->PackFrom(current_next_hop_t); - - // Updating CommunitiesAttribute for current_path - google::protobuf::Any* current_communities = current_path->add_pattrs(); - apipb::CommunitiesAttribute current_communities_t; - current_communities_t.add_communities(community_as_32bit_int); - current_communities->PackFrom(current_communities_t); - - request.set_allocated_path(current_path); - - apipb::AddPathResponse response; - - // Don't be confused by name, it also can withdraw announces - auto status = stub_->AddPath(&context, request, &response); - - if (!status.ok()) { - logger << log4cpp::Priority::ERROR << "AddPath request to BGP daemon failed with code: " << status.error_code() - << " message " << status.error_message(); - - return false; - } - - - return true; -} diff --git a/src/gobgp_client/gobgp_client.hpp b/src/gobgp_client/gobgp_client.hpp index 4c5b931..d66b831 100644 --- a/src/gobgp_client/gobgp_client.hpp +++ b/src/gobgp_client/gobgp_client.hpp @@ -51,10 +51,6 @@ class GrpcClient { unsigned int cidr_mask, uint32_t community_as_32bit_int); - bool AnnounceUnicastPrefixIPv6(const subnet_ipv6_cidr_mask_t& client_ipv6, - const subnet_ipv6_cidr_mask_t& ipv6_next_hop, - bool is_withdrawal, - uint32_t community_as_32bit_int); private: std::unique_ptr stub_; };