|
1 |
| -/* $OpenBSD: ikev2.c,v 1.390 2024/11/21 13:26:49 claudio Exp $ */ |
| 1 | +/* $OpenBSD: ikev2.c,v 1.391 2025/03/13 17:49:37 tobhe Exp $ */ |
2 | 2 |
|
3 | 3 | /*
|
4 | 4 | * Copyright (c) 2019 Tobias Heider <[email protected]>
|
@@ -790,19 +790,6 @@ ikev2_recv(struct iked *env, struct iked_message *msg)
|
790 | 790 | sa->sa_msgid_current = msg->msg_msgid;
|
791 | 791 | }
|
792 | 792 |
|
793 |
| - if (sa_address(sa, &sa->sa_peer, (struct sockaddr *)&msg->msg_peer) |
794 |
| - == -1 || |
795 |
| - sa_address(sa, &sa->sa_local, (struct sockaddr *)&msg->msg_local) |
796 |
| - == -1) { |
797 |
| - ikestat_inc(env, ikes_msg_rcvd_dropped); |
798 |
| - return; |
799 |
| - } |
800 |
| - |
801 |
| - sa->sa_fd = msg->msg_fd; |
802 |
| - |
803 |
| - log_debug("%s: updated SA to peer %s local %s", __func__, |
804 |
| - print_addr(&sa->sa_peer.addr), print_addr(&sa->sa_local.addr)); |
805 |
| - |
806 | 793 | done:
|
807 | 794 | if (initiator)
|
808 | 795 | ikev2_init_recv(env, msg, hdr);
|
@@ -1218,6 +1205,17 @@ ikev2_init_recv(struct iked *env, struct iked_message *msg,
|
1218 | 1205 | return;
|
1219 | 1206 | }
|
1220 | 1207 |
|
| 1208 | + if (sa_address(sa, &sa->sa_peer, (struct sockaddr *)&msg->msg_peer) |
| 1209 | + == -1 || |
| 1210 | + sa_address(sa, &sa->sa_local, (struct sockaddr *)&msg->msg_local) |
| 1211 | + == -1) { |
| 1212 | + ikestat_inc(env, ikes_msg_rcvd_dropped); |
| 1213 | + return; |
| 1214 | + } |
| 1215 | + sa->sa_fd = msg->msg_fd; |
| 1216 | + log_debug("%s: updated SA to peer %s local %s", __func__, |
| 1217 | + print_addr(&sa->sa_peer.addr), print_addr(&sa->sa_local.addr)); |
| 1218 | + |
1221 | 1219 | if (sa->sa_fragments.frag_count != 0)
|
1222 | 1220 | return;
|
1223 | 1221 |
|
@@ -2990,6 +2988,17 @@ ikev2_resp_recv(struct iked *env, struct iked_message *msg,
|
2990 | 2988 | if ((sa = msg->msg_sa) == NULL)
|
2991 | 2989 | return;
|
2992 | 2990 |
|
| 2991 | + if (sa_address(sa, &sa->sa_peer, (struct sockaddr *)&msg->msg_peer) |
| 2992 | + == -1 || |
| 2993 | + sa_address(sa, &sa->sa_local, (struct sockaddr *)&msg->msg_local) |
| 2994 | + == -1) { |
| 2995 | + ikestat_inc(env, ikes_msg_rcvd_dropped); |
| 2996 | + return; |
| 2997 | + } |
| 2998 | + sa->sa_fd = msg->msg_fd; |
| 2999 | + log_debug("%s: updated SA to peer %s local %s", __func__, |
| 3000 | + print_addr(&sa->sa_peer.addr), print_addr(&sa->sa_local.addr)); |
| 3001 | + |
2993 | 3002 | if (sa->sa_fragments.frag_count != 0)
|
2994 | 3003 | return;
|
2995 | 3004 |
|
|
0 commit comments