Commits
Joakim Tjernlund authored and Paul Jakma committed 05cf46badba
432 432 | |
433 433 | prefix_copy (&ptmp, CONNECTED_PREFIX(oi->connected)); |
434 434 | apply_mask (&ptmp); |
435 435 | if (prefix_same (&ptmp, (struct prefix *) p)) |
436 436 | return oi; |
437 437 | } |
438 438 | } |
439 439 | return NULL; |
440 440 | } |
441 441 | |
442 - | /* determine receiving interface by source of packet */ |
442 + | /* determine receiving interface by ifp and source address */ |
443 443 | struct ospf_interface * |
444 - | ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src) |
444 + | ospf_if_lookup_recv_if (struct ospf *ospf, struct in_addr src, |
445 + | struct interface *ifp) |
445 446 | { |
446 - | struct listnode *node; |
447 + | struct route_node *rn; |
447 448 | struct prefix_ipv4 addr; |
448 449 | struct ospf_interface *oi, *match; |
449 450 | |
450 451 | addr.family = AF_INET; |
451 452 | addr.prefix = src; |
452 453 | addr.prefixlen = IPV4_MAX_BITLEN; |
453 454 | |
454 455 | match = NULL; |
455 456 | |
456 - | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
457 + | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
457 458 | { |
459 + | oi = rn->info; |
460 + | |
461 + | if (!oi) /* oi can be NULL for PtP aliases */ |
462 + | continue; |
463 + | |
458 464 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) |
459 465 | continue; |
460 - | |
466 + | |
461 467 | if (if_is_loopback (oi->ifp)) |
462 468 | continue; |
463 469 | |
464 470 | if (prefix_match (CONNECTED_PREFIX(oi->connected), |
465 471 | (struct prefix *) &addr)) |
466 472 | { |
467 473 | if ( (match == NULL) || |
468 474 | (match->address->prefixlen < oi->address->prefixlen) |
469 475 | ) |
470 476 | match = oi; |