From patchwork Sun Nov 11 15:06:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Sverdlin X-Patchwork-Id: 996137 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qaj+7d+u"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42tHLC3CY8z9s8T for ; Mon, 12 Nov 2018 02:07:15 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7A556871C0; Sun, 11 Nov 2018 15:07:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bp1M6mKElkNF; Sun, 11 Nov 2018 15:07:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B6D5B87711; Sun, 11 Nov 2018 15:07:09 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id AA3FB1BF44A for ; Sun, 11 Nov 2018 15:07:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 78D78876F9 for ; Sun, 11 Nov 2018 15:07:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2YGYmWI3Z3jw for ; Sun, 11 Nov 2018 15:07:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by whitealder.osuosl.org (Postfix) with ESMTPS id E94728761C for ; Sun, 11 Nov 2018 15:07:05 +0000 (UTC) Received: by mail-wm1-f48.google.com with SMTP id r63-v6so6108685wma.4 for ; Sun, 11 Nov 2018 07:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pjv6gWfxgdjLODX4KuOcq3JHR7cOBX+EX5Urcxuweuw=; b=Qaj+7d+u1T574pp1cy1xmw/gaBwZ0X0JnsMU34tyNMi9hrubpydLx7mflIg72W3Grz 1aFSiryCbY1i3dRTjIC8Eif6bEtGlW1AIapIDT3h9LudYct8tgztlGtf4iH6BnwUiDKM hizlNUUOMCqDh6LPPq14xD9XUdPs8kf7oUxdb2jQa6brDEkrVn1SOzZyY9kfQU2KmiAG X4EIVsPc+KEWUCekCFOAZi0FZhMMmEbbABPvTRbFVTxpQ5KFRq9gpQkItqa/mcAGPIbh dIwpOQ8sYkk8WUKH58PvuZcYQcQ5NICDmxWeSWrTB25dw7YGy+8Sqy9veCZowSmGAARc jMFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Pjv6gWfxgdjLODX4KuOcq3JHR7cOBX+EX5Urcxuweuw=; b=n1SoFDr7YwneVvfDYzuXYNr4fwQnCrv88nbR3oMtoMAhHoMjSx28eaNmPLqWEb35CH EwBVcntnv40BJxsunKKC3sFNMX+YdHgheHt7ULs9QyUUmLg3GfeGZc68dy9kZMBrpzQK d4r69HwqflReoVumVdPkfY44Cp1od9SO9SWDPZ8JVLMkqdZysr5d3fGbKWA7zrwD5PeE Cn1RQ8CY+r8LEccgUX1otClCH31F06CJtRdm7hiscAfyTYjgonvgcxdsnBWKk95Eod6h QEQG9XvE/nNxMxN62XklXaIi4eYevJSXkAFBsCgCWc253eRPnF3VmJh71PsaFQRVZudN dzXQ== X-Gm-Message-State: AGRZ1gJ4VjyKrCn+3fqVxNSPlLEjwBZqbgKaxdDV6Xb4ZQVKir+ZK+Tl ieSnRgBSeVaA+Sws9qqGhZgkW4df X-Google-Smtp-Source: AJdET5eH9Wv+qamEUpKcIxhS67s/3321nhN34fTSQUn7x9hBNZuw4yTvoewMsigpPtmcWvUHzOj3HQ== X-Received: by 2002:a1c:9690:: with SMTP id y138-v6mr5035202wmd.67.1541948824078; Sun, 11 Nov 2018 07:07:04 -0800 (PST) Received: from giga-mm.localdomain ([195.245.39.242]) by smtp.gmail.com with ESMTPSA id o18-v6sm14615957wrp.31.2018.11.11.07.07.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Nov 2018 07:07:03 -0800 (PST) From: Alexander Sverdlin To: buildroot@buildroot.org Date: Sun, 11 Nov 2018 16:06:49 +0100 Message-Id: <20181111150652.17459-4-alexander.sverdlin@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111150652.17459-1-alexander.sverdlin@gmail.com> References: <20181111150652.17459-1-alexander.sverdlin@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH] Add mini-snmpd package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Sverdlin Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Mini SNMPd is a minimal implementation targeted at small or embedded UNIX systems with limited resources. Signed-off-by: Alexander Sverdlin --- Note: check-package issues "Signed-off-by" warnings on the .patch files, but that's how they present in the original repository. package/Config.in | 1 + ...d-zero-byte-before-unsigned-integers.patch | 29 +++++++++++++++++++ ...igned-integers-to-have-an-extra-byte.patch | 26 +++++++++++++++++ package/mini-snmpd/Config.in | 7 +++++ package/mini-snmpd/mini-snmpd.mk | 21 ++++++++++++++ package/mini-snmpd/mini-snmpd.service | 12 ++++++++ 6 files changed, 96 insertions(+) create mode 100644 package/mini-snmpd/0001-Prepend-zero-byte-before-unsigned-integers.patch create mode 100644 package/mini-snmpd/0002-mib.c-allow-unsigned-integers-to-have-an-extra-byte.patch create mode 100644 package/mini-snmpd/Config.in create mode 100644 package/mini-snmpd/mini-snmpd.mk create mode 100644 package/mini-snmpd/mini-snmpd.service diff --git a/package/Config.in b/package/Config.in index d136ab1f15..c9450cd033 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1886,6 +1886,7 @@ menu "Networking applications" source "package/macchanger/Config.in" source "package/memcached/Config.in" source "package/mii-diag/Config.in" + source "package/mini-snmpd/Config.in" source "package/minidlna/Config.in" source "package/minissdpd/Config.in" source "package/mjpg-streamer/Config.in" diff --git a/package/mini-snmpd/0001-Prepend-zero-byte-before-unsigned-integers.patch b/package/mini-snmpd/0001-Prepend-zero-byte-before-unsigned-integers.patch new file mode 100644 index 0000000000..990d5bb9b7 --- /dev/null +++ b/package/mini-snmpd/0001-Prepend-zero-byte-before-unsigned-integers.patch @@ -0,0 +1,29 @@ +From 949ae648bf7c654b8fae607a0988bfa672607156 Mon Sep 17 00:00:00 2001 +From: Patrick Rauscher +Date: Fri, 18 Aug 2017 17:31:23 +0200 +Subject: [PATCH] Prepend zero-byte before unsigned integers + +fixes #8 +--- + mib.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/mib.c b/mib.c +index 7d2e513..a9ffbe2 100644 +--- a/mib.c ++++ b/mib.c +@@ -207,6 +207,11 @@ static int encode_unsigned(data_t *data, int type, unsigned int ticks_value) + else + length = 1; + ++ /* check if the integer could be interpreted negative during a signed decode and prepend a zero-byte if necessary */ ++ if ((ticks_value >> (8 * (length - 1))) & 0x80) { ++ length++; ++ } ++ + *buffer++ = type; + *buffer++ = length; + while (length--) +-- +2.13.2 + diff --git a/package/mini-snmpd/0002-mib.c-allow-unsigned-integers-to-have-an-extra-byte.patch b/package/mini-snmpd/0002-mib.c-allow-unsigned-integers-to-have-an-extra-byte.patch new file mode 100644 index 0000000000..d1b18050a5 --- /dev/null +++ b/package/mini-snmpd/0002-mib.c-allow-unsigned-integers-to-have-an-extra-byte.patch @@ -0,0 +1,26 @@ +From 556c8a406c9e08dd9444222e072f7eb9c82a81e8 Mon Sep 17 00:00:00 2001 +From: Patrick Rauscher +Date: Fri, 18 Aug 2017 17:44:32 +0200 +Subject: [PATCH] mib.c: allow unsigned integers to have an extra byte + +The extra byte can be needed when encoding huge unsigned numbers (i.e. 0x80000000 or higher). In this case, during encoding we need an extra byte to make sure clients decoding as signed int do not get negative numbers. For further details, see commit 949ae648 +--- + mib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mib.c b/mib.c +index a9ffbe2..83cc20d 100644 +--- a/mib.c ++++ b/mib.c +@@ -372,7 +372,7 @@ static int data_alloc(data_t *data, int type) + case BER_TYPE_COUNTER: + case BER_TYPE_GAUGE: + case BER_TYPE_TIME_TICKS: +- data->max_length = sizeof(unsigned int) + 2; ++ data->max_length = sizeof(unsigned int) + 3; + data->encoded_length = 0; + data->buffer = allocate(data->max_length); + break; +-- +2.13.2 + diff --git a/package/mini-snmpd/Config.in b/package/mini-snmpd/Config.in new file mode 100644 index 0000000000..1f61cddbcf --- /dev/null +++ b/package/mini-snmpd/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_MINI_SNMPD + bool "mini-snmpd" + help + Mini SNMPd is a minimal implementation targeted at small or + embedded UNIX systems with limited resources + + http://troglobit.com/mini-snmpd.html diff --git a/package/mini-snmpd/mini-snmpd.mk b/package/mini-snmpd/mini-snmpd.mk new file mode 100644 index 0000000000..ebcbcce1ce --- /dev/null +++ b/package/mini-snmpd/mini-snmpd.mk @@ -0,0 +1,21 @@ +################################################################################ +# +# mini-snmpd +# +################################################################################ + +MINI_SNMPD_VERSION = v1.4 +MINI_SNMPD_SITE = $(call github,troglobit,mini-snmpd,$(MINI_SNMPD_VERSION)) +MINI_SNMPD_LICENSE = GPL-2.0 +MINI_SNMPD_LICENSE_FILES = COPYING +MINI_SNMPD_AUTORECONF = YES + +define MINI_SNMPD_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 644 package/mini-snmpd/mini-snmpd.service \ + $(TARGET_DIR)/usr/lib/systemd/system/mini-snmpd.service + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + ln -sf ../../../../usr/lib/systemd/system/mini-snmpd.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/mini-snmpd.service +endef + +$(eval $(autotools-package)) diff --git a/package/mini-snmpd/mini-snmpd.service b/package/mini-snmpd/mini-snmpd.service new file mode 100644 index 0000000000..8a15585e6e --- /dev/null +++ b/package/mini-snmpd/mini-snmpd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Mini SNMP Daemon +StartLimitIntervalSec=0 + +[Service] +Environment='COMMUNITY=public' +ExecStart=/sbin/mini_snmpd -a -n -c ${COMMUNITY} $EXTRA_PARAMS +Restart=always +RestartSec=1 + +[Install] +WantedBy=multi-user.target