From 1573f51809417357f79d49aa9da4379dc8836462 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Tue, 11 Mar 2014 15:16:53 +0000
Subject: [PATCH] git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5144
 818b1a75-f10b-46b9-bf7c-635c3b92a50f

---
 .../PROJECTS/GENERIC-LTE-EPC/start_epc.bash   | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
index 17ace7437f..864f3634b3 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
@@ -122,11 +122,6 @@ 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
-
 
 ##################################
 # Get or set OBJ DIR and compile #
@@ -254,6 +249,10 @@ if [ $? -eq 1 ]; then
    ovs_setting=1
    vlan_setting=0
    echo_success "Found open-vswitch network configuration"
+   # 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
    clean_epc_ovs_network
    build_epc_ovs_network
    test_epc_ovs_network
@@ -264,6 +263,16 @@ else
         echo_success "Found open VLAN network configuration"
         ovs_setting=0
         vlan_setting=1
+        
+        # may be openvswitch is needed for S11
+        is_openvswitch_interface $MME_IPV4_ADDRESS_FOR_S11_MME  \
+                               $SGW_IPV4_ADDRESS_FOR_S11
+        if [ $? -eq 1 ]; then
+            # 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
+        fi
         clean_epc_vlan_network
         build_mme_spgw_vlan_network
     else
-- 
2.26.2