inet_diag.c (efb3cb428dcde2356802b3f93e152efa7abc5a62) | inet_diag.c (8d07d1518a074a08b90be02eee5ee15e60ac9779) |
---|---|
1/* 2 * inet_diag.c Module for monitoring INET transport protocols sockets. 3 * 4 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 435 unchanged lines hidden (view full) --- 444 } else { 445 len -= op->no; 446 bc += op->no; 447 } 448 } 449 return len == 0; 450} 451 | 1/* 2 * inet_diag.c Module for monitoring INET transport protocols sockets. 3 * 4 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 435 unchanged lines hidden (view full) --- 444 } else { 445 len -= op->no; 446 bc += op->no; 447 } 448 } 449 return len == 0; 450} 451 |
452int inet_diag_bc_sk(const struct nlattr *bc, struct sock *sk) 453{ 454 struct inet_diag_entry entry; 455 struct inet_sock *inet = inet_sk(sk); 456 457 if (bc == NULL) 458 return 1; 459 460 entry.family = sk->sk_family; 461#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 462 if (entry.family == AF_INET6) { 463 struct ipv6_pinfo *np = inet6_sk(sk); 464 465 entry.saddr = np->rcv_saddr.s6_addr32; 466 entry.daddr = np->daddr.s6_addr32; 467 } else 468#endif 469 { 470 entry.saddr = &inet->inet_rcv_saddr; 471 entry.daddr = &inet->inet_daddr; 472 } 473 entry.sport = inet->inet_num; 474 entry.dport = ntohs(inet->inet_dport); 475 entry.userlocks = sk->sk_userlocks; 476 477 return inet_diag_bc_run(bc, &entry); 478} 479EXPORT_SYMBOL_GPL(inet_diag_bc_sk); 480 |
|
452static int valid_cc(const void *bc, int len, int cc) 453{ 454 while (len >= 0) { 455 const struct inet_diag_bc_op *op = bc; 456 457 if (cc > len) 458 return 0; 459 if (cc == len) --- 44 unchanged lines hidden (view full) --- 504} 505 506static int inet_csk_diag_dump(struct sock *sk, 507 struct sk_buff *skb, 508 struct netlink_callback *cb, 509 struct inet_diag_req *r, 510 const struct nlattr *bc) 511{ | 481static int valid_cc(const void *bc, int len, int cc) 482{ 483 while (len >= 0) { 484 const struct inet_diag_bc_op *op = bc; 485 486 if (cc > len) 487 return 0; 488 if (cc == len) --- 44 unchanged lines hidden (view full) --- 533} 534 535static int inet_csk_diag_dump(struct sock *sk, 536 struct sk_buff *skb, 537 struct netlink_callback *cb, 538 struct inet_diag_req *r, 539 const struct nlattr *bc) 540{ |
512 if (bc != NULL) { 513 struct inet_diag_entry entry; 514 struct inet_sock *inet = inet_sk(sk); | 541 if (!inet_diag_bc_sk(bc, sk)) 542 return 0; |
515 | 543 |
516 entry.family = sk->sk_family; 517#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 518 if (entry.family == AF_INET6) { 519 struct ipv6_pinfo *np = inet6_sk(sk); 520 521 entry.saddr = np->rcv_saddr.s6_addr32; 522 entry.daddr = np->daddr.s6_addr32; 523 } else 524#endif 525 { 526 entry.saddr = &inet->inet_rcv_saddr; 527 entry.daddr = &inet->inet_daddr; 528 } 529 entry.sport = inet->inet_num; 530 entry.dport = ntohs(inet->inet_dport); 531 entry.userlocks = sk->sk_userlocks; 532 533 if (!inet_diag_bc_run(bc, &entry)) 534 return 0; 535 } 536 | |
537 return inet_csk_diag_fill(sk, skb, r, 538 NETLINK_CB(cb->skb).pid, 539 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh); 540} 541 542static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, 543 struct sk_buff *skb, 544 struct netlink_callback *cb, --- 523 unchanged lines hidden --- | 544 return inet_csk_diag_fill(sk, skb, r, 545 NETLINK_CB(cb->skb).pid, 546 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh); 547} 548 549static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, 550 struct sk_buff *skb, 551 struct netlink_callback *cb, --- 523 unchanged lines hidden --- |