diff options
-rw-r--r-- | src/if.c | 19 | ||||
-rw-r--r-- | src/ip_icmp.c | 2 | ||||
-rw-r--r-- | src/ip_input.c | 10 | ||||
-rw-r--r-- | src/mbuf.c | 14 | ||||
-rw-r--r-- | src/misc.c | 22 | ||||
-rw-r--r-- | src/slirp.h | 14 | ||||
-rw-r--r-- | src/socket.c | 12 | ||||
-rw-r--r-- | src/tcp_input.c | 6 | ||||
-rw-r--r-- | src/tcp_subr.c | 4 | ||||
-rw-r--r-- | src/udp.c | 4 |
10 files changed, 51 insertions, 56 deletions
@@ -56,7 +56,7 @@ void if_output(struct socket *so, struct mbuf *ifm) * XXX Shouldn't need this, gotta change dtom() etc. */ if (ifm->m_flags & M_USEDLIST) { - remque(ifm); + slirp_remque(ifm); ifm->m_flags &= ~M_USEDLIST; } @@ -70,7 +70,8 @@ void if_output(struct socket *so, struct mbuf *ifm) */ if (so) { for (ifq = (struct mbuf *)slirp->if_batchq.qh_rlink; - (struct quehead *)ifq != &slirp->if_batchq; ifq = ifq->ifq_prev) { + (struct slirp_quehead *)ifq != &slirp->if_batchq; + ifq = ifq->ifq_prev) { if (so == ifq->ifq_so) { /* A match! */ ifm->ifq_so = so; @@ -100,7 +101,7 @@ void if_output(struct socket *so, struct mbuf *ifm) /* Create a new doubly linked list for this session */ ifm->ifq_so = so; ifs_init(ifm); - insque(ifm, ifq); + slirp_insque(ifm, ifq); diddit: if (so) { @@ -117,10 +118,10 @@ diddit: if (on_fastq && ((so->so_nqueued >= 6) && (so->so_nqueued - so->so_queued) >= 3)) { /* Remove from current queue... */ - remque(ifm->ifs_next); + slirp_remque(ifm->ifs_next); /* ...And insert in the new. That'll teach ya! */ - insque(ifm->ifs_next, &slirp->if_batchq); + slirp_insque(ifm->ifs_next, &slirp->if_batchq); } } @@ -171,12 +172,12 @@ void if_start(Slirp *slirp) ifm = ifm_next; ifm_next = ifm->ifq_next; - if ((struct quehead *)ifm_next == &slirp->if_fastq) { + if ((struct slirp_quehead *)ifm_next == &slirp->if_fastq) { /* No more packets in fastq, switch to batchq */ ifm_next = batch_head; from_batchq = true; } - if ((struct quehead *)ifm_next == &slirp->if_batchq) { + if ((struct slirp_quehead *)ifm_next == &slirp->if_batchq) { /* end of batchq */ ifm_next = NULL; } @@ -189,13 +190,13 @@ void if_start(Slirp *slirp) /* Remove it from the queue */ ifqt = ifm->ifq_prev; - remque(ifm); + slirp_remque(ifm); /* If there are more packets for this session, re-queue them */ if (ifm->ifs_next != ifm) { struct mbuf *next = ifm->ifs_next; - insque(next, ifqt); + slirp_insque(next, ifqt); ifs_remque(ifm); if (!from_batchq) { ifm_next = next; diff --git a/src/ip_icmp.c b/src/ip_icmp.c index 554ffa2..6ae523c 100644 --- a/src/ip_icmp.c +++ b/src/ip_icmp.c @@ -138,7 +138,7 @@ static int icmp_send(struct socket *so, struct mbuf *m, int hlen) addr.sin_family = AF_INET; addr.sin_addr = so->so_faddr; - insque(so, &so->slirp->icmp); + slirp_insque(so, &so->slirp->icmp); if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0, (struct sockaddr *)&addr, sizeof(addr)) == -1) { diff --git a/src/ip_input.c b/src/ip_input.c index a29c324..4190889 100644 --- a/src/ip_input.c +++ b/src/ip_input.c @@ -252,7 +252,7 @@ static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp) goto dropfrag; } fp = mtod(t, struct ipq *); - insque(&fp->ip_link, &slirp->ipq.ip_link); + slirp_insque(&fp->ip_link, &slirp->ipq.ip_link); fp->ipq_ttl = IPFRAGTTL; fp->ipq_p = ip->ip_p; fp->ipq_id = ip->ip_id; @@ -361,7 +361,7 @@ insert: ip->ip_tos &= ~1; ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; - remque(&fp->ip_link); + slirp_remque(&fp->ip_link); m_free(dtom(slirp, fp)); m->m_len += (ip->ip_hl << 2); m->m_data -= (ip->ip_hl << 2); @@ -387,13 +387,13 @@ static void ip_freef(Slirp *slirp, struct ipq *fp) ip_deq(q); m_free(dtom(slirp, q)); } - remque(&fp->ip_link); + slirp_remque(&fp->ip_link); m_free(dtom(slirp, fp)); } /* * Put an ip fragment on a reassembly chain. - * Like insque, but pointers in middle of structure. + * Like slirp_insque, but pointers in middle of structure. */ static void ip_enq(register struct ipasfrag *p, register struct ipasfrag *prev) { @@ -406,7 +406,7 @@ static void ip_enq(register struct ipasfrag *p, register struct ipasfrag *prev) } /* - * To ip_enq as remque is to insque. + * To ip_enq as slirp_remque is to slirp_insque. */ static void ip_deq(register struct ipasfrag *p) { @@ -29,12 +29,12 @@ void m_init(Slirp *slirp) slirp->m_usedlist.qh_link = slirp->m_usedlist.qh_rlink = &slirp->m_usedlist; } -static void m_cleanup_list(struct quehead *list_head) +static void m_cleanup_list(struct slirp_quehead *list_head) { struct mbuf *m, *next; m = (struct mbuf *)list_head->qh_link; - while ((struct quehead *)m != list_head) { + while ((struct slirp_quehead *)m != list_head) { next = m->m_next; if (m->m_flags & M_EXT) { g_free(m->m_ext); @@ -77,11 +77,11 @@ struct mbuf *m_get(Slirp *slirp) m->slirp = slirp; } else { m = (struct mbuf *)slirp->m_freelist.qh_link; - remque(m); + slirp_remque(m); } /* Insert it in the used list */ - insque(m, &slirp->m_usedlist); + slirp_insque(m, &slirp->m_usedlist); m->m_flags = (flags | M_USEDLIST); /* Initialise it */ @@ -104,7 +104,7 @@ void m_free(struct mbuf *m) if (m) { /* Remove from m_usedlist */ if (m->m_flags & M_USEDLIST) - remque(m); + slirp_remque(m); /* If it's M_EXT, free() it */ if (m->m_flags & M_EXT) { @@ -118,7 +118,7 @@ void m_free(struct mbuf *m) m->slirp->mbuf_alloced--; g_free(m); } else if ((m->m_flags & M_FREELIST) == 0) { - insque(m, &m->slirp->m_freelist); + slirp_insque(m, &m->slirp->m_freelist); m->m_flags = M_FREELIST; /* Clobber other flags */ } } /* if(m) */ @@ -213,7 +213,7 @@ struct mbuf *dtom(Slirp *slirp, void *dat) /* bug corrected for M_EXT buffers */ for (m = (struct mbuf *)slirp->m_usedlist.qh_link; - (struct quehead *)m != &slirp->m_usedlist; m = m->m_next) { + (struct slirp_quehead *)m != &slirp->m_usedlist; m = m->m_next) { if (m->m_flags & M_EXT) { if ((char *)dat >= m->m_ext && (char *)dat < (m->m_ext + m->m_size)) return m; @@ -8,22 +8,22 @@ #include <sys/un.h> #endif -inline void insque(void *a, void *b) +inline void slirp_insque(void *a, void *b) { - register struct quehead *element = (struct quehead *)a; - register struct quehead *head = (struct quehead *)b; + register struct slirp_quehead *element = (struct slirp_quehead *)a; + register struct slirp_quehead *head = (struct slirp_quehead *)b; element->qh_link = head->qh_link; - head->qh_link = (struct quehead *)element; - element->qh_rlink = (struct quehead *)head; - ((struct quehead *)(element->qh_link))->qh_rlink = - (struct quehead *)element; + head->qh_link = (struct slirp_quehead *)element; + element->qh_rlink = (struct slirp_quehead *)head; + ((struct slirp_quehead *)(element->qh_link))->qh_rlink = + (struct slirp_quehead *)element; } -inline void remque(void *a) +inline void slirp_remque(void *a) { - register struct quehead *element = (struct quehead *)a; - ((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; - ((struct quehead *)(element->qh_rlink))->qh_link = element->qh_link; + register struct slirp_quehead *element = (struct slirp_quehead *)a; + ((struct slirp_quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; + ((struct slirp_quehead *)(element->qh_rlink))->qh_link = element->qh_link; element->qh_rlink = NULL; } diff --git a/src/slirp.h b/src/slirp.h index 64ab0dd..239d570 100644 --- a/src/slirp.h +++ b/src/slirp.h @@ -35,12 +35,6 @@ #include <sys/filio.h> #endif -/* Avoid conflicting with the libc insque() and remque(), which - have different prototypes. */ -#define insque slirp_insque -#define remque slirp_remque -#define quehead slirp_quehead - #include "debug.h" #include "util.h" @@ -156,13 +150,13 @@ struct Slirp { bool disable_host_loopback; /* mbuf states */ - struct quehead m_freelist; - struct quehead m_usedlist; + struct slirp_quehead m_freelist; + struct slirp_quehead m_usedlist; int mbuf_alloced; /* if states */ - struct quehead if_fastq; /* fast queue (for interactive data) */ - struct quehead if_batchq; /* queue for non-interactive data */ + struct slirp_quehead if_fastq; /* fast queue (for interactive data) */ + struct slirp_quehead if_batchq; /* queue for non-interactive data */ bool if_start_busy; /* avoid if_start recursion */ /* ip states */ diff --git a/src/socket.c b/src/socket.c index f7af028..b70d727 100644 --- a/src/socket.c +++ b/src/socket.c @@ -41,7 +41,7 @@ struct socket *solookup(struct socket **last, struct socket *head, /* * Create a new socket, initialise the fields * It is the responsibility of the caller to - * insque() it into the correct linked-list + * slirp_insque() it into the correct linked-list */ struct socket *socreate(Slirp *slirp, int type) { @@ -61,11 +61,11 @@ struct socket *socreate(Slirp *slirp, int type) /* * Remove references to so from the given message queue. */ -static void soqfree(struct socket *so, struct quehead *qh) +static void soqfree(struct socket *so, struct slirp_quehead *qh) { struct mbuf *ifq; - for (ifq = (struct mbuf *)qh->qh_link; (struct quehead *)ifq != qh; + for (ifq = (struct mbuf *)qh->qh_link; (struct slirp_quehead *)ifq != qh; ifq = ifq->ifq_next) { if (ifq->ifq_so == so) { struct mbuf *ifm; @@ -78,7 +78,7 @@ static void soqfree(struct socket *so, struct quehead *qh) } /* - * remque and free a socket, clobber cache + * slirp_remque and free a socket, clobber cache */ void sofree(struct socket *so) { @@ -101,7 +101,7 @@ void sofree(struct socket *so) m_free(so->so_m); if (so->so_next && so->so_prev) - remque(so); /* crashes if so is not in a queue */ + slirp_remque(so); /* crashes if so is not in a queue */ if (so->so_tcpcb) { g_free(so->so_tcpcb); @@ -823,7 +823,7 @@ struct socket *tcpx_listen(Slirp *slirp, /* Don't tcp_attach... we don't need so_snd nor so_rcv */ so->so_tcpcb = tcp_newtcpcb(so); - insque(so, &slirp->tcb); + slirp_insque(so, &slirp->tcb); /* * SS_FACCEPTONCE sockets must time out. diff --git a/src/tcp_input.c b/src/tcp_input.c index 1d72479..bce0c82 100644 --- a/src/tcp_input.c +++ b/src/tcp_input.c @@ -149,14 +149,14 @@ static int tcp_reass(register struct tcpcb *tp, register struct tcpiphdr *ti, } q = tcpiphdr_next(q); m = tcpiphdr_prev(q)->ti_mbuf; - remque(tcpiphdr2qlink(tcpiphdr_prev(q))); + slirp_remque(tcpiphdr2qlink(tcpiphdr_prev(q))); m_free(m); } /* * Stick new segment in its place. */ - insque(tcpiphdr2qlink(ti), tcpiphdr2qlink(tcpiphdr_prev(q))); + slirp_insque(tcpiphdr2qlink(ti), tcpiphdr2qlink(tcpiphdr_prev(q))); present: /* @@ -173,7 +173,7 @@ present: do { tp->rcv_nxt += ti->ti_len; flags = ti->ti_flags & TH_FIN; - remque(tcpiphdr2qlink(ti)); + slirp_remque(tcpiphdr2qlink(ti)); m = ti->ti_mbuf; ti = tcpiphdr_next(ti); if (so->so_state & SS_FCANTSENDMORE) diff --git a/src/tcp_subr.c b/src/tcp_subr.c index 636c447..1276086 100644 --- a/src/tcp_subr.c +++ b/src/tcp_subr.c @@ -329,7 +329,7 @@ struct tcpcb *tcp_close(struct tcpcb *tp) while (!tcpfrag_list_end(t, tp)) { t = tcpiphdr_next(t); m = tcpiphdr_prev(t)->ti_mbuf; - remque(tcpiphdr2qlink(tcpiphdr_prev(t))); + slirp_remque(tcpiphdr2qlink(tcpiphdr_prev(t))); m_free(m); } g_free(tp); @@ -577,7 +577,7 @@ void tcp_connect(struct socket *inso) void tcp_attach(struct socket *so) { so->so_tcpcb = tcp_newtcpcb(so); - insque(so, &so->slirp->tcb); + slirp_insque(so, &so->slirp->tcb); } /* @@ -331,7 +331,7 @@ int udp_attach(struct socket *so, unsigned short af) #endif so->so_expire = curtime + SO_EXPIRE; - insque(so, &so->slirp->udb); + slirp_insque(so, &so->slirp->udb); } so->slirp->cb->register_poll_fd(so->s, so->slirp->opaque); return (so->s); @@ -384,7 +384,7 @@ struct socket *udpx_listen(Slirp *slirp, if (haddr->sa_family == AF_INET6) slirp_socket_set_v6only(so->s, (flags & SS_HOSTFWD_V6ONLY) != 0); so->so_expire = curtime + SO_EXPIRE; - insque(so, &slirp->udb); + slirp_insque(so, &slirp->udb); if (bind(so->s, haddr, haddrlen) < 0) { save_errno = errno; |