Lines Matching refs:neigh
178 struct rtnl_neigh *neigh = nl_object_priv(c); in neigh_free_data() local
180 if (!neigh) in neigh_free_data()
183 nl_addr_put(neigh->n_lladdr); in neigh_free_data()
184 nl_addr_put(neigh->n_dst); in neigh_free_data()
206 struct rtnl_neigh *neigh = (struct rtnl_neigh *) obj; in neigh_keygen() local
218 if (neigh->n_family == AF_BRIDGE) { in neigh_keygen()
219 if (neigh->n_lladdr) in neigh_keygen()
220 addr = neigh->n_lladdr; in neigh_keygen()
221 } else if (neigh->n_dst) { in neigh_keygen()
222 addr = neigh->n_dst; in neigh_keygen()
234 nkey->n_family = neigh->n_family; in neigh_keygen()
235 if (neigh->n_family == AF_BRIDGE) in neigh_keygen()
236 nkey->n_ifindex = neigh->n_master; in neigh_keygen()
238 nkey->n_ifindex = neigh->n_ifindex; in neigh_keygen()
247 neigh, nkey->n_family, nkey->n_ifindex, in neigh_keygen()
307 struct rtnl_neigh *neigh = (struct rtnl_neigh *)obj; in neigh_id_attrs_get() local
309 if (neigh->n_family == AF_BRIDGE) in neigh_id_attrs_get()
323 struct rtnl_neigh *neigh; in neigh_msg_parser() local
326 if ((err = rtnl_neigh_parse(n, &neigh)) < 0) in neigh_msg_parser()
329 err = pp->pp_cb((struct nl_object *) neigh, pp); in neigh_msg_parser()
331 rtnl_neigh_put(neigh); in neigh_msg_parser()
338 struct rtnl_neigh *neigh; in rtnl_neigh_parse() local
343 neigh = rtnl_neigh_alloc(); in rtnl_neigh_parse()
344 if (!neigh) { in rtnl_neigh_parse()
349 neigh->ce_msgtype = n->nlmsg_type; in rtnl_neigh_parse()
356 neigh->n_family = nm->ndm_family; in rtnl_neigh_parse()
357 neigh->n_ifindex = nm->ndm_ifindex; in rtnl_neigh_parse()
358 neigh->n_state = nm->ndm_state; in rtnl_neigh_parse()
359 neigh->n_flags = nm->ndm_flags; in rtnl_neigh_parse()
360 neigh->n_type = nm->ndm_type; in rtnl_neigh_parse()
362 neigh->ce_mask |= (NEIGH_ATTR_FAMILY | NEIGH_ATTR_IFINDEX | in rtnl_neigh_parse()
367 neigh->n_lladdr = nl_addr_alloc_attr(tb[NDA_LLADDR], AF_UNSPEC); in rtnl_neigh_parse()
368 if (!neigh->n_lladdr) { in rtnl_neigh_parse()
372 nl_addr_set_family(neigh->n_lladdr, in rtnl_neigh_parse()
373 nl_addr_guess_family(neigh->n_lladdr)); in rtnl_neigh_parse()
374 neigh->ce_mask |= NEIGH_ATTR_LLADDR; in rtnl_neigh_parse()
378 neigh->n_dst = nl_addr_alloc_attr(tb[NDA_DST], neigh->n_family); in rtnl_neigh_parse()
379 if (!neigh->n_dst) { in rtnl_neigh_parse()
383 neigh->ce_mask |= NEIGH_ATTR_DST; in rtnl_neigh_parse()
389 neigh->n_cacheinfo.nci_confirmed = ci->ndm_confirmed; in rtnl_neigh_parse()
390 neigh->n_cacheinfo.nci_used = ci->ndm_used; in rtnl_neigh_parse()
391 neigh->n_cacheinfo.nci_updated = ci->ndm_updated; in rtnl_neigh_parse()
392 neigh->n_cacheinfo.nci_refcnt = ci->ndm_refcnt; in rtnl_neigh_parse()
394 neigh->ce_mask |= NEIGH_ATTR_CACHEINFO; in rtnl_neigh_parse()
398 neigh->n_probes = nla_get_u32(tb[NDA_PROBES]); in rtnl_neigh_parse()
399 neigh->ce_mask |= NEIGH_ATTR_PROBES; in rtnl_neigh_parse()
405 if (neigh->n_family == AF_BRIDGE) { in rtnl_neigh_parse()
409 neigh->n_ifindex); in rtnl_neigh_parse()
411 neigh->n_master = link->l_master; in rtnl_neigh_parse()
413 neigh->ce_mask |= NEIGH_ATTR_MASTER; in rtnl_neigh_parse()
420 *result = neigh; in rtnl_neigh_parse()
424 rtnl_neigh_put(neigh); in rtnl_neigh_parse()
505 void rtnl_neigh_put(struct rtnl_neigh *neigh) in rtnl_neigh_put() argument
507 nl_object_put((struct nl_object *) neigh); in rtnl_neigh_put()
543 struct rtnl_neigh *neigh; in rtnl_neigh_get() local
545 nl_list_for_each_entry(neigh, &cache->c_items, ce_list) { in rtnl_neigh_get()
546 if (neigh->n_ifindex == ifindex && in rtnl_neigh_get()
547 !nl_addr_cmp(neigh->n_dst, dst)) { in rtnl_neigh_get()
548 nl_object_get((struct nl_object *) neigh); in rtnl_neigh_get()
549 return neigh; in rtnl_neigh_get()
688 int rtnl_neigh_build_delete_request(struct rtnl_neigh *neigh, int flags, in rtnl_neigh_build_delete_request() argument
691 return build_neigh_msg(neigh, RTM_DELNEIGH, flags, result); in rtnl_neigh_build_delete_request()
706 int rtnl_neigh_delete(struct nl_sock *sk, struct rtnl_neigh *neigh, in rtnl_neigh_delete() argument
712 if ((err = rtnl_neigh_build_delete_request(neigh, flags, &msg)) < 0) in rtnl_neigh_delete()
783 void rtnl_neigh_set_state(struct rtnl_neigh *neigh, int state) in rtnl_neigh_set_state() argument
785 neigh->n_state_mask |= state; in rtnl_neigh_set_state()
786 neigh->n_state |= state; in rtnl_neigh_set_state()
787 neigh->ce_mask |= NEIGH_ATTR_STATE; in rtnl_neigh_set_state()
790 int rtnl_neigh_get_state(struct rtnl_neigh *neigh) in rtnl_neigh_get_state() argument
792 if (neigh->ce_mask & NEIGH_ATTR_STATE) in rtnl_neigh_get_state()
793 return neigh->n_state; in rtnl_neigh_get_state()
798 void rtnl_neigh_unset_state(struct rtnl_neigh *neigh, int state) in rtnl_neigh_unset_state() argument
800 neigh->n_state_mask |= state; in rtnl_neigh_unset_state()
801 neigh->n_state &= ~state; in rtnl_neigh_unset_state()
802 neigh->ce_mask |= NEIGH_ATTR_STATE; in rtnl_neigh_unset_state()
805 void rtnl_neigh_set_flags(struct rtnl_neigh *neigh, unsigned int flags) in rtnl_neigh_set_flags() argument
807 neigh->n_flag_mask |= flags; in rtnl_neigh_set_flags()
808 neigh->n_flags |= flags; in rtnl_neigh_set_flags()
809 neigh->ce_mask |= NEIGH_ATTR_FLAGS; in rtnl_neigh_set_flags()
812 unsigned int rtnl_neigh_get_flags(struct rtnl_neigh *neigh) in rtnl_neigh_get_flags() argument
814 return neigh->n_flags; in rtnl_neigh_get_flags()
817 void rtnl_neigh_unset_flags(struct rtnl_neigh *neigh, unsigned int flags) in rtnl_neigh_unset_flags() argument
819 neigh->n_flag_mask |= flags; in rtnl_neigh_unset_flags()
820 neigh->n_flags &= ~flags; in rtnl_neigh_unset_flags()
821 neigh->ce_mask |= NEIGH_ATTR_FLAGS; in rtnl_neigh_unset_flags()
824 void rtnl_neigh_set_ifindex(struct rtnl_neigh *neigh, int ifindex) in rtnl_neigh_set_ifindex() argument
826 neigh->n_ifindex = ifindex; in rtnl_neigh_set_ifindex()
827 neigh->ce_mask |= NEIGH_ATTR_IFINDEX; in rtnl_neigh_set_ifindex()
830 int rtnl_neigh_get_ifindex(struct rtnl_neigh *neigh) in rtnl_neigh_get_ifindex() argument
832 return neigh->n_ifindex; in rtnl_neigh_get_ifindex()
835 static inline int __assign_addr(struct rtnl_neigh *neigh, struct nl_addr **pos, in __assign_addr() argument
839 if (neigh->ce_mask & NEIGH_ATTR_FAMILY) { in __assign_addr()
840 if (new->a_family != neigh->n_family) in __assign_addr()
843 neigh->n_family = new->a_family; in __assign_addr()
844 neigh->ce_mask |= NEIGH_ATTR_FAMILY; in __assign_addr()
854 neigh->ce_mask |= flag; in __assign_addr()
859 void rtnl_neigh_set_lladdr(struct rtnl_neigh *neigh, struct nl_addr *addr) in rtnl_neigh_set_lladdr() argument
861 __assign_addr(neigh, &neigh->n_lladdr, addr, NEIGH_ATTR_LLADDR, 1); in rtnl_neigh_set_lladdr()
864 struct nl_addr *rtnl_neigh_get_lladdr(struct rtnl_neigh *neigh) in rtnl_neigh_get_lladdr() argument
866 if (neigh->ce_mask & NEIGH_ATTR_LLADDR) in rtnl_neigh_get_lladdr()
867 return neigh->n_lladdr; in rtnl_neigh_get_lladdr()
872 int rtnl_neigh_set_dst(struct rtnl_neigh *neigh, struct nl_addr *addr) in rtnl_neigh_set_dst() argument
874 return __assign_addr(neigh, &neigh->n_dst, addr, in rtnl_neigh_set_dst()
878 struct nl_addr *rtnl_neigh_get_dst(struct rtnl_neigh *neigh) in rtnl_neigh_get_dst() argument
880 if (neigh->ce_mask & NEIGH_ATTR_DST) in rtnl_neigh_get_dst()
881 return neigh->n_dst; in rtnl_neigh_get_dst()
886 void rtnl_neigh_set_family(struct rtnl_neigh *neigh, int family) in rtnl_neigh_set_family() argument
888 neigh->n_family = family; in rtnl_neigh_set_family()
889 neigh->ce_mask |= NEIGH_ATTR_FAMILY; in rtnl_neigh_set_family()
892 int rtnl_neigh_get_family(struct rtnl_neigh *neigh) in rtnl_neigh_get_family() argument
894 return neigh->n_family; in rtnl_neigh_get_family()
897 void rtnl_neigh_set_type(struct rtnl_neigh *neigh, int type) in rtnl_neigh_set_type() argument
899 neigh->n_type = type; in rtnl_neigh_set_type()
900 neigh->ce_mask = NEIGH_ATTR_TYPE; in rtnl_neigh_set_type()
903 int rtnl_neigh_get_type(struct rtnl_neigh *neigh) in rtnl_neigh_get_type() argument
905 if (neigh->ce_mask & NEIGH_ATTR_TYPE) in rtnl_neigh_get_type()
906 return neigh->n_type; in rtnl_neigh_get_type()