* Check if we have a route for the given prefix already. */
| 895 | * Check if we have a route for the given prefix already. |
| 896 | */ |
| 897 | static bool |
| 898 | in_hasrtprefix(struct in_ifaddr *target) |
| 899 | { |
| 900 | struct rm_priotracker in_ifa_tracker; |
| 901 | struct in_ifaddr *ia; |
| 902 | struct in_addr prefix, mask, p, m; |
| 903 | bool result = false; |
| 904 | |
| 905 | ia_getrtprefix(target, &prefix, &mask); |
| 906 | |
| 907 | IN_IFADDR_RLOCK(&in_ifa_tracker); |
| 908 | /* Look for an existing address with the same prefix, mask, and fib */ |
| 909 | CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { |
| 910 | ia_getrtprefix(ia, &p, &m); |
| 911 | |
| 912 | if (prefix.s_addr != p.s_addr || |
| 913 | mask.s_addr != m.s_addr) |
| 914 | continue; |
| 915 | |
| 916 | if (target->ia_ifp->if_fib != ia->ia_ifp->if_fib) |
| 917 | continue; |
| 918 | |
| 919 | /* |
| 920 | * If we got a matching prefix route inserted by other |
| 921 | * interface address, we are done here. |
| 922 | */ |
| 923 | if (ia->ia_flags & IFA_ROUTE) { |
| 924 | result = true; |
| 925 | break; |
| 926 | } |
| 927 | } |
| 928 | IN_IFADDR_RUNLOCK(&in_ifa_tracker); |
| 929 | |
| 930 | return (result); |
| 931 | } |
| 932 | |
| 933 | int |
| 934 | in_addprefix(struct in_ifaddr *target) |
no test coverage detected