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 | d89b93db4f609ff4a4728465fe9066b1027bf077 (patch) | |
tree | 56059827a90fbbefac6388842404a43454b44d83 /udp.c | |
parent | dfae34b4a7c99e25a3deb4c9ca51ea41ffa974c9 (diff) | |
download | slirp-d89b93db4f609ff4a4728465fe9066b1027bf077.zip slirp-d89b93db4f609ff4a4728465fe9066b1027bf077.tar.gz slirp-d89b93db4f609ff4a4728465fe9066b1027bf077.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 'udp.c')
-rw-r--r-- | udp.c | 32 |
1 files changed, 4 insertions, 28 deletions
@@ -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 udp_init(void) @@ -74,7 +64,6 @@ void 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; @@ -127,14 +116,10 @@ void 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; @@ -200,7 +185,6 @@ void 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; @@ -245,7 +229,6 @@ void udp_input(register struct mbuf *m, int iphlen) return; bad: m_freem(m); - /* if (opts) m_freem(opts); */ return; } @@ -275,8 +258,7 @@ int udp_output2(struct socket *so, struct mbuf *m, struct sockaddr_in *saddr, 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; @@ -289,11 +271,8 @@ int udp_output2(struct socket *so, struct mbuf *m, struct sockaddr_in *saddr, * Stuff checksum and output datagram. */ ui->ui_sum = 0; - if (UDPCKSUM) { - if ((ui->ui_sum = - cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0) - ui->ui_sum = 0xffff; - } + 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; @@ -361,8 +340,6 @@ int udp_attach(struct socket *so) void udp_detach(struct socket *so) { closesocket(so->s); - /* if (so->so_m) m_free(so->so_m); done by sofree */ - sofree(so); } @@ -645,7 +622,6 @@ struct socket *udp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, 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; |