|
Lines 118-123
Link Here
|
| 118 |
.notifier_call = handle_netdev_event, |
118 |
.notifier_call = handle_netdev_event, |
| 119 |
}; |
119 |
}; |
| 120 |
|
120 |
|
|
|
121 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) |
| 122 |
static const struct net_device_ops vpn_netdev_ops_init = { |
| 123 |
.ndo_start_xmit = interceptor_tx, |
| 124 |
.ndo_get_stats = interceptor_stats, |
| 125 |
.ndo_do_ioctl = interceptor_ioctl, |
| 126 |
}; |
| 127 |
static const struct net_device_ops vpn_netdev_ops_run = { |
| 128 |
.ndo_start_xmit = replacement_dev_xmit, |
| 129 |
.ndo_get_stats = interceptor_stats, |
| 130 |
.ndo_do_ioctl = interceptor_ioctl, |
| 131 |
}; |
| 132 |
#endif |
| 133 |
|
| 121 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) |
134 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) |
| 122 |
static |
135 |
static |
| 123 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) |
136 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) |
|
Lines 131-140
Link Here
|
| 131 |
interceptor_init(struct net_device *dev) |
144 |
interceptor_init(struct net_device *dev) |
| 132 |
{ |
145 |
{ |
| 133 |
ether_setup(dev); |
146 |
ether_setup(dev); |
| 134 |
|
147 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) |
|
|
148 |
dev->netdev_ops = &vpn_netdev_ops_init; |
| 149 |
#else |
| 135 |
dev->hard_start_xmit = interceptor_tx; |
150 |
dev->hard_start_xmit = interceptor_tx; |
| 136 |
dev->get_stats = interceptor_stats; |
151 |
dev->get_stats = interceptor_stats; |
| 137 |
dev->do_ioctl = interceptor_ioctl; |
152 |
dev->do_ioctl = interceptor_ioctl; |
|
|
153 |
#endif |
| 138 |
|
154 |
|
| 139 |
dev->mtu = ETH_DATA_LEN-MTU_REDUCTION; |
155 |
dev->mtu = ETH_DATA_LEN-MTU_REDUCTION; |
| 140 |
kernel_memcpy(dev->dev_addr, interceptor_eth_addr,ETH_ALEN); |
156 |
kernel_memcpy(dev->dev_addr, interceptor_eth_addr,ETH_ALEN); |
|
Lines 272-279
Link Here
|
| 272 |
Bindings[i].original_mtu = dev->mtu; |
288 |
Bindings[i].original_mtu = dev->mtu; |
| 273 |
|
289 |
|
| 274 |
/*replace the original send function with our send function */ |
290 |
/*replace the original send function with our send function */ |
|
|
291 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) |
| 292 |
Bindings[i].InjectSend = dev->netdev_ops->ndo_start_xmit; |
| 293 |
dev->netdev_ops = &vpn_netdev_ops_run; |
| 294 |
#else |
| 275 |
Bindings[i].InjectSend = dev->hard_start_xmit; |
295 |
Bindings[i].InjectSend = dev->hard_start_xmit; |
| 276 |
dev->hard_start_xmit = replacement_dev_xmit; |
296 |
dev->hard_start_xmit = replacement_dev_xmit; |
|
|
297 |
#endif |
| 277 |
|
298 |
|
| 278 |
/*copy in the ip packet handler function and packet type struct */ |
299 |
/*copy in the ip packet handler function and packet type struct */ |
| 279 |
Bindings[i].InjectReceive = original_ip_handler.orig_handler_func; |
300 |
Bindings[i].InjectReceive = original_ip_handler.orig_handler_func; |
|
Lines 295-301
Link Here
|
| 295 |
if (b) |
316 |
if (b) |
| 296 |
{ |
317 |
{ |
| 297 |
rc = 0; |
318 |
rc = 0; |
|
|
319 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31) |
| 320 |
dev->netdev_ops = &vpn_netdev_ops_init; |
| 321 |
#else |
| 298 |
dev->hard_start_xmit = b->InjectSend; |
322 |
dev->hard_start_xmit = b->InjectSend; |
|
|
323 |
#endif |
| 299 |
kernel_memset(b, 0, sizeof(BINDING)); |
324 |
kernel_memset(b, 0, sizeof(BINDING)); |
| 300 |
} |
325 |
} |
| 301 |
else |
326 |
else |