METHOD(child_sa_t, get_usestats, void, 676 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L676>
private_child_sa_t *this, bool inbound, 677 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L677> time_t *time, uint64_t *bytes, uint64_t *packets) 678 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L678> { 679 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L679> if ((!bytes && !packets) || update_usebytes(this, inbound) != FAILED) 680 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L680> { 681 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L681> /* there was traffic since last update or the kernel interface 682 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L682> * does not support querying the number of usebytes. 683 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L683> */ 684 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L684> if (time) 685 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L685> { 686 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L686> if (!update_usetime(this, inbound) && !bytes && !packets) 687 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L687> { 688 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L688> /* if policy query did not yield a usetime, query SAs instead */ 689 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L689> update_usebytes(this, inbound); 690 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L690> } 691 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L691> } 692 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L692> } 693 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L693> if (time) 694 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L694> { 695 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L695> *time = inbound ? this->my_usetime : this->other_usetime; 696 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L696> } 697 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L697> if (bytes) 698 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L698> { 699 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L699> *bytes = inbound ? this->my_usebytes : this->other_usebytes; 700 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L700> } 701 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L701> if (packets) 702 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L702> { 703 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L703> *packets = inbound ? this->my_usepackets : this->other_usepackets; 704 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L704> } 705 <https://wiki.strongswan.org/projects/strongswan/repository/revisions/master/entry/src/libcharon/sa/child_sa.c#L705> } The above get_usestats funtion above gets called with packets, bytes as NULL. In that case is it intended that we first do update_usetime { which sends policy query to kernel } , if that fails do update_usebytes { which send sa query to kernel } ? 2) why is the order policy first if fail query sa important ? why not just query sa ? Thanks, Regards Venu On Fri, 18 Jan 2019 at 16:53, Tobias Brunner <tob...@strongswan.org> wrote: > Hi Venu, > > Sorry, I don't understand what you are asking. Please try to clarify > what confuses you or doesn't meet your expectations. > > Regards, > Tobias > >