From patchwork Tue Jan 5 13:07:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 563076 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D57C31402EC for ; Wed, 6 Jan 2016 00:08:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=DtMjCyIZ; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id C0A1028C01D; Tue, 5 Jan 2016 14:07:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 13F3F28BFAF for ; Tue, 5 Jan 2016 14:06:55 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Tue, 5 Jan 2016 14:06:51 +0100 (CET) Received: by mail-wm0-f45.google.com with SMTP id b14so28132886wmb.1 for ; Tue, 05 Jan 2016 05:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RHHrjMDbV9Vqowa+Uz+7ZGjEQM6HKCTMWTCXG4EuQ3w=; b=DtMjCyIZcrNRURMxTXDr6BHvLcPii6oLHrTZAd8pXUxVQN49OX4IMq0Xn+zs6XTAl+ 7GL5lkWaHav5ayMP55B0dUy0xJX0tIRh8jZq7KimRUdBFsmB5oXy98+jUOwtpeOmmnY/ n7ZMtW3mgqSfjZWZx1kzXV8BS6q6cykBKBvWA65TwbJst/26mJUJZQHcBsR7YhJ/mLok SzGDYpMFlD+ksv8k57Y+fvqgXYycZfhm8Q9u03yG+reBAp0Fhxf+ECvMkhDKS3o2NOi9 7OiDxjWh7zlnU6/J1d6/PoEE7hqu2+nqqTDyuVOfNBnxiWM2fMiZiVhzgjcb9B/SC/4p ppeg== X-Received: by 10.194.203.137 with SMTP id kq9mr54173335wjc.129.1451999240223; Tue, 05 Jan 2016 05:07:20 -0800 (PST) Received: from orion.ocedo.cluj.local ([5.2.198.78]) by smtp.gmail.com with ESMTPSA id w23sm3506983wmd.1.2016.01.05.05.07.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Jan 2016 05:07:19 -0800 (PST) From: Alexandru Ardelean To: openwrt-devel@lists.openwrt.org Date: Tue, 5 Jan 2016 15:07:09 +0200 Message-Id: <1451999229-13327-2-git-send-email-ardeleanalex@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1451999229-13327-1-git-send-email-ardeleanalex@gmail.com> References: <1451999229-13327-1-git-send-email-ardeleanalex@gmail.com> Subject: [OpenWrt-Devel] [PATCH 2/2] lldpd: add /lib/lldpd.unconf file for reload X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Looks like we need to call 'unconfigure' options lldpd has to offer to do a proper (more complete) reload. And while we're doing reload, we need to pause lldpd's execution to prevent it sending unconfigured data/TLVs to the other side ( which could confuse the other side ). Signed-off-by: Alexandru Ardelean --- package/network/services/lldpd/Makefile | 9 ++++++++- package/network/services/lldpd/files/lldpd.init | 12 +++++++----- package/network/services/lldpd/files/lldpd.unconf | 9 +++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 package/network/services/lldpd/files/lldpd.unconf diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 5f413cf..4445867 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -61,11 +61,12 @@ define Package/lldpd/install $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/etc/lldpd.d $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/sbin + $(INSTALL_DIR) $(1)/lib $(1)/usr/lib $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/lldp{cli,ctl,d} $(1)/usr/sbin/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblldpctl.so* $(1)/usr/lib/ $(INSTALL_BIN) ./files/lldpd.init $(1)/etc/init.d/lldpd $(INSTALL_DATA) ./files/lldpd.config $(1)/etc/config/lldpd + $(INSTALL_CONF) ./files/lldpd.unconf $(1)/lib ifneq ($(CONFIG_LLDPD_WITH_CDP),y) sed -i -e '/cdp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd endif @@ -78,6 +79,12 @@ endif ifneq ($(CONFIG_LLDPD_WITH_SONMP),y) sed -i -e '/sonmp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd endif +ifneq ($(CONFIG_LLDPD_WITH_LLDPMED),y) + sed -i -e '/med/d' $(1)/lib/lldpd.unconf +endif +ifneq ($(CONFIG_LLDPD_WITH_CUSTOM),y) + sed -i -e '/custom-tlv/d' $(1)/lib/lldpd.unconf +endif endef define Package/lldpd/conffiles diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 064bac1..1cf3ce7 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -98,13 +98,15 @@ service_running() { reload_service() { running || return 1 - # Custom TLVs are special and should be - # reloaded from config during lldpd reload - $LLDPCLI -u $LLDPSOCKET unconfigure lldp custom-tlv &> /dev/null + # Pause lldpd execution so that it won't send out info during reconfig + $LLDPCLI -u $LLDPSOCKET pause &> /dev/null + $LLDPCLI -u $LLDPSOCKET -c /lib/lldpd.unconf &> /dev/null write_lldpd_conf $LLDPCLI -u $LLDPSOCKET -c $LLDPD_CONF -c $LLDPD_CONFS_DIR &> /dev/null - # Broadcast update over the wire - $LLDPCLI -u $LLDPSOCKET update &> /dev/null + $LLDPCLI -u $LLDPSOCKET &> /dev/null << EOF + resume + update +EOF return 0 } diff --git a/package/network/services/lldpd/files/lldpd.unconf b/package/network/services/lldpd/files/lldpd.unconf new file mode 100644 index 0000000..b7bdafc --- /dev/null +++ b/package/network/services/lldpd/files/lldpd.unconf @@ -0,0 +1,9 @@ +unconfigure system hostname +unconfigure system description +unconfigure system platform +unconfigure system interface pattern +unconfigure system interface description +unconfigure system interface promiscuous +unconfigure system ip management pattern +unconfigure lldp custom-tlv +unconfigure med fast-start