Date: Sun, 5 May 1996 13:28:04 -0500 From: Jim Fleming <JimFleming@unety.net> To: "'FreeBSD-hackers@freebsd.org'" <FreeBSD-hackers@freebsd.org> Subject: IPv8 Tutorial #2: Minimal IPv8 Output Hack Message-ID: <01BB3A86.B165FB60@webster.unety.net>
next in thread | raw e-mail | index | archive | help
IPv8 Tutorial #2: Minimal IPv8 Output Hack
---------------------------------------------------
OK...for those people that wrote asking how to generate
IPv8 packets here is a very MINIMAL hack that will allow
you to generate a few packets on your private systems.
PLEASE DO NOT TEST THIS ON THE LEGACY INTERNET
(it has enough trouble routing IPv4)
Here is a very MINIMAL modification that can be added to:
/usr/src/sys/netinet/ip_output.c
@@@@ ORIGINAL CODE @@@@@@@@@
(about line 280)
sendit:
/*
* If small enough for interface, can just send directly.
*/
if ((u_short)ip->ip_len <= ifp->if_mtu) {
ip->ip_len = htons((u_short)ip->ip_len);
ip->ip_off = htons((u_short)ip->ip_off);
ip->ip_sum = 0;
ip->ip_sum = in_cksum(m, hlen);
error = (*ifp->if_output)(ifp, m,
(struct sockaddr *)dst, ro->ro_rt);
goto done;
}
@@@@ IPv8 TEST CODE @@@@@@@@@
sendit:
/*
* If small enough for interface, can just send directly.
*/
if ((u_short)ip->ip_len <= ifp->if_mtu) {
ip->ip_len = htons((u_short)ip->ip_len);
ip->ip_off = htons((u_short)ip->ip_off);
/*@*/
/* note #1 */
if((ip->ip_v == 4) && (ip->ip_hl == 5)){
ip->ip_v = 8; /* note #2 */
ip->ip_hl = 0; /* note #3 */
ip->ip_sum = 0; /* note #4 */
}
else{
ip->ip_sum = 0;
ip->ip_sum = in_cksum(m, hlen);
}
/*@*/
error = (*ifp->if_output)(ifp, m,
(struct sockaddr *)dst, ro->ro_rt);
goto done;
}
@@@@@@@@@@@@@@@@@@@@@@
These changes do not require the IPv8 header files or any other
variables or IPv8 routines.
Here are some notes for the above:
1. Only small packets with simple IP headers are
converted. With telnet and ping you can test
some simple cases. If IPv8 traffic is carried on
a separate network from IPv4, then it is difficult
for crackers to be able to view all of the packets
needed to understand a session.
2. By rights this should be:
ip->ip_v = 0;
ip->ip_v |= 8;
/* Set Galaxy Information. */
3. The ip_hl field in IPv8 is combined with the ip_v field
and both should be set in one operation. The
above is only a tutorial.
4. The ip_sum field carries the StarGate ids which are
zero for the Legacy Internet. The statement
ip->ip_sum = 0; could be moved before the if
statement for only the Legacy Internet. In private
systems security information can be placed here. The
receiver will zap this and compute a valid checksum.
(see IPv8 Tutorial #1: Minimal IPv8 hack)
The header file found @ <http://comm.unety.net/US/IL/Naperville/Unir>
has constant definitions and macros that can make all this more lucid.
Enjoy...
--
Jim Fleming
UNETY Systems, Inc.
Naperville, IL
e-mail: JimFleming@unety.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01BB3A86.B165FB60>
