Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Allocate an empty neighbour handle to be filled out with the attributes
- * of the new neighbour. */
- struct rtnl_neigh *neigh = rtnl_neigh_alloc();
- /* Fill out the attributes of the new neighbour */
- rtnl_neigh_set_ifindex(neigh, ifindex);
- rtnl_neigh_set_dst(neigh, dst_addr);
- rtnl_neigh_set_state(neigh, rtnl_neigh_str2state("permanent"));
- /* Build the netlink message and send it to the kernel, the operation will
- * block until the operation has been completed. Alternatively the required
- * netlink message can be built using rtnl_neigh_build_add_request()
- * to be sent out using nl_send_auto_complete(). */
- rtnl_neigh_add(sk, neigh, NLM_F_CREATE);
- /* Free the memory */
- rtnl_neigh_put(neigh);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement