git: 20b6945c7f54 - main - netlink: fix IPv6 proxy ndp deletion.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Apr 2023 13:27:02 UTC
The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=20b6945c7f542a76b8c8f9f962403303ccee4227 commit 20b6945c7f542a76b8c8f9f962403303ccee4227 Author: Alexander V. Chernikov <melifaro@FreeBSD.org> AuthorDate: 2023-04-26 13:23:39 +0000 Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> CommitDate: 2023-04-26 13:26:37 +0000 netlink: fix IPv6 proxy ndp deletion. * Move LLT_ADDEDPROXY handling into lltable_link_entry() to reduct duplication * Use standard lltable_delete_addr() for entry deletion * Add (forgotten) call to llt_post_resolved handler after adding the entry via netlink. MFC after: 2 weeks --- sys/net/if_llatbl.c | 9 +++++---- sys/netlink/route/neigh.c | 24 ++---------------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 86bf9a0d47db..f97c2f8f91de 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -904,8 +904,12 @@ lltable_free_entry(struct lltable *llt, struct llentry *lle) int lltable_link_entry(struct lltable *llt, struct llentry *lle) { + int error = llt->llt_link_entry(llt, lle); - return (llt->llt_link_entry(llt, lle)); + if (error == 0 && (lle->la_flags & LLE_PUB) != 0) + llt->llt_flags |= LLT_ADDEDPROXY; + + return (error); } void @@ -1034,9 +1038,6 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info) lltable_unlink_entry(llt, lle_tmp); } lltable_link_entry(llt, lle); - if ((lle->la_flags & LLE_PUB) != 0 && - (llt->llt_flags & LLT_ADDEDPROXY) == 0) - llt->llt_flags |= LLT_ADDEDPROXY; IF_AFDATA_WUNLOCK(ifp); if (lle_tmp != NULL) { diff --git a/sys/netlink/route/neigh.c b/sys/netlink/route/neigh.c index daf0843e432c..db72bc9bfd4e 100644 --- a/sys/netlink/route/neigh.c +++ b/sys/netlink/route/neigh.c @@ -451,6 +451,7 @@ rtnl_handle_newneigh(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * /* XXX: We're inside epoch */ EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_RESOLVED); LLE_WUNLOCK(lle); + llt->llt_post_resolved(llt, lle); return (0); } @@ -479,28 +480,7 @@ rtnl_handle_delneigh(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * if (llt == NULL) return (EAFNOSUPPORT); - IF_AFDATA_WLOCK(attrs.nda_ifp); - struct llentry *lle = lla_lookup(llt, LLE_SF(attrs.ndm_family, LLE_EXCLUSIVE), - attrs.nda_dst); - if (lle != NULL) { - if ((lle->la_flags & LLE_IFADDR) != 0) { - LLE_WUNLOCK(lle); - lle = NULL; - error = EPERM; - NLMSG_REPORT_ERR_MSG(npt, "unable to delete ifaddr record"); - } else - lltable_unlink_entry(llt, lle); - } else - error = ENOENT; - IF_AFDATA_WUNLOCK(attrs.nda_ifp); - - if (error == 0 && lle != NULL) - EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); - - if (lle != NULL) - llentry_free(lle); - - return (error); + return (lltable_delete_addr(llt, 0, attrs.nda_dst)); } static int