mirror of
https://github.com/openharmony/kernel_linux_common_modules.git
synced 2026-08-26 17:16:37 -04:00
!34 NEWIP HOOKS恢复默认开启、支持单播方式发送NS
Merge pull request !34 from liangbotong/master
This commit is contained in:
@@ -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
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user