*/
struct sockaddr *
rtm_scrub(int type, int idx, struct sockaddr *hint, struct sockaddr *sa,
- void *buf, uint32_t buflen, kauth_cred_t *credp)
+ void *buf, uint32_t buflen, kauth_cred_t *credp, uint32_t rtm_hint_flags)
{
struct sockaddr_storage *ss = (struct sockaddr_storage *)buf;
struct sockaddr *ret = sa;
}
break;
}
+ case RTAX_GATEWAY: {
+ /*
+ * Break if the gateway is not AF_LINK type (indirect routes)
+ *
+ * Else, if is, check if it is resolved. If not yet resolved
+ * simply break else scrub the link layer address.
+ */
+ if ((sa->sa_family != AF_LINK) || (SDL(sa)->sdl_alen == 0))
+ break;
+ /* fallthrough */
+ }
case RTAX_IFP: {
- if (sa->sa_family == AF_LINK && credp) {
+ if (sa->sa_family == AF_LINK && credp &&
+ (rtm_hint_flags & RTMF_HIDE_LLADDR)) {
struct sockaddr_dl *sdl = SDL(buf);
const void *bytes;
size_t size;