Subject: patch to align ip headers..
To: None <tech-net@netbsd.org>
From: Darren Reed <darrenr@reed.wattle.id.au>
List: tech-net
Date: 04/26/2000 12:01:59
Is there any reason to allocate a new mbuf by calling something like
m_pullup() when we can just shift the data in the current mbuf ?
Is there a case where the patch below won't work ?

One other question remains - should protocol drivers be doing this or
should network card drivers be doing this (but not at splimp/splnet) ?

Darren

*** /sys/netinet/ip_input.c.old	Tue Apr 11 12:45:54 2000
--- /sys/netinet/ip_input.c	Wed Apr 26 11:57:52 2000
***************
*** 382,387 ****
--- 382,392 ----
  		ipstat.ips_toosmall++;
  		return;
  	}
+ 	if (mtod(m, intptr_t) & 0x3) {
+ 		intptr_t i = mtod(m, intptr_t) & 0x3;
+ 		bcopy(m->m_data, m->m_data - i, m->m_len);
+ 		m->m_data -= i;
+ 	}
  	ip = mtod(m, struct ip *);
  	if (ip->ip_v != IPVERSION) {
  		ipstat.ips_badvers++;