OpenVSwitch: различия между версиями

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску
 
(не показано 9 промежуточных версий этого же участника)
Строка 1: Строка 1:
  +
[[Категория:Linux]]
  +
[[Категория:Switch]]
  +
[[Категория:Устаревшее]]
  +
[[Категория:OpenVSwitch]]
 
=Open vSwitch=
 
=Open vSwitch=
  +
Думаю что за пол года тут все порядком устарело
  +
==Cборка под CentOS==
  +
* обновить autoconf
  +
** ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/14/Fedora/x86_64/os/Packages/m4-1.4.14-1.fc14.x86_64.rpm
  +
** ftp://rpmfind.net/linux/fedora/linux/releases/18/Everything/i386/os/Packages/a/autoconf-2.69-3.fc18.noarch.rpm
  +
Скачать исходники
  +
** wget http://openvswitch.org/releases/openvswitch-1.9.0.tar.gz
  +
** tar xvf openvswitch-1.9.0.tar.gz
  +
** cd openvswitch-1.9.0
  +
** wget -O - "http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=patch;h=7aaeb9d4e1a9219c48d981230f2738bbdb7abda7" | patch -p1
  +
На всякий случай патч - если будетнедоступен
  +
<PRE>
  +
cat p1.patch
  +
From 7aaeb9d4e1a9219c48d981230f2738bbdb7abda7 Mon Sep 17 00:00:00 2001
  +
From: Jesse Gross <jesse@nicira.com>
  +
Date: Tue, 12 Mar 2013 11:34:29 -0700
  +
Subject: [PATCH] datapath: Check for Centos 6.4 backports.
  +
  +
Centos 6.4 backported a number of additional functions so our existing
  +
versions started causing conflicts.
  +
  +
Reported-by: Denis Iskandarov <d.iskandarov@gmail.com>
  +
Signed-off-by: Jesse Gross <jesse@nicira.com>
  +
---
  +
acinclude.m4 | 5 +++++
  +
datapath/linux/compat/include/linux/etherdevice.h | 2 ++
  +
datapath/linux/compat/include/linux/if_vlan.h | 2 +-
  +
datapath/linux/compat/include/linux/skbuff.h | 2 +-
  +
4 files changed, 9 insertions(+), 2 deletions(-)
  +
  +
diff --git a/acinclude.m4 b/acinclude.m4
  +
index 02dc952..f0610c9 100644
  +
--- a/acinclude.m4
  +
+++ b/acinclude.m4
  +
@@ -215,6 +215,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
  +
  +
OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST])
  +
  +
+ OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random])
  +
+
  +
+ OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_set_encap_proto])
  +
+
  +
OVS_GREP_IFELSE([$KSRC/include/linux/in.h], [ipv4_is_multicast])
  +
  +
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_disable_lro])
  +
@@ -249,6 +253,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
  +
[OVS_DEFINE([HAVE_SKB_WARN_LRO])])
  +
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [consume_skb])
  +
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_frag_page])
  +
+ OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_reset_mac_len])
  +
  +
OVS_GREP_IFELSE([$KSRC/include/linux/string.h], [kmemdup], [],
  +
[OVS_GREP_IFELSE([$KSRC/include/linux/slab.h], [kmemdup])])
  +
diff --git a/datapath/linux/compat/include/linux/etherdevice.h b/datapath/linux/compat/include/linux/etherdevice.h
  +
index 7f04c96..d1cc79c 100644
  +
--- a/datapath/linux/compat/include/linux/etherdevice.h
  +
+++ b/datapath/linux/compat/include/linux/etherdevice.h
  +
@@ -4,6 +4,7 @@
  +
#include <linux/version.h>
  +
#include_next <linux/etherdevice.h>
  +
  +
+#ifndef HAVE_ETH_HW_ADDR_RANDOM
  +
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
  +
static inline void eth_hw_addr_random(struct net_device *dev)
  +
{
  +
@@ -15,5 +16,6 @@ static inline void eth_hw_addr_random(struct net_device *dev)
  +
dev_hw_addr_random(dev, dev->dev_addr);
  +
}
  +
#endif
  +
+#endif
  +
  +
#endif
  +
diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h
  +
index dc4b15e..b8b1961 100644
  +
--- a/datapath/linux/compat/include/linux/if_vlan.h
  +
+++ b/datapath/linux/compat/include/linux/if_vlan.h
  +
@@ -55,7 +55,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
  +
#define VLAN_TAG_PRESENT VLAN_CFI_MASK
  +
#endif
  +
  +
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
  +
+#ifndef HAVE_VLAN_SET_ENCAP_PROTO
  +
static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr)
  +
{
  +
__be16 proto;
  +
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
  +
index 7fbe9d8..d485b39 100644
  +
--- a/datapath/linux/compat/include/linux/skbuff.h
  +
+++ b/datapath/linux/compat/include/linux/skbuff.h
  +
@@ -245,7 +245,7 @@ static inline struct page *skb_frag_page(const skb_frag_t *frag)
  +
}
  +
#endif
  +
  +
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40)
  +
+#ifndef HAVE_SKB_RESET_MAC_LEN
  +
static inline void skb_reset_mac_len(struct sk_buff *skb)
  +
{
  +
skb->mac_len = skb->network_header - skb->mac_header;
  +
--
  +
1.7.1
  +
</PRE>
  +
  +
* ./boot.sh
  +
* ./configure
  +
* make dist
  +
<PRE>
  +
$ ls | grep tar.gz
  +
openvswitch-1.9.0.tar.gz
  +
</PRE>
  +
  +
Для сборки кроме явно прописанных зависимостей понадобиться пакет
  +
* redhat-rpm-config.noarch
  +
иначе возникает ошибка
  +
<PRE>
  +
error: line 24: Dependency tokens must begin with alpha-numeric, '_' or '/': BuildRequires: %kernel_module_package_buildreqs
  +
</PRE>
  +
<PRE>
  +
rpmbuild -bb rhel/openvswitch.spec
  +
rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec
  +
</PRE>
  +
<PRE>
  +
yum install ~/rpmbuild/RPMS/x86_64/openvswitch-1.9.0-1.x86_64.rpm ~/rpmbuild/RPMS/x86_64/kmod-openvswitch-1.9.0-1.el6.x86_64.rpm
  +
</PRE>
  +
  +
==Проверка работы==
  +
У меня уже был бридж - нужно выгрузить и заблеклистить старый модуль
  +
<PRE>
  +
rrmod bridge
  +
</PRE>
  +
<PRE>
  +
cat /etc/modprobe.d/blacklist.conf
  +
... skipped ...
  +
blacklist bridge
  +
...
  +
</PRE>
  +
Все описания настроек можно найти в readme в /usr/src/openvswitch-1.9.0/rhel
  +
Я же приведу простой пример - бридж из одного интерфейса<BR>
  +
ifcfg-br0
  +
<PRE>
  +
DEVICE="br0"
  +
NM_CONTROLLED="no"
  +
ONBOOT="yes"
  +
TYPE="OVSBridge"
  +
IPADDR=192.168.57.99
  +
NETMASK=255.255.255.0
  +
NETWORK=192.168.57.0
  +
BROADCAST=192.168.57.255
  +
DEVICETYPE=ovs
  +
</PRE>
  +
ifcfg-eth0
  +
<PRE>
  +
DEVICE="eth0"
  +
NM_CONTROLLED="no"
  +
ONBOOT="yes"
  +
OVS_BRIDGE=br0
  +
DEVICETYPE=ovs
  +
TYPE=OVSPort
  +
BOOTPROTO=none
  +
HOTPLUG=no
  +
</PRE>
   
 
==Ссылки==
 
==Ссылки==

Текущая версия на 09:34, 13 апреля 2023

Open vSwitch

Думаю что за пол года тут все порядком устарело

Cборка под CentOS

Скачать исходники

На всякий случай патч - если будетнедоступен

cat p1.patch
From 7aaeb9d4e1a9219c48d981230f2738bbdb7abda7 Mon Sep 17 00:00:00 2001
From: Jesse Gross <jesse@nicira.com>
Date: Tue, 12 Mar 2013 11:34:29 -0700
Subject: [PATCH] datapath: Check for Centos 6.4 backports.

Centos 6.4 backported a number of additional functions so our existing
versions started causing conflicts.

Reported-by: Denis Iskandarov <d.iskandarov@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
 acinclude.m4                                      |    5 +++++
 datapath/linux/compat/include/linux/etherdevice.h |    2 ++
 datapath/linux/compat/include/linux/if_vlan.h     |    2 +-
 datapath/linux/compat/include/linux/skbuff.h      |    2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 02dc952..f0610c9 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -215,6 +215,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [

   OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST])

+  OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random])
+
+  OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_set_encap_proto])
+
   OVS_GREP_IFELSE([$KSRC/include/linux/in.h], [ipv4_is_multicast])

   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_disable_lro])
@@ -249,6 +253,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [OVS_DEFINE([HAVE_SKB_WARN_LRO])])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [consume_skb])
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_frag_page])
+  OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_reset_mac_len])

   OVS_GREP_IFELSE([$KSRC/include/linux/string.h], [kmemdup], [],
                   [OVS_GREP_IFELSE([$KSRC/include/linux/slab.h], [kmemdup])])
diff --git a/datapath/linux/compat/include/linux/etherdevice.h b/datapath/linux/compat/include/linux/etherdevice.h
index 7f04c96..d1cc79c 100644
--- a/datapath/linux/compat/include/linux/etherdevice.h
+++ b/datapath/linux/compat/include/linux/etherdevice.h
@@ -4,6 +4,7 @@
 #include <linux/version.h>
 #include_next <linux/etherdevice.h>

+#ifndef HAVE_ETH_HW_ADDR_RANDOM
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
 static inline void eth_hw_addr_random(struct net_device *dev)
 {
@@ -15,5 +16,6 @@ static inline void eth_hw_addr_random(struct net_device *dev)
 	dev_hw_addr_random(dev, dev->dev_addr);
 }
 #endif
+#endif

 #endif
diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h
index dc4b15e..b8b1961 100644
--- a/datapath/linux/compat/include/linux/if_vlan.h
+++ b/datapath/linux/compat/include/linux/if_vlan.h
@@ -55,7 +55,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
 #define VLAN_TAG_PRESENT	VLAN_CFI_MASK
 #endif

-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
+#ifndef HAVE_VLAN_SET_ENCAP_PROTO
 static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr)
 {
 	__be16 proto;
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
index 7fbe9d8..d485b39 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -245,7 +245,7 @@ static inline struct page *skb_frag_page(const skb_frag_t *frag)
 }
 #endif

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40)
+#ifndef HAVE_SKB_RESET_MAC_LEN
 static inline void skb_reset_mac_len(struct sk_buff *skb)
 {
 	skb->mac_len = skb->network_header - skb->mac_header;
--
1.7.1
  • ./boot.sh
  • ./configure
  • make dist
$ ls | grep tar.gz
openvswitch-1.9.0.tar.gz

Для сборки кроме явно прописанных зависимостей понадобиться пакет

  • redhat-rpm-config.noarch

иначе возникает ошибка

error: line 24: Dependency tokens must begin with alpha-numeric, '_' or '/': BuildRequires:  %kernel_module_package_buildreqs
rpmbuild -bb rhel/openvswitch.spec
rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec
 yum install ~/rpmbuild/RPMS/x86_64/openvswitch-1.9.0-1.x86_64.rpm ~/rpmbuild/RPMS/x86_64/kmod-openvswitch-1.9.0-1.el6.x86_64.rpm

Проверка работы

У меня уже был бридж - нужно выгрузить и заблеклистить старый модуль

rrmod bridge
cat /etc/modprobe.d/blacklist.conf
 ... skipped ...
blacklist bridge
...

Все описания настроек можно найти в readme в /usr/src/openvswitch-1.9.0/rhel Я же приведу простой пример - бридж из одного интерфейса
ifcfg-br0

DEVICE="br0"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="OVSBridge"
IPADDR=192.168.57.99
NETMASK=255.255.255.0
NETWORK=192.168.57.0
BROADCAST=192.168.57.255
DEVICETYPE=ovs

ifcfg-eth0

DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT="yes"
OVS_BRIDGE=br0
DEVICETYPE=ovs
TYPE=OVSPort
BOOTPROTO=none
HOTPLUG=no

Ссылки