OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / lib / Libnet / support / bpf-lkm / OpenBSD / etherspoof-kernel-2.7.diff
1 # etherspoof-2.7.diff -- kernel patch to spoof your source mac address
2 # OpenBSD 2.7 [diff version] by obecian <obecian@subterrain.net>
3 #
4 # based on earlier versions by:
5 # Copyright (c) 1999, 2000 Trevor Scheroeder <tschroed@zweknu.org>
6 # Copyright (c) 1998, 1999, 2000 Mike D. Schiffman <mike@infonexus.com>
7 # Original code and idea 1997 Thomas Ptacek <tqbf@pobox.com
8 #
9 # to patch kernel simply (as root):
10 # cd /usr/src/sys/net
11 # patch -p0 < etherspoof-2.7.diff
12 # recompile kernel
13 #
14
15 --- if_ethersubr.c.orig Sun May  7 11:39:34 2000
16 +++ if_ethersubr.c      Sun May  7 11:44:33 2000
17 @@ -242,7 +242,7 @@ ether_output(ifp, m0, dst, rt0)
18  {
19         u_int16_t etype;
20         int s, error = 0;
21 -       u_char edst[6];
22 +       u_char edst[6], esrc[6];
23         register struct mbuf *m = m0;
24         register struct rtentry *rt;
25         struct mbuf *mcopy = (struct mbuf *)0;
26 @@ -284,6 +284,7 @@ ether_output(ifp, m0, dst, rt0)
27                 if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))
28                         mcopy = m_copy(m, 0, (int)M_COPYALL);
29                 etype = htons(ETHERTYPE_IP);
30 +               bcopy(ac->ac_enaddr, esrc, sizeof (edst));
31                 break;
32  #endif
33  #ifdef INET6
34 @@ -453,7 +454,7 @@ ether_output(ifp, m0, dst, rt0)
35                         if (mcopy) {
36                                 eh = mtod(mcopy, struct ether_header *);
37                                 bcopy(edst, eh->ether_dhost, sizeof (edst));
38 -                               bcopy(ac->ac_enaddr, eh->ether_shost,
39 +                               bcopy(esrc, eh->ether_shost,
40                                     sizeof (edst));
41                         }
42                 }
43 @@ -477,6 +478,7 @@ ether_output(ifp, m0, dst, rt0)
44         case AF_UNSPEC:
45                 eh = (struct ether_header *)dst->sa_data;
46                 bcopy((caddr_t)eh->ether_dhost, (caddr_t)edst, sizeof (edst));
47 +               bcopy((caddr_t)eh->ether_shost, (caddr_t)esrc, sizeof (edst));
48                 /* AF_UNSPEC doesn't swap the byte order of the ether_type. */
49                 etype = eh->ether_type;
50                 break;
51 @@ -501,7 +503,7 @@ ether_output(ifp, m0, dst, rt0)
52         bcopy((caddr_t)&etype,(caddr_t)&eh->ether_type,
53                 sizeof(eh->ether_type));
54         bcopy((caddr_t)edst, (caddr_t)eh->ether_dhost, sizeof (edst));
55 -       bcopy((caddr_t)ac->ac_enaddr, (caddr_t)eh->ether_shost,
56 +       bcopy((caddr_t)esrc, (caddr_t)eh->ether_shost,
57             sizeof(eh->ether_shost));
58  
59  #if NBRIDGE > 0