Commit 285f7a62e464eac97e472ba6803ddede1e6c459e
Committed by
Anthony Liguori
1 parent
df461894
slirp: Make IP packet ID consistent
Currently, ip_id is always initialized to 0 on slirp startup (despite the broken attempt to derive it from the clock). This is good for reproducibility. But it is not preserved across save/restore. This patch therefore drops the dead initialization code from ip_init and introduces ip_id to the persistent slirp state. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
2 changed files
with
7 additions
and
2 deletions
slirp/ip_input.c
slirp/slirp.c
... | ... | @@ -234,7 +234,7 @@ void slirp_init(int restricted, struct in_addr vnetwork, |
234 | 234 | vdhcp_startaddr = vdhcp_start; |
235 | 235 | vnameserver_addr = vnameserver; |
236 | 236 | |
237 | - register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL); | |
237 | + register_savevm("slirp", 0, 2, slirp_state_save, slirp_state_load, NULL); | |
238 | 238 | } |
239 | 239 | |
240 | 240 | #define CONN_CANFSEND(so) (((so)->so_state & (SS_FCANTSENDMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED) |
... | ... | @@ -973,6 +973,8 @@ static void slirp_state_save(QEMUFile *f, void *opaque) |
973 | 973 | slirp_socket_save(f, so); |
974 | 974 | } |
975 | 975 | qemu_put_byte(f, 0); |
976 | + | |
977 | + qemu_put_be16(f, ip_id); | |
976 | 978 | } |
977 | 979 | |
978 | 980 | static void slirp_tcp_load(QEMUFile *f, struct tcpcb *tp) |
... | ... | @@ -1103,5 +1105,9 @@ static int slirp_state_load(QEMUFile *f, void *opaque, int version_id) |
1103 | 1105 | so->extra = (void *)ex_ptr->ex_exec; |
1104 | 1106 | } |
1105 | 1107 | |
1108 | + if (version_id >= 2) { | |
1109 | + ip_id = qemu_get_be16(f); | |
1110 | + } | |
1111 | + | |
1106 | 1112 | return 0; |
1107 | 1113 | } | ... | ... |