NewIP config file and NS modification

1.config NewIP HOOKS are enabled by default.
2.Use unicast to send NS to update the status of neighbor table entries.

Signed-off-by: liangbotong <liangbotong@huawei.com>
This commit is contained in:
liangbotong
2023-07-03 11:45:24 +08:00
parent 0586699f1c
commit 04a1eab82e
4 changed files with 29 additions and 18 deletions
+1 -1
View File
@@ -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
@@ -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)
@@ -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 */
+24 -15
View File
@@ -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();
}