-static struct ether_addr *get_local_link_hw_addr(uint8_t out_port)
-{
- return &link_hw_laddr[out_port];
-}
-
-static uint8_t local_dest_mac_present(uint8_t out_port)
-{
- return link_hw_laddr_valid[out_port];
-}
-
-static uint32_t local_get_nh_ipv4(
- uint32_t ip,
- uint32_t *port,
- uint32_t *nhip,
- struct pipeline_vfw *vfw_pipe)
-{
- int i;
-
- for (i = 0; i < vfw_pipe->local_lib_arp_route_ent_cnt; i++) {
- if (((vfw_pipe->local_lib_arp_route_table[i].ip &
- vfw_pipe->local_lib_arp_route_table[i].mask) ==
- (ip & vfw_pipe->local_lib_arp_route_table[i].mask))) {
- *port = vfw_pipe->local_lib_arp_route_table[i].port;
-
- *nhip = vfw_pipe->local_lib_arp_route_table[i].nh;
- return 1;
- }
- }
- return 0;
-}
-
-static void do_local_nh_ipv4_cache(uint32_t dest_if,
- struct pipeline_vfw *vfw_pipe)
-{
-
- /* Search for the entry and do local copy */
- int i;
-
- for (i = 0; i < MAX_ARP_RT_ENTRY; i++) {
- if (lib_arp_route_table[i].port == dest_if) {
-
- struct lib_arp_route_table_entry *lentry =
- &vfw_pipe->
- local_lib_arp_route_table[vfw_pipe->
- local_lib_arp_route_ent_cnt];
-
- lentry->ip = lib_arp_route_table[i].ip;
- lentry->mask = lib_arp_route_table[i].mask;
- lentry->port = lib_arp_route_table[i].port;
- lentry->nh = lib_arp_route_table[i].nh;
-
- vfw_pipe->local_lib_arp_route_ent_cnt++;
- break;
- }
- }
-}
-static uint32_t local_get_nh_ipv6(
- uint8_t *ip,
- uint32_t *port,
- uint8_t nhip[],
- struct pipeline_vfw *vfw_pipe)
-{
- uint8_t netmask_ipv6[IPV6_ADD_SIZE], netip_nd[IPV6_ADD_SIZE],
- netip_in[IPV6_ADD_SIZE];
- uint8_t i = 0, j = 0, k = 0, l = 0, depthflags = 0, depthflags1 = 0;
- memset(netmask_ipv6, 0, sizeof(netmask_ipv6));
- memset(netip_nd, 0, sizeof(netip_nd));
- memset(netip_in, 0, sizeof(netip_in));
-
- for (i = 0; i < vfw_pipe->local_lib_nd_route_ent_cnt; i++) {
-
- convert_prefixlen_to_netmask_ipv6(
- vfw_pipe->local_lib_nd_route_table[i].depth,
- netmask_ipv6);
-
- for (k = 0; k < IPV6_ADD_SIZE; k++)
- if (vfw_pipe->local_lib_nd_route_table[i].ipv6[k] &
- netmask_ipv6[k]) {
- depthflags++;
- netip_nd[k] = vfw_pipe->
- local_lib_nd_route_table[i].ipv6[k];
- }
-
- for (l = 0; l < IPV6_ADD_SIZE; l++)
- if (ip[l] & netmask_ipv6[l]) {
- depthflags1++;
- netip_in[l] = ip[l];
- }
-
-
- if ((depthflags == depthflags1) && (memcmp(netip_nd, netip_in,
- sizeof(netip_nd)) == 0)) {
-
- *port = vfw_pipe->local_lib_nd_route_table[i].port;
-
- for (j = 0; j < IPV6_ADD_SIZE; j++)
- nhip[j] = vfw_pipe->
- local_lib_nd_route_table[i].nhipv6[j];
- return 1;
- }
-
- depthflags = 0;
- depthflags1 = 0;
- }
- return 0;
-}
-
-static void do_local_nh_ipv6_cache(uint32_t dest_if,
- struct pipeline_vfw *vfw_pipe)
-{
- /* Search for the entry and do local copy */
- int i, l;
-
- for (i = 0; i < MAX_ND_RT_ENTRY; i++) {
-
- if (lib_nd_route_table[i].port == dest_if) {
-
- struct lib_nd_route_table_entry *lentry = &vfw_pipe->
- local_lib_nd_route_table[vfw_pipe->
- local_lib_nd_route_ent_cnt];
-
- for (l = 0; l < IPV6_ADD_SIZE; l++) {
- lentry->ipv6[l] =
- lib_nd_route_table[i].ipv6[l];
- lentry->nhipv6[l] =
- lib_nd_route_table[i].nhipv6[l];
- }
- lentry->depth = lib_nd_route_table[i].depth;
- lentry->port = lib_nd_route_table[i].port;
-
- vfw_pipe->local_lib_nd_route_ent_cnt++;
- break;
- } /* if */
- } /* for */
-}