Hello Éric,

+       if (memcmp(lladdr, neigh->ha, neigh->dev->addr_len) != 0)

Where do you check that lladdr contains exactly neigh->dev->addr_len bytes ?

True, I do not check. I had some doubt about the best implementation, since we could do:
 * exact matching
 * prefix matching (with a memcmp on length of lladdr)

Do you may have an opinion on the best choice?


+               case NDA_LLADDR:
+                       filter->lladdr = nla_data(tb[i]);

This comes from user space, and could contains an arbitrary amount of bytes, 
like 0 byte.

You probably have to store the full attribute, so that you can use nla_len() 
and nla_data()


I will send a v2.

By the way, it looks like neigh_add() function never check if NDA_LLADDR length is greater than dev->addr_len (it only rejects smaller values). Should we add a check on it? I do not see any impact today, except than user does not receive an error on invalid data, it will configure an entry anyway.

Thanks,

--
Florent.

Reply via email to