if ((s = sessionbyip(ip)))
{
- if (s == grpsession[g].smax)
+ if (g != grp_groupbysession(s))
+ {
+ // This session does not belong to this group
+ LOG(2, s, session[s].tunnel, "Warning, the session does not belong to group %d\n", g);
+ s = 0;
+ }
+ else if (s == grpsession[g].smax)
{
s = grpsession[g].smin;
grpsession[g].smax = 0;