Revision 5fafdf24 slirp/ip_icmp.c

b/slirp/ip_icmp.c
63 63
/* INFO (15) */          0,
64 64
/* INFO REPLY (16) */    0,
65 65
/* ADDR MASK (17) */     0,
66
/* ADDR MASK REPLY (18) */ 0 
66
/* ADDR MASK REPLY (18) */ 0
67 67
};
68 68

  
69 69
/*
......
78 78
  register struct ip *ip=mtod(m, struct ip *);
79 79
  int icmplen=ip->ip_len;
80 80
  /* int code; */
81
	
81

  
82 82
  DEBUG_CALL("icmp_input");
83 83
  DEBUG_ARG("m = %lx", (long )m);
84 84
  DEBUG_ARG("m_len = %d", m->m_len);
85 85

  
86 86
  icmpstat.icps_received++;
87
	
87

  
88 88
  /*
89 89
   * Locate icmp structure in mbuf, and check
90 90
   * that its not corrupted and of at least minimum length.
......
105 105
  }
106 106
  m->m_len += hlen;
107 107
  m->m_data -= hlen;
108
  
108
 
109 109
  /*	icmpstat.icps_inhist[icp->icmp_type]++; */
110 110
  /* code = icp->icmp_code; */
111 111

  
......
121 121
      struct sockaddr_in addr;
122 122
      if ((so = socreate()) == NULL) goto freeit;
123 123
      if(udp_attach(so) == -1) {
124
	DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n", 
124
	DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n",
125 125
		    errno,strerror(errno)));
126 126
	sofree(so);
127 127
	m_free(m);
......
135 135
      so->so_iptos = ip->ip_tos;
136 136
      so->so_type = IPPROTO_ICMP;
137 137
      so->so_state = SS_ISFCONNECTED;
138
      
138
     
139 139
      /* Send the packet */
140 140
      addr.sin_family = AF_INET;
141 141
      if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
......
157 157
		(struct sockaddr *)&addr, sizeof(addr)) == -1) {
158 158
	DEBUG_MISC((dfd,"icmp_input udp sendto tx errno = %d-%s\n",
159 159
		    errno,strerror(errno)));
160
	icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); 
160
	icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno));
161 161
	udp_detach(so);
162 162
      }
163 163
    } /* if ip->ip_dst.s_addr == alias_addr.s_addr */
......
173 173
    icmpstat.icps_notsupp++;
174 174
    m_freem(m);
175 175
    break;
176
    
176
   
177 177
  default:
178 178
    icmpstat.icps_badtype++;
179 179
    m_freem(m);
......
199 199
 * mbuf *msrc is used as a template, but is NOT m_free()'d.
200 200
 * It is reported as the bad ip packet.  The header should
201 201
 * be fully correct and in host byte order.
202
 * ICMP fragmentation is illegal.  All machines must accept 576 bytes in one 
202
 * ICMP fragmentation is illegal.  All machines must accept 576 bytes in one
203 203
 * packet.  The maximum payload is 576-20(ip hdr)-8(icmp hdr)=548
204 204
 */
205 205

  
......
226 226
  /* check msrc */
227 227
  if(!msrc) goto end_error;
228 228
  ip = mtod(msrc, struct ip *);
229
#if DEBUG  
229
#if DEBUG 
230 230
  { char bufa[20], bufb[20];
231 231
    strcpy(bufa, inet_ntoa(ip->ip_src));
232 232
    strcpy(bufb, inet_ntoa(ip->ip_dst));
......
258 258
  /* make the header of the reply packet */
259 259
  ip  = mtod(m, struct ip *);
260 260
  hlen= sizeof(struct ip );     /* no options in reply */
261
  
261
 
262 262
  /* fill in icmp */
263
  m->m_data += hlen;                  
263
  m->m_data += hlen;                 
264 264
  m->m_len -= hlen;
265 265

  
266 266
  icp = mtod(m, struct icmp *);
......
269 269
  else if(s_ip_len>ICMP_MAXDATALEN)         /* maximum size */
270 270
    s_ip_len=ICMP_MAXDATALEN;
271 271

  
272
  m->m_len=ICMP_MINLEN+s_ip_len;        /* 8 bytes ICMP header */  
272
  m->m_len=ICMP_MINLEN+s_ip_len;        /* 8 bytes ICMP header */ 
273 273

  
274 274
  /* min. size = 8+sizeof(struct ip)+8 */
275 275

  
......
304 304
  /* fill in ip */
305 305
  ip->ip_hl = hlen >> 2;
306 306
  ip->ip_len = m->m_len;
307
  
307
 
308 308
  ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0);  /* high priority for errors */
309 309

  
310 310
  ip->ip_ttl = MAXTTL;
......
313 313
  ip->ip_src = alias_addr;
314 314

  
315 315
  (void ) ip_output((struct socket *)NULL, m);
316
  
316
 
317 317
  icmpstat.icps_reflect++;
318 318

  
319 319
end_error:

Also available in: Unified diff