mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
fix OSPFv2/3 running on same interface
This commit is contained in:
@@ -466,7 +466,7 @@ bbl_network_rx_handler(bbl_network_interface_s *interface,
|
||||
}
|
||||
bbl_tcp_ipv4_rx(interface, eth, ipv4);
|
||||
return;
|
||||
} else if(ipv4->protocol == PROTOCOL_IPV4_OSPF && interface->ospf_interface) {
|
||||
} else if(ipv4->protocol == PROTOCOL_IPV4_OSPF && interface->ospfv2_interface) {
|
||||
ospf_handler_rx_ipv4(interface, eth, ipv4);
|
||||
return;
|
||||
}
|
||||
@@ -491,7 +491,7 @@ bbl_network_rx_handler(bbl_network_interface_s *interface,
|
||||
}
|
||||
bbl_tcp_ipv6_rx(interface, eth, ipv6);
|
||||
return;
|
||||
} else if(ipv6->protocol == IPV6_NEXT_HEADER_OSPF && interface->ospf_interface) {
|
||||
} else if(ipv6->protocol == IPV6_NEXT_HEADER_OSPF && interface->ospfv3_interface) {
|
||||
ospf_handler_rx_ipv6(interface, eth, ipv6);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ typedef struct bbl_network_interface_
|
||||
isis_adjacency_p2p_s *isis_adjacency_p2p;
|
||||
isis_adjacency_s *isis_adjacency[ISIS_LEVELS];
|
||||
ldp_adjacency_s *ldp_adjacency;
|
||||
ospf_interface_s *ospf_interface;
|
||||
ospf_interface_s *ospfv2_interface;
|
||||
ospf_interface_s *ospfv3_interface;
|
||||
|
||||
struct {
|
||||
uint64_t packets_tx;
|
||||
|
||||
@@ -87,7 +87,7 @@ ospf_handler_rx_ipv4(bbl_network_interface_s *interface,
|
||||
protocol_error_t result;
|
||||
ospf_pdu_s pdu = {0};
|
||||
|
||||
ospf_interface_s *ospf_interface = interface->ospf_interface;
|
||||
ospf_interface_s *ospf_interface = interface->ospfv2_interface;
|
||||
ospf_neighbor_s *ospf_neighbor = ospf_interface->neighbors;
|
||||
ospf_config_s *config = ospf_interface->instance->config;
|
||||
|
||||
@@ -224,7 +224,7 @@ ospf_handler_rx_ipv6(bbl_network_interface_s *interface,
|
||||
protocol_error_t result;
|
||||
ospf_pdu_s pdu = {0};
|
||||
|
||||
ospf_interface_s *ospf_interface = interface->ospf_interface;
|
||||
ospf_interface_s *ospf_interface = interface->ospfv3_interface;
|
||||
ospf_neighbor_s *ospf_neighbor = ospf_interface->neighbors;
|
||||
|
||||
bbl_ospf_s *ospf = ipv6->next;
|
||||
|
||||
@@ -28,7 +28,7 @@ ospf_hello_v2_encode(bbl_network_interface_s *interface,
|
||||
bbl_ospf_s ospf = {0};
|
||||
ospf_pdu_s pdu = {0};
|
||||
|
||||
ospf_interface_s *ospf_interface = interface->ospf_interface;
|
||||
ospf_interface_s *ospf_interface = interface->ospfv2_interface;
|
||||
ospf_neighbor_s *ospf_neighbor = ospf_interface->neighbors;
|
||||
ospf_instance_s *ospf_instance = ospf_interface->instance;
|
||||
ospf_config_s *config = ospf_instance->config;
|
||||
@@ -122,7 +122,7 @@ ospf_hello_v3_encode(bbl_network_interface_s *interface,
|
||||
ospf_pdu_s pdu = {0};
|
||||
uint8_t mac[ETH_ADDR_LEN];
|
||||
|
||||
ospf_interface_s *ospf_interface = interface->ospf_interface;
|
||||
ospf_interface_s *ospf_interface = interface->ospfv3_interface;
|
||||
ospf_neighbor_s *ospf_neighbor = ospf_interface->neighbors;
|
||||
ospf_instance_s *ospf_instance = ospf_interface->instance;
|
||||
ospf_config_s *config = ospf_instance->config;
|
||||
|
||||
@@ -250,18 +250,19 @@ ospf_interface_init(bbl_network_interface_s *interface,
|
||||
return false;
|
||||
}
|
||||
ospf_interface = calloc(1, sizeof(ospf_interface_s));
|
||||
interface->ospf_interface = ospf_interface;
|
||||
ospf_interface->interface = interface;
|
||||
ospf_interface->instance = ospf;
|
||||
ospf_interface->version = version;
|
||||
ospf_interface->type = interface_type;
|
||||
ospf_interface->id = interface_id++;
|
||||
if(version == OSPF_VERSION_2) {
|
||||
interface->ospfv2_interface = ospf_interface;
|
||||
ospf_interface->metric = network_config->ospfv2_metric;
|
||||
ospf_interface->frag_buf = malloc(OSPF_PDU_LEN_MAX);
|
||||
ospf_interface->frag_id = 0;
|
||||
ospf_interface->frag_off = 0;
|
||||
} else {
|
||||
interface->ospfv3_interface = ospf_interface;
|
||||
ospf_interface->metric = network_config->ospfv3_metric;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user