mirror of
https://github.com/openharmony/kernel_common_modules_newip.git
synced 2026-07-20 00:53:31 -04:00
@@ -186,7 +186,7 @@ out_rcu_unlock:
|
||||
number_sub:
|
||||
atomic_dec_if_positive(&g_nip_socket_number);
|
||||
num = atomic_read(&g_nip_socket_number);
|
||||
nip_dbg("The final number of socket is: %d", num);
|
||||
nip_dbg("[error] The final number of socket is: %d (after dec)", num);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,12 @@ rcu_lock_out:
|
||||
rcu_read_unlock_bh();
|
||||
|
||||
if (likely(err == 0)) {
|
||||
nip_dbg("success, idev->refcnt=%u", refcount_read(&idev->refcnt));
|
||||
char add_addr[NIP_ADDR_BIT_LEN_MAX] = {0};
|
||||
|
||||
nip_addr_to_str(addr, add_addr, NIP_ADDR_BIT_LEN_MAX);
|
||||
nip_dbg("success, %s ifindex=%u (addr=%s, idev->refcnt=%u, ifa->refcnt=%u)",
|
||||
idev->dev->name, idev->dev->ifindex, add_addr,
|
||||
refcount_read(&idev->refcnt), refcount_read(&ifa->refcnt));
|
||||
} else {
|
||||
kfree(ifa);
|
||||
nin_dev_put(idev);
|
||||
@@ -362,11 +367,16 @@ static int ninet_addr_del(struct net *net, int ifindex, u32 ifa_flags,
|
||||
read_lock_bh(&idev->lock);
|
||||
list_for_each_entry(ifp, &idev->addr_list, if_list) {
|
||||
if (nip_addr_eq(pfx, &ifp->addr)) {
|
||||
char addr[NIP_ADDR_BIT_LEN_MAX] = {0};
|
||||
|
||||
nin_ifa_hold(ifp);
|
||||
read_unlock_bh(&idev->lock);
|
||||
|
||||
nip_addr_to_str(&ifp->addr, addr, NIP_ADDR_BIT_LEN_MAX);
|
||||
nip_del_addr(ifp);
|
||||
nip_dbg("nip_addr_del: success");
|
||||
nip_dbg("success, %s ifindex=%u (addr=%s, ifp->refcnt=%u, idev->refcnt=%u)",
|
||||
idev->dev->name, ifindex, addr, refcount_read(&ifp->refcnt),
|
||||
refcount_read(&idev->refcnt));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,8 @@ int nip_fib_add(struct hlist_head *nip_tb_head, struct nip_rt_info *rt)
|
||||
int err = 0;
|
||||
struct hlist_head *h;
|
||||
unsigned int hash;
|
||||
char dst[NIP_ADDR_BIT_LEN_MAX] = {0};
|
||||
char gateway[NIP_ADDR_BIT_LEN_MAX] = {0};
|
||||
|
||||
hash = ninet_route_hash(&rt->rt_dst);
|
||||
h = &nip_tb_head[hash];
|
||||
@@ -133,6 +135,11 @@ int nip_fib_add(struct hlist_head *nip_tb_head, struct nip_rt_info *rt)
|
||||
rcu_assign_pointer(rt->rt_node, new_node);
|
||||
atomic_inc(&rt->rt_ref);
|
||||
hlist_add_tail_rcu(&new_node->fib_hlist, h);
|
||||
nip_addr_to_str(&rt->rt_dst, dst, NIP_ADDR_BIT_LEN_MAX);
|
||||
nip_addr_to_str(&rt->gateway, gateway, NIP_ADDR_BIT_LEN_MAX);
|
||||
nip_dbg("%s ifindex=%u (addr=%s, gateway=%s, rt_idev->refcnt=%u)",
|
||||
rt->rt_idev->dev->name, rt->rt_idev->dev->ifindex,
|
||||
dst, gateway, refcount_read(&rt->rt_idev->refcnt));
|
||||
|
||||
out:
|
||||
return err;
|
||||
@@ -183,6 +190,7 @@ static void nip_fib_clean_hash(struct net *net, struct hlist_head *nip_tb_head,
|
||||
void *arg)
|
||||
{
|
||||
int i;
|
||||
int err;
|
||||
struct nip_fib_node *fn;
|
||||
struct hlist_node *tmp;
|
||||
struct nl_info info = {
|
||||
@@ -203,7 +211,9 @@ static void nip_fib_clean_hash(struct net *net, struct hlist_head *nip_tb_head,
|
||||
NIP_ADDR_BIT_LEN_MAX);
|
||||
|
||||
nip_dbg("try to del rt_info, rt_dst=%s, gateway=%s", dst, gateway);
|
||||
nip_fib_del(fn->nip_route_info, &info);
|
||||
err = nip_fib_del(fn->nip_route_info, &info);
|
||||
if (err)
|
||||
nip_dbg("nip_fib_del failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user