- /* Note that we leave the next hop empty since the recipient fills that in.
- * This is where we add the link cost (currently always 1) to the next peer. */
- if ((trp_inforec_set_trust_router(rec, trp_route_dup_trust_router(route)) != TRP_SUCCESS)
- ||(trp_inforec_set_metric(rec,
- trps_metric_add(trp_route_get_metric(route),
- linkcost)) != TRP_SUCCESS)
- ||(trp_inforec_set_interval(rec, trps_get_update_interval(trps)) != TRP_SUCCESS)) {
+ /*
+ * This is where we add the link cost (currently always 1) to the next peer.
+ *
+ * Here, set next_hop to our TID address/port rather than passing along our own
+ * next_hop. That is the one *we* use to forward requests. We are advertising
+ * ourselves as a hop for our peers.
+ */
+ if ((TRP_SUCCESS != trp_inforec_set_trust_router(rec,
+ trp_route_dup_trust_router(route),
+ trp_route_get_trust_router_port(route)))
+ ||(TRP_SUCCESS != trp_inforec_set_next_hop(rec,
+ tr_new_name(trps->hostname),
+ trps->tids_port))
+ ||(TRP_SUCCESS != trp_inforec_set_metric(rec,
+ trps_metric_add(trp_route_get_metric(route),
+ linkcost)))
+ ||(TRP_SUCCESS != trp_inforec_set_interval(rec, trps_get_update_interval(trps)))) {