Revision b6dce92e slirp/ip_output.c

b/slirp/ip_output.c
75 75
	/*
76 76
	 * If small enough for interface, can just send directly.
77 77
	 */
78
	if ((u_int16_t)ip->ip_len <= IF_MTU) {
79
		ip->ip_len = htons((u_int16_t)ip->ip_len);
80
		ip->ip_off = htons((u_int16_t)ip->ip_off);
78
	if ((uint16_t)ip->ip_len <= IF_MTU) {
79
		ip->ip_len = htons((uint16_t)ip->ip_len);
80
		ip->ip_off = htons((uint16_t)ip->ip_off);
81 81
		ip->ip_sum = 0;
82 82
		ip->ip_sum = cksum(m, hlen);
83 83

  
......
110 110
	 */
111 111
	m0 = m;
112 112
	mhlen = sizeof (struct ip);
113
	for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) {
113
	for (off = hlen + len; off < (uint16_t)ip->ip_len; off += len) {
114 114
	  register struct ip *mhip;
115 115
	  m = m_get(slirp);
116 116
          if (m == NULL) {
......
125 125
	  mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF);
126 126
	  if (ip->ip_off & IP_MF)
127 127
	    mhip->ip_off |= IP_MF;
128
	  if (off + len >= (u_int16_t)ip->ip_len)
129
	    len = (u_int16_t)ip->ip_len - off;
128
	  if (off + len >= (uint16_t)ip->ip_len)
129
	    len = (uint16_t)ip->ip_len - off;
130 130
	  else
131 131
	    mhip->ip_off |= IP_MF;
132
	  mhip->ip_len = htons((u_int16_t)(len + mhlen));
132
	  mhip->ip_len = htons((uint16_t)(len + mhlen));
133 133

  
134 134
	  if (m_copy(m, m0, off, len) < 0) {
135 135
	    error = -1;
136 136
	    goto sendorfree;
137 137
	  }
138 138

  
139
	  mhip->ip_off = htons((u_int16_t)mhip->ip_off);
139
	  mhip->ip_off = htons((uint16_t)mhip->ip_off);
140 140
	  mhip->ip_sum = 0;
141 141
	  mhip->ip_sum = cksum(m, mhlen);
142 142
	  *mnext = m;
......
147 147
	 * and updating header, then send each fragment (in order).
148 148
	 */
149 149
	m = m0;
150
	m_adj(m, hlen + firstlen - (u_int16_t)ip->ip_len);
151
	ip->ip_len = htons((u_int16_t)m->m_len);
152
	ip->ip_off = htons((u_int16_t)(ip->ip_off | IP_MF));
150
	m_adj(m, hlen + firstlen - (uint16_t)ip->ip_len);
151
	ip->ip_len = htons((uint16_t)m->m_len);
152
	ip->ip_off = htons((uint16_t)(ip->ip_off | IP_MF));
153 153
	ip->ip_sum = 0;
154 154
	ip->ip_sum = cksum(m, hlen);
155 155
sendorfree:

Also available in: Unified diff