* Checks if gateway is suitable for lltable operations. * Lltable code requires AF_LINK gateway with ifindex * and mac address specified. * Returns 0 on success. */
| 161 | * Returns 0 on success. |
| 162 | */ |
| 163 | static int |
| 164 | cleanup_xaddrs_lladdr(struct rt_addrinfo *info) |
| 165 | { |
| 166 | struct sockaddr_dl *sdl = (struct sockaddr_dl *)info->rti_info[RTAX_GATEWAY]; |
| 167 | |
| 168 | if (sdl->sdl_family != AF_LINK) |
| 169 | return (EINVAL); |
| 170 | |
| 171 | if (sdl->sdl_index == 0) |
| 172 | return (EINVAL); |
| 173 | |
| 174 | if (offsetof(struct sockaddr_dl, sdl_data) + sdl->sdl_nlen + sdl->sdl_alen > sdl->sdl_len) |
| 175 | return (EINVAL); |
| 176 | |
| 177 | return (0); |
| 178 | } |
| 179 | |
| 180 | static int |
| 181 | cleanup_xaddrs_gateway(struct rt_addrinfo *info) |
no outgoing calls
no test coverage detected