On 1/4/2019 1:55 AM, Konstantin Ananyev wrote:
> /* process ipv4 packets */
> - inbound_sp_sa(ctx->sp4_ctx, ctx->sa_ctx, &trf.ip4, 0);
> - route4_pkts(qconf->rt4_ctx, trf.ip4.pkts, trf.ip4.num);
> + if (trf.ip4.num != 0) {
> + inbound_sp_sa(ctx->sp4_ctx, ctx->sa_ctx, &trf.ip4, 0);
> + route4_pkts(qconf->rt4_ctx, trf.ip4.pkts, trf.ip4.num);
> + }
>
> /* process ipv6 packets */
> - inbound_sp_sa(ctx->sp6_ctx, ctx->sa_ctx, &trf.ip6, 0);
> - route6_pkts(qconf->rt6_ctx, trf.ip6.pkts, trf.ip6.num);
> + if (trf.ip6.num != 0) {
> + inbound_sp_sa(ctx->sp6_ctx, ctx->sa_ctx, &trf.ip6, 0);
> + route6_pkts(qconf->rt6_ctx, trf.ip6.pkts, trf.ip6.num);
> + }
One more thing.
Why do you need these changes. There are multiple places where this
change is done.
route6_pkts and route4_pkts already checks that internally for 0 pkts.
inbound_sp_sa also does that.
These are getting called from multiple places. So it is better we add this
check inside the function itself instead of outside it.