inet_diag.c (7b35eadd7eee2e0b42421ce3efbc30f1c3c745e5) inet_diag.c (87c22ea52e1bb467f58b3e9a71509fccb70c7bd3)
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

--- 341 unchanged lines hidden (view full) ---

350 if ((w1 ^ w2) & mask)
351 return 0;
352 }
353
354 return 1;
355}
356
357
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

--- 341 unchanged lines hidden (view full) ---

350 if ((w1 ^ w2) & mask)
351 return 0;
352 }
353
354 return 1;
355}
356
357
358static int inet_diag_bc_run(const void *bc, int len,
359 const struct inet_diag_entry *entry)
358static int inet_diag_bc_run(const struct nlattr *_bc,
359 const struct inet_diag_entry *entry)
360{
360{
361 const void *bc = nla_data(_bc);
362 int len = nla_len(_bc);
363
361 while (len > 0) {
362 int yes = 1;
363 const struct inet_diag_bc_op *op = bc;
364
365 switch (op->code) {
366 case INET_DIAG_BC_NOP:
367 break;
368 case INET_DIAG_BC_JMP:

--- 138 unchanged lines hidden (view full) ---

507 {
508 entry.saddr = &inet->inet_rcv_saddr;
509 entry.daddr = &inet->inet_daddr;
510 }
511 entry.sport = inet->inet_num;
512 entry.dport = ntohs(inet->inet_dport);
513 entry.userlocks = sk->sk_userlocks;
514
364 while (len > 0) {
365 int yes = 1;
366 const struct inet_diag_bc_op *op = bc;
367
368 switch (op->code) {
369 case INET_DIAG_BC_NOP:
370 break;
371 case INET_DIAG_BC_JMP:

--- 138 unchanged lines hidden (view full) ---

510 {
511 entry.saddr = &inet->inet_rcv_saddr;
512 entry.daddr = &inet->inet_daddr;
513 }
514 entry.sport = inet->inet_num;
515 entry.dport = ntohs(inet->inet_dport);
516 entry.userlocks = sk->sk_userlocks;
517
515 if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry))
518 if (!inet_diag_bc_run(bc, &entry))
516 return 0;
517 }
518
519 return inet_csk_diag_fill(sk, skb, r,
520 NETLINK_CB(cb->skb).pid,
521 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
522}
523

--- 18 unchanged lines hidden (view full) ---

542 {
543 entry.saddr = &tw->tw_rcv_saddr;
544 entry.daddr = &tw->tw_daddr;
545 }
546 entry.sport = tw->tw_num;
547 entry.dport = ntohs(tw->tw_dport);
548 entry.userlocks = 0;
549
519 return 0;
520 }
521
522 return inet_csk_diag_fill(sk, skb, r,
523 NETLINK_CB(cb->skb).pid,
524 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
525}
526

--- 18 unchanged lines hidden (view full) ---

545 {
546 entry.saddr = &tw->tw_rcv_saddr;
547 entry.daddr = &tw->tw_daddr;
548 }
549 entry.sport = tw->tw_num;
550 entry.dport = ntohs(tw->tw_dport);
551 entry.userlocks = 0;
552
550 if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry))
553 if (!inet_diag_bc_run(bc, &entry))
551 return 0;
552 }
553
554 return inet_twsk_diag_fill(tw, skb, r,
555 NETLINK_CB(cb->skb).pid,
556 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
557}
558

--- 104 unchanged lines hidden (view full) ---

663 entry.daddr =
664#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
665 (entry.family == AF_INET6) ?
666 inet6_rsk(req)->rmt_addr.s6_addr32 :
667#endif
668 &ireq->rmt_addr;
669 entry.dport = ntohs(ireq->rmt_port);
670
554 return 0;
555 }
556
557 return inet_twsk_diag_fill(tw, skb, r,
558 NETLINK_CB(cb->skb).pid,
559 cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh);
560}
561

--- 104 unchanged lines hidden (view full) ---

666 entry.daddr =
667#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
668 (entry.family == AF_INET6) ?
669 inet6_rsk(req)->rmt_addr.s6_addr32 :
670#endif
671 &ireq->rmt_addr;
672 entry.dport = ntohs(ireq->rmt_port);
673
671 if (!inet_diag_bc_run(nla_data(bc),
672 nla_len(bc), &entry))
674 if (!inet_diag_bc_run(bc, &entry))
673 continue;
674 }
675
676 err = inet_diag_fill_req(skb, sk, req,
677 NETLINK_CB(cb->skb).pid,
678 cb->nlh->nlmsg_seq, cb->nlh);
679 if (err < 0) {
680 cb->args[3] = j + 1;

--- 366 unchanged lines hidden ---
675 continue;
676 }
677
678 err = inet_diag_fill_req(skb, sk, req,
679 NETLINK_CB(cb->skb).pid,
680 cb->nlh->nlmsg_seq, cb->nlh);
681 if (err < 0) {
682 cb->args[3] = j + 1;

--- 366 unchanged lines hidden ---