gtphub: fix restart cleanup peer matching.

Adjust test expectations accordingly.

Sponsored-by: On-Waves ehi
diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index 55b9004..2ae8678 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -1791,7 +1791,11 @@
 	llist_for_each_entry(tun, &hub->tunnels, entry) {
 		int side_idx;
 		for_each_side(side_idx) {
-			if (pp != tun->endpoint[side_idx][GTPH_PLANE_CTRL].peer)
+			struct gtphub_tunnel_endpoint *te = &tun->endpoint[side_idx][GTPH_PLANE_CTRL];
+			struct gtphub_tunnel_endpoint *te2 = &tun->endpoint[other_side_idx(side_idx)][GTPH_PLANE_CTRL];
+			if ((!te->peer)
+			    || (!te2->tei_orig)
+			    || (pp->peer_addr->peer != te->peer->peer_addr->peer))
 				continue;
 
 			LOG(LOGL_DEBUG, "Deleting tunnel due to peer restart: %s\n",
diff --git a/openbsc/tests/gtphub/gtphub_test.c b/openbsc/tests/gtphub/gtphub_test.c
index 0992d79..d070963 100644
--- a/openbsc/tests/gtphub/gtphub_test.c
+++ b/openbsc/tests/gtphub/gtphub_test.c
@@ -1320,7 +1320,7 @@
 			       );
 	const char *gtp_req_to_ggsn =
 		MSG_PDP_CTX_REQ("0068",
-				"6d32",	/* mapped seq ("1234") */
+				"6d33",	/* mapped seq ("1234") */
 				"23",
 				"42000121436587f9",
 				"00000006", /* mapped TEI Data I ("123") */
@@ -1340,7 +1340,7 @@
 		"192.168.42.23 (TEI C cba=5 / U abc=6)"
 		" <-> 192.168.43.34 / (uninitialized) (TEI C 0=0 / U 0=0)"
 		" @21955\n"
-		"192.168.42.23 (TEI C 321=1 / U 123=2)"
+		"(uninitialized) (TEI C 321=1 / U 123=2)"
 		" <-> 192.168.43.34 (TEI C 765=3 / U 567=4)"
 		" @21945\n"
 		));
@@ -1348,7 +1348,7 @@
 	const char *gtp_resp_from_ggsn =
 		MSG_PDP_CTX_RSP("004e",
 				"00000005", /* destination TEI (sent in req above) */
-				"6d32", /* mapped seq */
+				"6d33", /* mapped seq */
 				"01", /* restart */
 				"00000def", /* TEI U */
 				"00000fde", /* TEI C */
diff --git a/openbsc/tests/gtphub/gtphub_test.ok b/openbsc/tests/gtphub/gtphub_test.ok
index a95fe6d..be9e19f 100644
--- a/openbsc/tests/gtphub/gtphub_test.ok
+++ b/openbsc/tests/gtphub/gtphub_test.ok
@@ -19,6 +19,9 @@
   returning GGSN addr from imsi 240010123456789 ni internet: 192.168.43.34 port 2123
 - __wrap_gtphub_resolve_ggsn_addr():
   returning GGSN addr from imsi 240010123456789 ni internet: 192.168.43.34 port 2123
+Out-of-band gtphub_write(16):
+to 192.168.43.34 port 2123
+32 14 00 08 00 00 07 65 6d 32 00 00 13 ff 14 00 
 test_peer_restarted_reusing_tei
 - __wrap_gtphub_resolve_ggsn_addr():
   returning GGSN addr from imsi 240010123456789 ni internet: 192.168.43.34 port 2123