diff --git a/newip/src/linux-5.10/net/newip/Kconfig b/newip/src/linux-5.10/net/newip/Kconfig index ce282cecea9a8898c02687f09755a2273c508f68..037ef7881b3d315058fb858b91ceeba045626e5f 100644 --- a/newip/src/linux-5.10/net/newip/Kconfig +++ b/newip/src/linux-5.10/net/newip/Kconfig @@ -17,7 +17,7 @@ config NEWIP_FAST_KEEPALIVE Support for NewIP fast keepalive. config NEWIP_HOOKS - default n + def_bool NEWIP && HCK_VENDOR_HOOKS help Enable NewIP hooks implemented as tracepoints Allow NewIP modules to attach to tracepoint "hooks" defined via diff --git a/newip/src/linux-5.10/net/newip/nip_hooks_register.c b/newip/src/linux-5.10/net/newip/nip_hooks_register.c index 1d942501a1028876b1168f63681373438a91b883..849414efb385d4dddeac9f93698bfbea972ca783 100644 --- a/newip/src/linux-5.10/net/newip/nip_hooks_register.c +++ b/newip/src/linux-5.10/net/newip/nip_hooks_register.c @@ -53,10 +53,12 @@ void nip_ninet_gifconf_lhck_register(void) REGISTER_HCK_LITE_HOOK(nip_ninet_gifconf_lhck, nip_ninet_gifconf); } -void __init ninet_hooks_init(void) +int __init ninet_hooks_init(void) { nip_ninet_ehashfn_lhck_register(); nip_ninet_gifconf_lhck_register(); + + return 0; } void __exit ninet_hooks_exit(void) diff --git a/newip/src/linux-5.10/net/newip/nip_hooks_register.h b/newip/src/linux-5.10/net/newip/nip_hooks_register.h index b1bc8e7febfbd844b31464cac350d37b4a22abf7..43bf43d6a368f9ee00bbc65b5b29057e8f906a33 100644 --- a/newip/src/linux-5.10/net/newip/nip_hooks_register.h +++ b/newip/src/linux-5.10/net/newip/nip_hooks_register.h @@ -13,7 +13,7 @@ #define _NIP_HOOKS_REGISTER_H #ifdef CONFIG_NEWIP_HOOKS -void __init ninet_hooks_init(void); +int __init ninet_hooks_init(void); #endif #endif /* _NIP_HOOKS_REGISTER_H */ diff --git a/newip/third_party/linux-5.10/net/newip/nndisc.c b/newip/third_party/linux-5.10/net/newip/nndisc.c index 918843fa67b9c00820c6c2d495b0918b8e981cc6..6d1e4d2a5734803ed83f2a8a052950bd1fd8ab7a 100644 --- a/newip/third_party/linux-5.10/net/newip/nndisc.c +++ b/newip/third_party/linux-5.10/net/newip/nndisc.c @@ -375,11 +375,22 @@ static void nndisc_send_ns(struct net_device *dev, nip_dbg("dst output fail"); } +static void __send_ns_packet(__u8 nud_state, struct net_device *dev, + const struct nip_addr *target, const struct nip_addr *saddr) +{ + if (nud_state & NUD_VALID) { + nndisc_send_ns(dev, target, target, saddr); + nip_dbg("unicast ns"); + } else { + nndisc_send_ns(dev, target, &nip_broadcast_addr_arp, saddr); + nip_dbg("multicast ns"); + } +} + static void nndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) { struct net_device *dev = neigh->dev; struct nip_addr *target = (struct nip_addr *)&neigh->primary_key; - struct nip_addr *saddr = NULL; struct ninet_dev *idev; /* Obtain the NewIP address from the current dev as @@ -387,22 +398,20 @@ static void nndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) */ rcu_read_lock(); idev = __nin_dev_get(dev); - if (idev) { - read_lock_bh(&idev->lock); - if (!list_empty(&idev->addr_list)) { - struct ninet_ifaddr *ifp; - - list_for_each_entry(ifp, &idev->addr_list, if_list) { - saddr = &ifp->addr; - nndisc_send_ns(dev, target, - &nip_broadcast_addr_arp, - saddr); - } - } - read_unlock_bh(&idev->lock); - } else { + if (!idev) { nip_dbg("idev don't exist"); + rcu_read_unlock(); + return; } + read_lock_bh(&idev->lock); + if (!list_empty(&idev->addr_list)) { + struct ninet_ifaddr *ifp; + + list_for_each_entry(ifp, &idev->addr_list, if_list) { + __send_ns_packet(neigh->nud_state, dev, target, &ifp->addr); + } + } + read_unlock_bh(&idev->lock); rcu_read_unlock(); }