diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2009-06-24 14:42:31 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-29 08:52:49 -0500 |
commit | 460fec67ee3807bb2eb189587ffe803a48f317e5 (patch) | |
tree | 398605fd3595389ac29b7af0e0151a19edf25ff5 /slirp/ip_output.c | |
parent | b5302e1a9d8a47bd29a3e1876fba34be111728a2 (diff) | |
download | qemu-460fec67ee3807bb2eb189587ffe803a48f317e5.tar.gz qemu-460fec67ee3807bb2eb189587ffe803a48f317e5.tar.bz2 qemu-460fec67ee3807bb2eb189587ffe803a48f317e5.zip |
slirp: Factor out internal state structure
The essence of this patch is to stuff (almost) all global variables of
the slirp stack into the structure Slirp. In this step, we still keep
the structure as global variable, directly accessible by the whole
stack. Changes to the external interface of slirp will be applied in
the following patches.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'slirp/ip_output.c')
-rw-r--r-- | slirp/ip_output.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/slirp/ip_output.c b/slirp/ip_output.c index 3031f4d112..dba278478b 100644 --- a/slirp/ip_output.c +++ b/slirp/ip_output.c @@ -40,8 +40,6 @@ #include <slirp.h> -u_int16_t ip_id; - /* Number of packets queued before we start sending * (to prevent allocing too many mbufs) */ #define IF_THRESH 10 @@ -55,6 +53,7 @@ u_int16_t ip_id; int ip_output(struct socket *so, struct mbuf *m0) { + Slirp *slirp = m0->slirp; register struct ip *ip; register struct mbuf *m = m0; register int hlen = sizeof(struct ip ); @@ -70,7 +69,7 @@ ip_output(struct socket *so, struct mbuf *m0) */ ip->ip_v = IPVERSION; ip->ip_off &= IP_DF; - ip->ip_id = htons(ip_id++); + ip->ip_id = htons(slirp->ip_id++); ip->ip_hl = hlen >> 2; /* @@ -113,7 +112,7 @@ ip_output(struct socket *so, struct mbuf *m0) mhlen = sizeof (struct ip); for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) { register struct ip *mhip; - m = m_get(); + m = m_get(slirp); if (m == NULL) { error = -1; goto sendorfree; |