示例#1
0
int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk)
{
	struct inet_sock *inet = inet_sk(sk);
	struct inet_diag_entry entry;

	if (!bc)
		return 1;

	entry.family = sk->sk_family;
	entry_fill_addrs(&entry, sk);
	entry.sport = inet->inet_num;
	entry.dport = ntohs(inet->inet_dport);
	entry.userlocks = sk_fullsock(sk) ? sk->sk_userlocks : 0;

	return inet_diag_bc_run(bc, &entry);
}
示例#2
0
文件: inet_diag.c 项目: mhei/linux
int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk)
{
    struct inet_sock *inet = inet_sk(sk);
    struct inet_diag_entry entry;

    if (!bc)
        return 1;

    entry.family = sk->sk_family;
    entry_fill_addrs(&entry, sk);
    entry.sport = inet->inet_num;
    entry.dport = ntohs(inet->inet_dport);
    entry.ifindex = sk->sk_bound_dev_if;
    entry.userlocks = sk_fullsock(sk) ? sk->sk_userlocks : 0;
    if (sk_fullsock(sk))
        entry.mark = sk->sk_mark;
    else if (sk->sk_state == TCP_NEW_SYN_RECV)
        entry.mark = inet_rsk(inet_reqsk(sk))->ir_mark;
    else
        entry.mark = 0;

    return inet_diag_bc_run(bc, &entry);
}