diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2009-06-24 14:42:29 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-29 08:52:46 -0500 |
commit | 0d62c4cfe21752df4c1d6e2c2398f15d5eaa794a (patch) | |
tree | 17797b80174a0d19f756ca3255b709d3b191cf7a /slirp/udp.c | |
parent | 6dbe553fe9ffdee008c1bbbe1af2d030e0f04aab (diff) | |
download | qemu-0d62c4cfe21752df4c1d6e2c2398f15d5eaa794a.zip qemu-0d62c4cfe21752df4c1d6e2c2398f15d5eaa794a.tar.gz qemu-0d62c4cfe21752df4c1d6e2c2398f15d5eaa794a.tar.bz2 |
slirp: Drop dead code
After all its years inside the qemu tree, there is no point in keeping
the dead code paths of slirp. This patch is a first round of removing
usually commented out code parts. More cleanups need to follow (and
maybe finally a proper reindention).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'slirp/udp.c')
-rw-r--r-- | slirp/udp.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/slirp/udp.c b/slirp/udp.c index 60fe754..3798e34 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -50,16 +50,6 @@ struct socket udb; static u_int8_t udp_tos(struct socket *so); static void udp_emu(struct socket *so, struct mbuf *m); -/* - * UDP protocol implementation. - * Per RFC 768, August, 1980. - */ -#ifndef COMPAT_42 -#define UDPCKSUM 1 -#else -#define UDPCKSUM 0 /* XXX */ -#endif - struct socket *udp_last_so = &udb; void @@ -76,7 +66,6 @@ udp_input(register struct mbuf *m, int iphlen) { register struct ip *ip; register struct udphdr *uh; -/* struct mbuf *opts = 0;*/ int len; struct ip save_ip; struct socket *so; @@ -129,14 +118,10 @@ udp_input(register struct mbuf *m, int iphlen) /* * Checksum extended UDP header and data. */ - if (UDPCKSUM && uh->uh_sum) { + if (uh->uh_sum) { memset(&((struct ipovly *)ip)->ih_mbuf, 0, sizeof(struct mbuf_ptr)); ((struct ipovly *)ip)->ih_x1 = 0; ((struct ipovly *)ip)->ih_len = uh->uh_ulen; - /* keep uh_sum for ICMP reply - * uh->uh_sum = cksum(m, len + sizeof (struct ip)); - * if (uh->uh_sum) { - */ if(cksum(m, len + sizeof(struct ip))) { STAT(udpstat.udps_badsum++); goto bad; @@ -201,7 +186,6 @@ udp_input(register struct mbuf *m, int iphlen) /* * Setup fields */ - /* udp_last_so = so; */ so->so_laddr = ip->ip_src; so->so_lport = uh->uh_sport; @@ -246,7 +230,6 @@ udp_input(register struct mbuf *m, int iphlen) return; bad: m_freem(m); - /* if (opts) m_freem(opts); */ return; } @@ -277,7 +260,7 @@ int udp_output2(struct socket *so, struct mbuf *m, memset(&ui->ui_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); ui->ui_x1 = 0; ui->ui_pr = IPPROTO_UDP; - ui->ui_len = htons(m->m_len - sizeof(struct ip)); /* + sizeof (struct udphdr)); */ + ui->ui_len = htons(m->m_len - sizeof(struct ip)); /* XXXXX Check for from-one-location sockets, or from-any-location sockets */ ui->ui_src = saddr->sin_addr; ui->ui_dst = daddr->sin_addr; @@ -289,10 +272,8 @@ int udp_output2(struct socket *so, struct mbuf *m, * Stuff checksum and output datagram. */ ui->ui_sum = 0; - if (UDPCKSUM) { - if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0) + if ((ui->ui_sum = cksum(m, m->m_len)) == 0) ui->ui_sum = 0xffff; - } ((struct ip *)ui)->ip_len = m->m_len; ((struct ip *)ui)->ip_ttl = IPDEFTTL; @@ -363,8 +344,6 @@ void udp_detach(struct socket *so) { closesocket(so->s); - /* if (so->so_m) m_free(so->so_m); done by sofree */ - sofree(so); } @@ -651,7 +630,6 @@ udp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, return NULL; } setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)); -/* setsockopt(so->s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int)); */ getsockname(so->s,(struct sockaddr *)&addr,&addrlen); so->so_fport = addr.sin_port; |