提交 9b5a30dc 编写于 作者: G Guillaume Subiron 提交者: Jason Wang

slirp: Make udp_attach IPv6 compatible

A unsigned short is now passed in argument to udp_attach instead of using a
hardcoded "AF_INET" to call qemu_socket().

This prepares for IPv6 support.
Signed-off-by: NGuillaume Subiron <maethor@subiron.org>
Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: NThomas Huth <thuth@redhat.com>
Signed-off-by: NJason Wang <jasowang@redhat.com>
上级 8a87f121
......@@ -162,7 +162,7 @@ icmp_input(struct mbuf *m, int hlen)
if (icmp_send(so, m, hlen) == 0) {
return;
}
if(udp_attach(so) == -1) {
if (udp_attach(so, AF_INET) == -1) {
DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n",
errno,strerror(errno)));
sofree(so);
......
......@@ -169,7 +169,7 @@ udp_input(register struct mbuf *m, int iphlen)
if (!so) {
goto bad;
}
if(udp_attach(so) == -1) {
if (udp_attach(so, AF_INET) == -1) {
DEBUG_MISC((dfd," udp_attach errno = %d-%s\n",
errno,strerror(errno)));
sofree(so);
......@@ -277,9 +277,10 @@ int udp_output(struct socket *so, struct mbuf *m,
}
int
udp_attach(struct socket *so)
udp_attach(struct socket *so, unsigned short af)
{
if((so->s = qemu_socket(AF_INET,SOCK_DGRAM,0)) != -1) {
so->s = qemu_socket(af, SOCK_DGRAM, 0);
if (so->s != -1) {
so->so_expire = curtime + SO_EXPIRE;
insque(so, &so->slirp->udb);
}
......
......@@ -76,7 +76,7 @@ struct mbuf;
void udp_init(Slirp *);
void udp_cleanup(Slirp *);
void udp_input(register struct mbuf *, int);
int udp_attach(struct socket *);
int udp_attach(struct socket *, unsigned short af);
void udp_detach(struct socket *);
struct socket * udp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int,
int);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册