* packets take the same place in any dedup tree.
*
* @param[in] instance the context for this function
+ * @param[in] thread_instance the thread instance for this function
+ * @param[in] client the client associated with this packet
* @param[in] packet1 one packet
* @param[in] packet2 a second packet
* @return
* - >0 on packet two "larger" than packet one
* - =0 on the two packets being identical
*/
-typedef int (*fr_io_data_cmp_t)(void const *instance, void const *packet1, void const *packet2);
+typedef int (*fr_io_data_cmp_t)(void const *instance, void *thread_instance, RADCLIENT *client, void const *packet1, void const *packet2);
/** Handle an error on the socket.
*
fr_io_track_t const *b = two;
int rcode;
- /*
- * Call the per-protocol comparison function, if it
- * exists.
- */
- rcode = a->client->inst->app_io->compare(a->client->inst->app_io_instance,
- a->packet, b->packet);
- if (rcode != 0) return rcode;
-
/*
* Connected sockets MUST have all tracking entries use
* the same client definition.
*/
if (a->client->connection) {
rad_assert(a->client == b->client);
+
+ /*
+ * Note that we pass the connection "client", as
+ * we may do negotiation specific to this connection.
+ */
+ rcode = a->client->inst->app_io->compare(a->client->inst->app_io_instance,
+ a->client->connection->child->thread_instance,
+ a->client->connection->client->radclient,
+ a->packet, b->packet);
+ if (rcode != 0) return rcode;
return 0;
}
/*
* Unconnected sockets must check src/dst ip/port.
*/
- return address_cmp(a->address, b->address);
+ rcode = address_cmp(a->address, b->address);
+ if (rcode != 0) return rcode;
+
+ /*
+ * Call the per-protocol comparison function.
+ */
+ return a->client->inst->app_io->compare(a->client->inst->app_io_instance,
+ a->client->thread->child->thread_instance,
+ a->client->radclient,
+ a->packet, b->packet);
}
return 0;
}
-static int mod_compare(UNUSED void const *instance, void const *one, void const *two)
+static int mod_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client,
+ void const *one, void const *two)
{
int rcode;
return 0;
}
-static int mod_compare(UNUSED void const *instance, void const *one, void const *two)
+static int mod_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client,
+ void const *one, void const *two)
{
int rcode;
if (rcode != 0) return rcode;
/*
- * Then ordered by code, which is usally the same.
+ * Then ordered by code, which is usually the same.
*/
return (a[0] < b[0]) - (a[0] > b[0]);
}
return 0;
}
-static int mod_compare(UNUSED void const *instance, void const *one, void const *two)
+static int mod_compare(UNUSED void const *instance, UNUSED void *thread_instance, UNUSED RADCLIENT *client,
+ void const *one, void const *two)
{
int rcode;
uint8_t const *a = one;