Yu Xiangning wrote:

>> If we want to keep the existing order, this would be
>>
>>         switch (ipif->ipif_flags & (IPIF_POINTOPOINT|IPIF_UNNUMBERED)) {
>>         case IPIF_POINTOPOINT:
>>         case 0:
>>                 if (ipif->ipif_lcl_addr == addr)
>>                         return (ipif);
>>
>>                 /* Match both local and remote for pointopoint */
>>                 if ((ipif->ipif_flags & IPIF_POINTOPOINT) &&
>>                  ipif->ipif_pp_dst_addr == addr)
>>                         return (ipif);
>>
>>                 break;
>>
>>         case (IPIF_POINTOPOINT|IPIF_UNNUMBERED):
>>                 /* Match just the remote address */
>>                 if (ipif->ipif_pp_dst_addr == addr)
>>                         return (ipif);
>>                 break;
>>         default:
>>                 ASSERT(0);
>>         }
> 
> If there are two interfaces in the system and it happens to be the first
> one is with IPIF_POINTTOPOINT and the second one without
> IPIF_UNNUMBERED, also suppose the first one's ipif_pp_dst_addr is equal
> to the second one's ipif_lcl_addr (this can happen if one of the
> interface is DOWN), the above code will result in different behavior
> from what it does today. i.e. Nevada matches the second one while the
> proposed code matches the first one.
> 
> I'm not sure the correct behavior under this situation. If either is OK
> then it's fine we can eliminate twice lookups.

Good point.

    Erik
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to