nevermind... I figured it out.  new patch addressing your issues is
forthcoming.


On Fri, Nov 8, 2013 at 3:59 PM, Pete Holland <phollan...@gmail.com> wrote:

> when you say 'this should not be done', can you give a pointer to 'what
> should be done instead'?
>
>
> On Fri, Nov 8, 2013 at 3:58 PM, Pete Holland <phollan...@gmail.com> wrote:
>
>> thanks for the suggestions... some of the questions (about sleeps, and
>> what I presume is the postinst step) I don't immediately have answers to as
>> I sourced the original patch from another developer, and, well it works...
>> but I will figure them out and resubmit a patch.
>>
>>
>> On Fri, Nov 8, 2013 at 3:50 PM, Jo-Philipp Wich <j...@openwrt.org> wrote:
>>
>>> Hi.
>>>
>>> Comments inline.
>>>
>>> > This is a patch for the most recent stable build of OpenvSwitch
>>> (2.0.0).
>>> >  It supports kernels 2.6.32 - 3.10.x
>>> >
>>> > It was taken and updated from Julius Shulz-Zander's work:
>>> > https://github.com/schuza/openvswitch
>>> >
>>> > Signed-off-by: Peter Holland <phollan...@gmail.com>
>>> > ---
>>> > diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile
>>> > new file mode 100644
>>> > --- /dev/null
>>> > +++ b/net/openvswitch/Makefile
>>> > @@ -0,0 +1,178 @@
>>> > +#
>>> > +# Copyright (C) 2013 Julius Schulz-Zander
>>> > +# Copyright (C) 2013 Peter Holland
>>> > +#
>>> > +# This is free software, licensed under the GNU General Public
>>> License v2.
>>> > +# See /LICENSE for more information.
>>> > +#
>>> > +# $Id: Makefile $
>>> > +
>>> > +include $(TOPDIR)/rules.mk
>>> > +
>>> > +PKG_NAME:=openvswitch
>>> > +
>>> > +PKG_RELEASE:=1
>>> > +PKG_VERSION:=2.0.0
>>> > +
>>> > +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
>>> > +PKG_SOURCE_URL:=http://openvswitch.org/releases/
>>> > +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
>>> > +
>>> > +include $(INCLUDE_DIR)/package.mk
>>> > +include $(INCLUDE_DIR)/kernel.mk
>>> > +
>>> > +PKG_FIXUP=libtool
>>> > +
>>> > +define Package/openvswitch/Default
>>> > +  SECTION:=net
>>> > +  SUBMENU:=OpenvSwitch
>>> > +  CATEGORY:=Network
>>> > +  URL:=http://www.openvswitchswitch.org/
>>> > +  DEPENDS:=+libopenssl +librt +libpcap
>>> > +endef
>>> > +
>>> > +define Package/openvswitch/Default/description
>>> > +  Open vSwitch is a production quality, multilayer, software-based,
>>> > Ethernet
>>> > +  virtual switch. It is designed to enable massive network automation
>>> > through
>>> > +  programmatic extension, while still supporting standard management
>>> > interfaces
>>> > +  and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP,
>>> 802.1ag). In
>>> > +  addition, it is designed to support distribution across multiple
>>> physical
>>> > +  servers similar to VMware's vNetwork distributed vswitch or Cisco's
>>> Nexus
>>> > +  1000V.
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-common
>>> > +  $(call Package/openvswitch/Default)
>>> > +  TITLE:=Open Flow Switch Userspace Package
>>> > +  DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-common/description
>>> > +  openvswitch-common provides components required by both
>>> > openvswitch-switch and
>>> > +  openvswitch-controller.
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-ipsec
>>> > +  $(call Package/openvswitch/Default)
>>> > +  TITLE:=Open Flow Switch Userspace Package
>>> > +  DEPENDS:=+openvswitch-common
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-ipsec/description
>>> > +  The ovs-monitor-ipsec script provides support for encrypting GRE
>>> tunnels
>>> > with
>>> > +  IPsec.
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-controller
>>> > +  $(call Package/openvswitch/Default)
>>> > +  TITLE:=Open Flow Switch Userspace Package
>>> > +  DEPENDS:=+openvswitch-common
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-controller/description
>>> > +  The Open vSwitch controller enables OpenFlow switches that connect
>>> to it
>>> > to
>>> > +  act as MAC-learning Ethernet switches.
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-switch
>>> > +  $(call Package/openvswitch/Default)
>>> > +  TITLE:=Open Flow Switch Userspace Package
>>> > +  DEPENDS:=+openvswitch-common
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-switch/description
>>> > +  openvswitch-switch provides the userspace components and utilities
>>> for
>>> > the
>>> > +  Open vSwitch kernel-based switch.
>>> > +endef
>>> > +
>>> > +define KernelPackage/openvswitch
>>> > +  SECTION:=kernel
>>> > +  CATEGORY:=Kernel modules
>>> > +  SUBMENU:=Network Support
>>> > +  TITLE:=Open Flow Data Path Drivers
>>> > +  KCONFIG:=CONFIG_BRIDGE
>>> > +  DEPENDS:=+kmod-stp +kmod-ipv6 +kmod-gre +kmod-lib-crc32c
>>> > +  FILES:= \
>>> > +
>>>  $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
>>> > +  AUTOLOAD:=$(call AutoLoad,40,openvswitch)
>>> > +endef
>>> > +
>>> > +define KernelPackage/openvswitch/description
>>> > +  This package contains the Open vSwitch kernel moodule and bridge
>>> compat
>>> > +  module. Furthermore, it supports OpenFlow.
>>> > +endef
>>> > +
>>> > +CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
>>> > +
>>> > +define Build/Configure
>>> > + (cd $(PKG_BUILD_DIR); \
>>> > + autoreconf -v --install --force || exit 1 \
>>> > + );
>>> > + $(call Build/Configure/Default,$(CONFIGURE_ARGS))
>>> > +endef
>>>
>>> That section should be remeoved, manual autoreconf invocations will lead
>>> to problems on various build environments. Instead use
>>> PKG_FIXUP:=autoreconf .
>>>
>>> > +
>>> > +define Build/Compile
>>> > + $(MAKE) -C $(PKG_BUILD_DIR) \
>>> > + $(TARGET_CONFIGURE_OPTS) \
>>> > + CFLAGS="-I$(PKG_BUILD_DIR)/lib $(TARGET_CFLAGS) -std=gnu99" \
>>> > + LDFLAGS="-L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS)" \
>>> > + LDFLAGS_MODULES="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR)/lib" \
>>> > + STAGING_DIR="$(STAGING_DIR)" \
>>> > + DESTDIR="$(PKG_INSTALL_DIR)/usr" \
>>> > + CROSS_COMPILE="$(TARGET_CROSS)" \
>>> > + ARCH="$(LINUX_KARCH)" \
>>> > + PATH="$(TARGET_PATH)" \
>>> > + KCC="$(KERNEL_CC)"
>>> > +endef
>>>
>>> Instead of overriding the entire Build/Compile rule it is better to
>>> extend MAKE_VARS for the additional vars needed.
>>>
>>> > +
>>> > +define Package/openvswitch-ipsec/install
>>> > + $(INSTALL_DIR) $(1)/usr/sbin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec
>>> $(1)/usr/sbin/
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-common/install
>>> > + $(INSTALL_DIR) $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-appctl $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-benchmark $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-ofctl $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-pki $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/ovsdb-client $(1)/usr/bin/
>>> > + $(INSTALL_DIR) $(1)/usr/sbin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/bugtool/ovs-bugtool
>>> > $(1)/usr/sbin/
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-controller/install
>>> > + $(INSTALL_DIR) $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-controller
>>> $(1)/usr/bin/
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-switch/install
>>> > + $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d
>>> > + $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init
>>> > $(1)/etc/init.d/openvswitch
>>> > +
>>> > + $(INSTALL_DIR) $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-dpctl $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-pcap $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-tcpundump $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-vlan-test $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/ovs-vsctl $(1)/usr/bin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/ovsdb-tool $(1)/usr/bin/
>>> > +
>>> > + $(INSTALL_DIR) $(1)/usr/sbin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/ovs-vswitchd $(1)/usr/sbin/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ovsdb/ovsdb-server $(1)/usr/sbin/
>>> > +
>>> > + $(INSTALL_DIR) $(1)/usr/share/openvswitch/
>>> > + $(INSTALL_BIN) $(PKG_BUILD_DIR)/vswitchd/vswitch.ovsschema
>>> > $(1)/usr/share/openvswitch/
>>> > +endef
>>> > +
>>> > +define Package/openvswitch-switch/postinst
>>> > +#!/bin/sh
>>> > +[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/openvswitch enable || true
>>> > +endef
>>>
>>> This should not be done.
>>>
>>> > +
>>> > +$(eval $(call BuildPackage,openvswitch-ipsec))
>>> > +$(eval $(call BuildPackage,openvswitch-common))
>>> > +$(eval $(call BuildPackage,openvswitch-controller))
>>> > +$(eval $(call BuildPackage,openvswitch-switch))
>>> > +$(eval $(call KernelPackage,openvswitch))
>>> > diff --git a/net/openvswitch/files/etc/init.d/openvswitch.init
>>> > b/net/openvswitch/files/etc/init.d/openvswitch.init
>>> > new file mode 100644
>>> > --- /dev/null
>>> > +++ b/net/openvswitch/files/etc/init.d/openvswitch.init
>>> > @@ -0,0 +1,49 @@
>>> > +#!/bin/sh /etc/rc.common
>>> > +# Copyright (C) 2013 Julius Schulz-Zander
>>> > +# Coypright (C) 2013 Peter Holland
>>> > +#
>>> > +# This program is free software; you can redistribute it and/or
>>> modify it
>>> > +# under the terms of the GNU General Public License as published by
>>> the
>>> > +# Free Software Foundation; either version 2 of the License, or (at
>>> your
>>> > +# option) any later version.  See <
>>> http://www.fsf.org/copyleft/gpl.txt>.
>>> > +#
>>> > +# This program is distributed in the hope that it will be useful, but
>>> > +# WITHOUT ANY WARRANTY; without even the implied warranty of
>>> > MERCHANTABILITY
>>> > +# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
>>> License
>>> > +# for more details.
>>> > +
>>> > +START=15
>>> > +# DEBUG="echo"
>>> > +
>>> > +start() {
>>> > + [ -x /etc/openvswitch ] || mkdir -p /etc/openvswitch
>>> > + [ -x /var/run/openvswitch ] || mkdir -p /var/run/openvswitch
>>> > + [ -e /etc/openvswitch/conf.db ] || {
>>> > + $DEBUG /usr/bin/ovsdb-tool create /etc/openvswitch/conf.db \
>>> > + /usr/share/openvswitch/vswitch.ovsschema
>>> > + }
>>> > +
>>> > + $DEBUG start-stop-daemon -q -S -x  /usr/sbin/ovsdb-server -- \
>>> > + --remote=punix:/var/run/db.sock
>>> > --remote=db:Open_vSwitch,Open_vSwitch,manager_options \
>>> > + --pidfile=/var/run/ovsdb-server.pid --detach
>>> > + sleep 1
>>> > +
>>> > + $DEBUG ovs-vsctl --no-wait init
>>> > + sleep 1
>>> > +
>>> > + $DEBUG start-stop-daemon -q -S -x  /usr/sbin/ovs-vswitchd -- \
>>> > + --pidfile=/var/run/ovs-vswitchd.pid --detach
>>>
>>> Why are these sleeps needed?
>>>
>>> > +}
>>> > +
>>> > +stop() {
>>> > + $DEBUG start-stop-daemon -q -K -p /var/run/ovs-vswitchd.pid
>>> > + $DEBUG start-stop-daemon -q -K -p /var/run/ovsdb-server.pid
>>> > +}
>>> > +
>>> > +restart() {
>>> > + ifdown -a
>>> > + stop
>>> > + sleep 1
>>> > + start
>>> > + ifup -a
>>>
>>> Same here, whats the need for sleeping?
>>>
>>> > +}
>>> >
>>> Also instead of invoking s-s-d manually you should use service wrappers
>>> (
>>> https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/functions/service.sh
>>> )
>>>
>>> That file is sourced automatically from rc.common so the procedures are
>>> ready to use in init scripts.
>>>
>>>
>>> Regards,
>>> Jow
>>>
>>>
>>>
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel@lists.openwrt.org
>>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>>
>>>
>>
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to