Dopo il rilascio nuova Ubuntu Karmic Koala 9.10, ho deciso di salutare la vecchia Jaunty.
Effettuato il backup dei dati (la prudenza non e’ mai troppa), ho eseguito l’upgrade di versione e, tutto contento, ho iniziato a “smandruppare” con il nuovo giocattolo.
Tutto bene fino a questa mattina, quando, una volta arrivato in ufficio, ho provato a ricompilare il Cisco VPN client per il nuovo kernel 2.6.31. Disastro!
Stopped: /etc/init.d/vpnclient_init (VPN init script)
Making module
make -C /lib/modules/2.6.31-14-generic/build SUBDIRS=/home/andrea/vpnclient modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.31-14-generic'
CC [M] /home/andrea/vpnclient/linuxcniapi.o
CC [M] /home/andrea/vpnclient/frag.o
CC [M] /home/andrea/vpnclient/IPSecDrvOS_linux.o
CC [M] /home/andrea/vpnclient/interceptor.o
/home/andrea/vpnclient/interceptor.c: In function ‘interceptor_init’:
/home/andrea/vpnclient/interceptor.c:132: error: ‘struct net_device’ has no member
named ‘hard_start_xmit’
/home/andrea/vpnclient/interceptor.c:133: error: ‘struct net_device’ has no member
named ‘get_stats’
/home/andrea/vpnclient/interceptor.c:134: error: ‘struct net_device’ has no member
named ‘do_ioctl’
/home/andrea/vpnclient/interceptor.c: In function ‘add_netdev’:
/home/andrea/vpnclient/interceptor.c:271: error: ‘struct net_device’ has no member
named ‘hard_start_xmit’
/home/andrea/vpnclient/interceptor.c:272: error: ‘struct net_device’ has no member
named ‘hard_start_xmit’
/home/andrea/vpnclient/interceptor.c: In function ‘remove_netdev’:
/home/andrea/vpnclient/interceptor.c:294: error: ‘struct net_device’ has no member
named ‘hard_start_xmit’
make[2]: *** [/home/andrea/vpnclient/interceptor.o] Error 1
make[1]: *** [_module_/home/andrea/vpnclient] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-14-generic'
make: *** [default] Error 2
Momento di panico, avevo assolutamente bisogno della VPN.
Fortunatamente il vecchio caro Google e’ sempre pronto a dare una mano, e il momento di panico si e’ spento… appunto in un momento
Il merito va a tal Pál Dorogi, il quale ha provato la nuova Ubuntu 9.10 sin dalla release Alpha, e che ha sviluppato una piccolissima patch da applicare al Cisco VPN Client per permetterne la compilazione con il nuovo kernel 2.6.31.
Ecco il contenuto della patch:
--- vpnclient.ori/interceptor.c 2009-05-21 01:16:34.000000000 +1200
+++ vpnclient/interceptor.c 2009-09-06 22:02:39.000000000 +1200
@@ -116,6 +116,14 @@
};
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+static struct net_device_ops interceptor_netdev_ops = {
+ .ndo_start_xmit = interceptor_tx,
+ .ndo_do_ioctl = interceptor_ioctl,
+ .ndo_get_stats = interceptor_stats,
+};
+#endif
+
static struct notifier_block interceptor_notifier = {
.notifier_call = handle_netdev_event,
};
@@ -129,9 +137,13 @@
{
ether_setup(dev);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ dev->netdev_ops = &interceptor_netdev_ops;
+#else
dev->hard_start_xmit = interceptor_tx;
dev->get_stats = interceptor_stats;
dev->do_ioctl = interceptor_ioctl;
+#endif
dev->mtu = ETH_DATA_LEN-MTU_REDUCTION;
kernel_memcpy(dev->dev_addr, interceptor_eth_addr,ETH_ALEN);
@@ -242,6 +254,9 @@
{
int rc = -1;
int i = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ struct net_device_ops * tmp_ops;
+#endif
if (!supported_device(dev))
{
@@ -268,8 +283,14 @@
Bindings[i].original_mtu = dev->mtu;
/*replace the original send function with our send function */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ Bindings[i].InjectSend = dev->netdev_ops->ndo_start_xmit;
+ tmp_ops = (struct net_device_ops *) dev->netdev_ops;
+ tmp_ops->ndo_start_xmit = replacement_dev_xmit;
+#else
Bindings[i].InjectSend = dev->hard_start_xmit;
dev->hard_start_xmit = replacement_dev_xmit;
+#endif
/*copy in the ip packet handler function and packet type struct */
Bindings[i].InjectReceive = original_ip_handler.orig_handler_func;
@@ -285,13 +306,21 @@
{
int rc = -1;
BINDING *b;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ struct net_device_ops * tmp_ops;
+#endif
b = getbindingbydev(dev);
if (b)
{
rc = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ tmp_ops = (struct net_device_ops *) dev->netdev_ops;
+ tmp_ops->ndo_start_xmit = b->InjectSend;
+#else
dev->hard_start_xmit = b->InjectSend;
+#endif
kernel_memset(b, 0, sizeof(BINDING));
}
else
Basta creare un file (es. vpnclient-2.6.31.diff) all’interno del path dei sorgenti del Cisco VPN Client ed incollare le righe precedenti all’interno dello stesso.
In seguito e’ sufficiente digitare:
$ patch < vpnclient-2.6.31.diff
patching file interceptor.c
E procedere con la reinstallazione del client:
$ sudo ./vpn_install
A questo punto il gioco e’ fatto
Per correttezza, potete trovare l’articolo originale qui.