From 62407561644085916739de303efa928635f1e5cf Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Wed, 22 Jan 2014 15:23:05 +0000
Subject: [PATCH] Should be good.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4931 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair-cn/SCRIPTS/install_openvswitch1.9.0.bash | 8 +++++---
 openair-cn/SCRIPTS/start_lte-epc-ovs.bash        | 4 ++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/openair-cn/SCRIPTS/install_openvswitch1.9.0.bash b/openair-cn/SCRIPTS/install_openvswitch1.9.0.bash
index bc044f0883..93cf4a3840 100755
--- a/openair-cn/SCRIPTS/install_openvswitch1.9.0.bash
+++ b/openair-cn/SCRIPTS/install_openvswitch1.9.0.bash
@@ -13,7 +13,9 @@ linux-headers-`uname -r` vlan -y
 
 rmmod bridge
 cd /usr/local/src/
-wget http://openvswitch.org/releases/openvswitch-1.9.0.tar.gz
+if [ ! -f /usr/local/src/openvswitch-1.9.0.tar.gz ]; then
+    wget http://openvswitch.org/releases/openvswitch-1.9.0.tar.gz
+fi
 tar -xzf openvswitch-1.9.0.tar.gz
 cd openvswitch-1.9.0
 ./boot.sh
@@ -27,7 +29,7 @@ if [ -f /lib/modules/`uname -r`/kernel/net/openvswitch/openvswitch.ko ] ; then
 else
     if  [ -f /lib/modules//`uname -r`/extra/openvswitch.ko ] ; then
         insmod /lib/modules//`uname -r`/extra/openvswitch.ko
-	else 
+	else
        echo_error "Could not find openvswitch.ko, exiting"
 	   exit 1
     fi
@@ -56,7 +58,7 @@ ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:O
 
 ovs-vsctl --no-wait init
 
-# Then start the main Open vSwitch daemon, telling it to 
+# Then start the main Open vSwitch daemon, telling it to
 # connect to the same Unix domain socket:
 
 ovs-vswitchd --pidfile --detach
diff --git a/openair-cn/SCRIPTS/start_lte-epc-ovs.bash b/openair-cn/SCRIPTS/start_lte-epc-ovs.bash
index 7ca84d8e96..6d6e2c7150 100755
--- a/openair-cn/SCRIPTS/start_lte-epc-ovs.bash
+++ b/openair-cn/SCRIPTS/start_lte-epc-ovs.bash
@@ -61,6 +61,10 @@ then
     done
 fi
 
+# May we have booted on a new kernel, not the one when we build vswitch kernel module
+if [ ! -f /lib/modules/`uname -r`/extra/openvswitch.ko ]; then
+    $OPENAIRCN_DIR/SCRIPTS/install_openvswitch1.9.0.bash
+fi
 
 IPTABLES=`which iptables`
 
-- 
GitLab