Revision 5fafdf24 slirp/ip_input.c

b/slirp/ip_input.c
37 37
/*
38 38
 * Changes and additions relating to SLiRP are
39 39
 * Copyright (c) 1995 Danny Gasparovski.
40
 * 
40
 *
41 41
 * Please read the file COPYRIGHT for the
42 42
 * terms and conditions of the copyright.
43 43
 */
......
73 73
{
74 74
	register struct ip *ip;
75 75
	int hlen;
76
	
76

  
77 77
	DEBUG_CALL("ip_input");
78 78
	DEBUG_ARG("m = %lx", (long)m);
79 79
	DEBUG_ARG("m_len = %d", m->m_len);
80 80

  
81 81
	ipstat.ips_total++;
82
	
82

  
83 83
	if (m->m_len < sizeof (struct ip)) {
84 84
		ipstat.ips_toosmall++;
85 85
		return;
86 86
	}
87
	
87

  
88 88
	ip = mtod(m, struct ip *);
89
	
89

  
90 90
	if (ip->ip_v != IPVERSION) {
91 91
		ipstat.ips_badvers++;
92 92
		goto bad;
......
99 99
	}
100 100

  
101 101
        /* keep ip header intact for ICMP reply
102
	 * ip->ip_sum = cksum(m, hlen); 
103
	 * if (ip->ip_sum) { 
102
	 * ip->ip_sum = cksum(m, hlen);
103
	 * if (ip->ip_sum) {
104 104
	 */
105 105
	if(cksum(m,hlen)) {
106 106
	  ipstat.ips_badsum++;
......
154 154
	 * (We could look in the reassembly queue to see
155 155
	 * if the packet was previously fragmented,
156 156
	 * but it's not worth the time; just let them time out.)
157
	 * 
157
	 *
158 158
	 * XXX This should fail, don't fragment yet
159 159
	 */
160 160
	if (ip->ip_off &~ IP_DF) {
......
181 181
		ip->ip_len -= hlen;
182 182
		if (ip->ip_off & IP_MF)
183 183
		  ((struct ipasfrag *)ip)->ipf_mff |= 1;
184
		else 
184
		else
185 185
		  ((struct ipasfrag *)ip)->ipf_mff &= ~1;
186 186

  
187 187
		ip->ip_off <<= 3;
......
244 244
	register struct ipasfrag *q;
245 245
	int hlen = ip->ip_hl << 2;
246 246
	int i, next;
247
	
247

  
248 248
	DEBUG_CALL("ip_reass");
249 249
	DEBUG_ARG("ip = %lx", (long)ip);
250 250
	DEBUG_ARG("fp = %lx", (long)fp);
......
275 275
	  q = (struct ipasfrag *)fp;
276 276
	  goto insert;
277 277
	}
278
	
278

  
279 279
	/*
280 280
	 * Find a segment which begins after this one does.
281 281
	 */
......
369 369
	  ip = (struct ipasfrag *)(m->m_ext + delta);
370 370
	}
371 371

  
372
	/* DEBUG_ARG("ip = %lx", (long)ip); 
372
	/* DEBUG_ARG("ip = %lx", (long)ip);
373 373
	 * ip=(struct ipasfrag *)m->m_data; */
374 374

  
375 375
	ip->ip_len = next;
......
446 446
ip_slowtimo()
447 447
{
448 448
	register struct ipq *fp;
449
	
449

  
450 450
	DEBUG_CALL("ip_slowtimo");
451
	
451

  
452 452
	fp = (struct ipq *) ipq.next;
453 453
	if (fp == 0)
454 454
	   return;
......
692 692
	i = m->m_len - (sizeof (struct ip) + olen);
693 693
	memcpy(opts, opts  + olen, (unsigned)i);
694 694
	m->m_len -= olen;
695
	
695

  
696 696
	ip->ip_hl = sizeof(struct ip) >> 2;
697 697
}

Also available in: Unified diff