提交 285f7a62 编写于 作者: J Jan Kiszka 提交者: Anthony Liguori

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: NJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 df461894
...@@ -59,7 +59,6 @@ void ...@@ -59,7 +59,6 @@ void
ip_init(void) ip_init(void)
{ {
ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link; ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link;
ip_id = tt.tv_sec & 0xffff;
udp_init(); udp_init();
tcp_init(); tcp_init();
} }
......
...@@ -234,7 +234,7 @@ void slirp_init(int restricted, struct in_addr vnetwork, ...@@ -234,7 +234,7 @@ void slirp_init(int restricted, struct in_addr vnetwork,
vdhcp_startaddr = vdhcp_start; vdhcp_startaddr = vdhcp_start;
vnameserver_addr = vnameserver; vnameserver_addr = vnameserver;
register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL); register_savevm("slirp", 0, 2, slirp_state_save, slirp_state_load, NULL);
} }
#define CONN_CANFSEND(so) (((so)->so_state & (SS_FCANTSENDMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED) #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,6 +973,8 @@ static void slirp_state_save(QEMUFile *f, void *opaque)
slirp_socket_save(f, so); slirp_socket_save(f, so);
} }
qemu_put_byte(f, 0); qemu_put_byte(f, 0);
qemu_put_be16(f, ip_id);
} }
static void slirp_tcp_load(QEMUFile *f, struct tcpcb *tp) 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,5 +1105,9 @@ static int slirp_state_load(QEMUFile *f, void *opaque, int version_id)
so->extra = (void *)ex_ptr->ex_exec; so->extra = (void *)ex_ptr->ex_exec;
} }
if (version_id >= 2) {
ip_id = qemu_get_be16(f);
}
return 0; return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册