Merge pull request #7480 from neheb/port
port-mirroring: Update to 1.4.3
This commit is contained in:
commit
c6ebdf4015
3 changed files with 167 additions and 13 deletions
|
@ -7,19 +7,18 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=port-mirroring
|
PKG_NAME:=port-mirroring
|
||||||
PKG_VERSION:=1.4.2
|
PKG_VERSION:=1.4.3
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_SOURCE_URL:=https://codeload.github.com/mmaraya/port-mirroring/tar.gz/v$(PKG_VERSION)?
|
||||||
|
PKG_HASH:=90603163fb086cc586a711e066360ccfa5b4735f67586e8f9254e93f3bebb97e
|
||||||
|
|
||||||
PKG_MAINTAINER:=Mike Maraya <mike.maraya@gmail.com>
|
PKG_MAINTAINER:=Mike Maraya <mike.maraya@gmail.com>
|
||||||
PKG_LICENSE:=BSD-2-Clause
|
PKG_LICENSE:=BSD-2-Clause
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
|
||||||
PKG_MIRROR_HASH:=0bffa393e740711db3eb930fc2674843c56b0dc9db15ac1887fec8776401af2a
|
|
||||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
|
||||||
PKG_SOURCE_URL:=git://github.com/mmaraya/port-mirroring.git
|
|
||||||
PKG_SOURCE_PROTO:=git
|
|
||||||
PKG_SOURCE_VERSION:=f6ead68b7760fa86e8da73ac1e062349f243ac93
|
|
||||||
PKG_FIXUP:=autoreconf
|
PKG_FIXUP:=autoreconf
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
@ -34,11 +33,11 @@ endef
|
||||||
|
|
||||||
define Package/port-mirroring/install
|
define Package/port-mirroring/install
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/port-mirroring $(1)/usr/sbin/
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/port-mirroring $(1)/usr/sbin/
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/port-mirroring.conf $(1)/etc/config/port-mirroring
|
$(INSTALL_CONF) $(PKG_BUILD_DIR)/openwrt/port-mirroring.conf $(1)/etc/config/port-mirroring
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/port-mirroringd $(1)/etc/init.d/port_mirroring
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/port-mirroringd $(1)/etc/init.d/port_mirroring
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,port-mirroring))
|
$(eval $(call BuildPackage,port-mirroring))
|
||||||
|
|
143
net/port-mirroring/patches/010-convert-to-unix.patch
Normal file
143
net/port-mirroring/patches/010-convert-to-unix.patch
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
diff --git a/include/config.h b/include/config.h
|
||||||
|
index 5212c69..ac948ba 100644
|
||||||
|
--- a/include/config.h
|
||||||
|
+++ b/include/config.h
|
||||||
|
@@ -1,69 +1,69 @@
|
||||||
|
-/*
|
||||||
|
- * Copyright (c) 2015 Mike Maraya <mike[dot]maraya[at]gmail[dot]com>
|
||||||
|
- * All rights reserved.
|
||||||
|
- *
|
||||||
|
- * This file is subject to the terms and conditions defined in
|
||||||
|
- * https://github.com/mmaraya/port-mirroring/blob/master/LICENSE,
|
||||||
|
- * which is part of this software package.
|
||||||
|
- *
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-#ifndef PORT_MIRRORING_UTIL_H_
|
||||||
|
-#define PORT_MIRRORING_UTIL_H_
|
||||||
|
-
|
||||||
|
-#include <errno.h>
|
||||||
|
-#include <net/if.h>
|
||||||
|
-#include <netinet/in.h>
|
||||||
|
-#include <stdint.h>
|
||||||
|
-#include <stdio.h>
|
||||||
|
-#include <stdlib.h>
|
||||||
|
-#include <string.h>
|
||||||
|
-#include <syslog.h>
|
||||||
|
-#include <linux/limits.h>
|
||||||
|
-
|
||||||
|
-#define OPTION_MAX 254 /* max value for program options */
|
||||||
|
-#define TIMEBUF 32 /* max timestamp length RFC3339 */
|
||||||
|
-#define SRC_MAX 4 /* maxium number of source network interfaces */
|
||||||
|
-#define PFE_MAX 80 /* maximum length of packet filter expression */
|
||||||
|
-#define MACADDRLEN 6 /* length of a MAC address */
|
||||||
|
-
|
||||||
|
-// port-mirroring configuration bit flags
|
||||||
|
-#define PM_DAEMON 0x01 /* run as background process */
|
||||||
|
-#define PM_DEBUG 0x02 /* display debugging messages to console */
|
||||||
|
-#define PM_TZSP 0x04 /* send packets using TaZmen Sniffer Protocol */
|
||||||
|
-#define PM_DST_IF 0x08 /* destination is a network interface */
|
||||||
|
-#define PM_DST_IP 0x10 /* destination is an internet protocol address */
|
||||||
|
-#define PM_PROMISC 0x20 /* place source interface in promiscuous mode */
|
||||||
|
-#define PM_SYSLOG 0x40 /* log messages to syslog facility */
|
||||||
|
-
|
||||||
|
-// if no configuration file is specified, look through these in order
|
||||||
|
-#define CFG_PATH_1 "/etc/config/port-mirroring"
|
||||||
|
-#define CFG_PATH_2 "/etc/port-mirroring"
|
||||||
|
-#define CFG_PATH_3 "port-mirroring.conf"
|
||||||
|
-
|
||||||
|
-// default program id file
|
||||||
|
-#define PID_PATH "/var/run/port-mirroring.pid"
|
||||||
|
-
|
||||||
|
-// program-wide configuration settings and variables
|
||||||
|
-struct pm_cfg
|
||||||
|
-{
|
||||||
|
- char *cfg_file; /* path to configuration file */
|
||||||
|
- uint8_t flags; /* boolean setting bitmask */
|
||||||
|
- char src[SRC_MAX][IFNAMSIZ]; /* source network interfaces */
|
||||||
|
- char dst_if[IFNAMSIZ]; /* destination network interface */
|
||||||
|
- in_addr_t dst_ip; /* destination IP address */
|
||||||
|
- char pfe[PFE_MAX]; /* tcpdump packet filter expression */
|
||||||
|
- char *pid_file; /* path to process id file */
|
||||||
|
- int src_count; /* number of source ports */
|
||||||
|
- char src_mac[MACADDRLEN]; /* source MAC address */
|
||||||
|
- char dst_mac[MACADDRLEN]; /* destination MAC address */
|
||||||
|
- time_t init_time; /* used to check for timeouts */
|
||||||
|
- int packet_count; /* number of packets processed */
|
||||||
|
-};
|
||||||
|
-
|
||||||
|
-void find_cfg(struct pm_cfg *cfg);
|
||||||
|
-char * printMACStr(const char *mac);
|
||||||
|
-char * getUCIItem(char *buf, char *item);
|
||||||
|
-int getUCIConf(char *buf, char *option, char *value);
|
||||||
|
-
|
||||||
|
-#endif // PORT_MIRRORING_UTIL_H_
|
||||||
|
+/*
|
||||||
|
+ * Copyright (c) 2015 Mike Maraya <mike[dot]maraya[at]gmail[dot]com>
|
||||||
|
+ * All rights reserved.
|
||||||
|
+ *
|
||||||
|
+ * This file is subject to the terms and conditions defined in
|
||||||
|
+ * https://github.com/mmaraya/port-mirroring/blob/master/LICENSE,
|
||||||
|
+ * which is part of this software package.
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef PORT_MIRRORING_UTIL_H_
|
||||||
|
+#define PORT_MIRRORING_UTIL_H_
|
||||||
|
+
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <net/if.h>
|
||||||
|
+#include <netinet/in.h>
|
||||||
|
+#include <stdint.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <syslog.h>
|
||||||
|
+#include <linux/limits.h>
|
||||||
|
+
|
||||||
|
+#define OPTION_MAX 254 /* max value for program options */
|
||||||
|
+#define TIMEBUF 32 /* max timestamp length RFC3339 */
|
||||||
|
+#define SRC_MAX 4 /* maxium number of source network interfaces */
|
||||||
|
+#define PFE_MAX 80 /* maximum length of packet filter expression */
|
||||||
|
+#define MACADDRLEN 6 /* length of a MAC address */
|
||||||
|
+
|
||||||
|
+// port-mirroring configuration bit flags
|
||||||
|
+#define PM_DAEMON 0x01 /* run as background process */
|
||||||
|
+#define PM_DEBUG 0x02 /* display debugging messages to console */
|
||||||
|
+#define PM_TZSP 0x04 /* send packets using TaZmen Sniffer Protocol */
|
||||||
|
+#define PM_DST_IF 0x08 /* destination is a network interface */
|
||||||
|
+#define PM_DST_IP 0x10 /* destination is an internet protocol address */
|
||||||
|
+#define PM_PROMISC 0x20 /* place source interface in promiscuous mode */
|
||||||
|
+#define PM_SYSLOG 0x40 /* log messages to syslog facility */
|
||||||
|
+
|
||||||
|
+// if no configuration file is specified, look through these in order
|
||||||
|
+#define CFG_PATH_1 "/etc/config/port-mirroring"
|
||||||
|
+#define CFG_PATH_2 "/etc/port-mirroring"
|
||||||
|
+#define CFG_PATH_3 "port-mirroring.conf"
|
||||||
|
+
|
||||||
|
+// default program id file
|
||||||
|
+#define PID_PATH "/var/run/port-mirroring.pid"
|
||||||
|
+
|
||||||
|
+// program-wide configuration settings and variables
|
||||||
|
+struct pm_cfg
|
||||||
|
+{
|
||||||
|
+ char *cfg_file; /* path to configuration file */
|
||||||
|
+ uint8_t flags; /* boolean setting bitmask */
|
||||||
|
+ char src[SRC_MAX][IFNAMSIZ]; /* source network interfaces */
|
||||||
|
+ char dst_if[IFNAMSIZ]; /* destination network interface */
|
||||||
|
+ in_addr_t dst_ip; /* destination IP address */
|
||||||
|
+ char pfe[PFE_MAX]; /* tcpdump packet filter expression */
|
||||||
|
+ char *pid_file; /* path to process id file */
|
||||||
|
+ int src_count; /* number of source ports */
|
||||||
|
+ char src_mac[MACADDRLEN]; /* source MAC address */
|
||||||
|
+ char dst_mac[MACADDRLEN]; /* destination MAC address */
|
||||||
|
+ time_t init_time; /* used to check for timeouts */
|
||||||
|
+ int packet_count; /* number of packets processed */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+void find_cfg(struct pm_cfg *cfg);
|
||||||
|
+char * printMACStr(const char *mac);
|
||||||
|
+char * getUCIItem(char *buf, char *item);
|
||||||
|
+int getUCIConf(char *buf, char *option, char *value);
|
||||||
|
+
|
||||||
|
+#endif // PORT_MIRRORING_UTIL_H_
|
12
net/port-mirroring/patches/020-fix-musl.patch
Normal file
12
net/port-mirroring/patches/020-fix-musl.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git a/include/config.h b/include/config.h
|
||||||
|
index ac948ba..da93160 100644
|
||||||
|
--- a/include/config.h
|
||||||
|
+++ b/include/config.h
|
||||||
|
@@ -19,6 +19,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
+#include <time.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
|
|
||||||
|
#define OPTION_MAX 254 /* max value for program options */
|
Loading…
Reference in a new issue