Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert dhcp-relay docker to buster #4671

Merged
merged 9 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockers/docker-dhcp-relay/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-stretch
FROM docker-config-engine-buster

ARG docker_container_name
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
Expand Down
8 changes: 3 additions & 5 deletions rules/docker-dhcp-relay.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ DOCKER_DHCP_RELAY_DBG = $(DOCKER_DHCP_RELAY_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/$(DOCKER_DHCP_RELAY_STEM)

$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_RELAY) $(REDIS_TOOLS) $(SONIC_DHCPMON)
$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(DOCKER_DHCP_RELAY)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS)
$(DOCKER_DHCP_RELAY)_DBG_DEPENDS += $(ISC_DHCP_RELAY_DBG)

$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)
$(DOCKER_DHCP_RELAY)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_IMAGE_PACKAGES)

$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_STRETCH)
$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER)

SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)
SONIC_STRETCH_DOCKERS += $(DOCKER_DHCP_RELAY)

SONIC_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG)
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_DHCP_RELAY_DBG)
SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_DHCP_RELAY_DBG)

$(DOCKER_DHCP_RELAY)_CONTAINER_NAME = dhcp_relay
$(DOCKER_DHCP_RELAY)_RUN_OPT += --privileged -t
Expand Down
11 changes: 7 additions & 4 deletions rules/isc-dhcp.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# isc-dhcp packages

ISC_DHCP_VERSION = 4.3.5-2
ISC_DHCP_VERSION = 4.4.1
ISC_DHCP_VERSION_FULL = ${ISC_DHCP_VERSION}-2

export ISC_DHCP_VERSION
export ISC_DHCP_VERSION ISC_DHCP_VERSION_FULL

ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION)_$(CONFIGURED_ARCH).deb
ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(ISC_DHCP_RELAY)_SRC_PATH = $(SRC_PATH)/isc-dhcp
SONIC_MAKE_DEBS += $(ISC_DHCP_RELAY)

ISC_DHCP_RELAY_DBG = isc-dhcp-relay-dbgsym_$(ISC_DHCP_VERSION)_$(CONFIGURED_ARCH).deb
ISC_DHCP_RELAY_DBG = isc-dhcp-relay-dbgsym_$(ISC_DHCP_VERSION_FULL)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(ISC_DHCP_RELAY),$(ISC_DHCP_RELAY_DBG)))

export ISC_DHCP_RELAY ISC_DHCP_RELAY_DBG
2 changes: 1 addition & 1 deletion src/dhcpmon/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Package: sonic-dhcpmon
Architecture: any
Built-Using: ${misc:Built-Using}
Depends: libexplain51,
libevent-2.0-5
libevent-2.1-6
Description: SONiC DHCP Monitor
6 changes: 3 additions & 3 deletions src/isc-dhcp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
SHELL = /bin/bash
.SHELLFLAGS += -e

MAIN_TARGET = isc-dhcp-relay_$(ISC_DHCP_VERSION)_$(CONFIGURED_ARCH).deb
DERIVED_TARGETS = isc-dhcp-relay-dbgsym_$(ISC_DHCP_VERSION)_$(CONFIGURED_ARCH).deb
MAIN_TARGET = $(ISC_DHCP_RELAY)
DERIVED_TARGETS = $(ISC_DHCP_RELAY_DBG)

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Remove any stale files
Expand All @@ -16,7 +16,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Reset HEAD to the commit of the proper tag
# NOTE: Using "git checkout <tag_name>" here detaches our HEAD,
# which stg doesn't like, so we use this method instead
git reset --hard debian/$(ISC_DHCP_VERSION)
git reset --hard debian/$(ISC_DHCP_VERSION_FULL)

# Apply patches
stg init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Subject: [PATCH] Customizable Option 82 circuit ID and remote ID fields
1 file changed, 147 insertions(+), 24 deletions(-)

diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 344cee7..7b4c1ef 100644
index 0cb2ef6..418b943 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -75,6 +75,8 @@ int bad_circuit_id = 0; /* Circuit ID option in matching RAI option
Expand All @@ -19,8 +19,8 @@ index 344cee7..7b4c1ef 100644
+const char *agent_remote_id_fmt = NULL; /* Remote ID custom format string. */
int max_hop_count = 10; /* Maximum hop count */

#ifdef DHCPv6
@@ -148,9 +150,19 @@ static const char url[] =
int no_daemon = 0;
@@ -151,10 +153,20 @@ static const char url[] =

char *progname;

Expand All @@ -35,35 +35,66 @@ index 344cee7..7b4c1ef 100644
+" %%I DHCP relay agent IP Address\n" \
+
#ifdef DHCPv6
#ifdef RELAY_PORT
#define DHCRELAY_USAGE \
-"Usage: %s [-4] [-d] [-q] [-a] [-D]\n" \
+"Usage: %s [-4] [-d] [-q] [-a <circuit_id> <remote_id>] [-D]\n"\
" [-A <length>] [-c <hops>]\n" \
" [-p <port> | -rp <relay-port>]\n" \
" [-pf <pid-file>] [--no-pid]\n"\
@@ -171,11 +183,11 @@ char *progname;
" -l lower0 [ ... -l lowerN]\n" \
" -u upper0 [ ... -u upperN]\n" \
" lower (client link): [address%%]interface[#index]\n" \
-" upper (server link): [address%%]interface\n\n" \
+" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE \
" %s {--version|--help|-h}"
#else
#define DHCRELAY_USAGE \
-"Usage: %s [-4] [-d] [-q] [-a] [-D]\n"\
-"Usage: %s [-4] [-d] [-q] [-a] [-D]\n" \
+"Usage: %s [-4] [-d] [-q] [-a <circuit_id> <remote_id>] [-D]\n"\
" [-A <length>] [-c <hops>] [-p <port>]\n" \
" [-pf <pid-file>] [--no-pid]\n"\
" [-m append|replace|forward|discard]\n" \
@@ -165,17 +177,18 @@ char *progname;
@@ -190,13 +202,13 @@ char *progname;
" -l lower0 [ ... -l lowerN]\n" \
" -u upper0 [ ... -u upperN]\n" \
" lower (client link): [address%%]interface[#index]\n" \
-" upper (server link): [address%%]interface"
+" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE
" lower (client link): [address%%]interface[#index]\n" \
-" upper (server link): [address%%]interface\n\n" \
+" upper (server link): [address%%]interface\n\n" DHCRELAY_OPTION82_USAGE \
" %s {--version|--help|-h}"
#endif
#else /* !DHCPv6 */
#ifdef RELAY_PORT
#define DHCRELAY_USAGE \
-"Usage: %s [-d] [-q] [-a] [-D] [-A <length>] [-c <hops>]\n" \
+"Usage: %s [-d] [-q] [-a <circuit_id> <remote_id>] [-D] [-A <length>] [-c <hops>]\n" \
" [-p <port> | -rp <relay-port>]\n" \
" [-pf <pid-file>] [--no-pid]\n" \
" [-m append|replace|forward|discard]\n" \
@@ -204,18 +216,18 @@ char *progname;
" [-iu interface0 [ ... -iu interfaceN]\n" \
" [-id interface0 [ ... -id interfaceN]\n" \
" [-U interface]\n" \
-" server0 [ ... serverN]\n\n" \
+" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \
" %s {--version|--help|-h}"
#else
#define DHCRELAY_USAGE \
-"Usage: %s [-d] [-q] [-a] [-D] [-A <length>] [-c <hops>] [-p <port>]\n" \
+"Usage: %s [-d] [-q] [-a <circuit_id> <remote_id>] [-D]\n" \
+" [-A <length>] [-c <hops>] [-p <port>]\n" \
+"Usage: %s [-d] [-q] [-a <circuit_id> <remote_id>] [-D] [-A <length>] [-c <hops>] [-p <port>]\n" \
" [-pf <pid-file>] [--no-pid]\n" \
" [-m append|replace|forward|discard]\n" \
" [-i interface0 [ ... -i interfaceN]\n" \
" [-iu interface0 [ ... -iu interfaceN]\n" \
" [-id interface0 [ ... -id interfaceN]\n" \
" [-U interface]\n" \
-" server0 [ ... serverN]\n\n"
+" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE
-" server0 [ ... serverN]\n\n" \
+" server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \
" %s {--version|--help|-h}"
#endif

/*!
@@ -354,6 +367,15 @@ main(int argc, char **argv) {
#endif
@@ -471,6 +483,15 @@ main(int argc, char **argv) {
local_family_set = 1;
local_family = AF_INET;
#endif
Expand All @@ -79,7 +110,7 @@ index 344cee7..7b4c1ef 100644
add_agent_options = 1;
} else if (!strcmp(argv[i], "-A")) {
#ifdef DHCPv6
@@ -1050,6 +1072,81 @@ find_interface_by_agent_option(struct dhcp_packet *packet,
@@ -1171,6 +1192,81 @@ find_interface_by_agent_option(struct dhcp_packet *packet,
return (-1);
}

Expand Down Expand Up @@ -161,7 +192,7 @@ index 344cee7..7b4c1ef 100644
/*
* Examine a packet to see if it's a candidate to have a Relay
* Agent Information option tacked onto its tail. If it is, tack
@@ -1059,9 +1156,12 @@ static int
@@ -1180,9 +1276,12 @@ static int
add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
unsigned length, struct in_addr giaddr) {
int is_dhcp = 0, mms;
Expand All @@ -175,7 +206,7 @@ index 344cee7..7b4c1ef 100644

/* If we're not adding agent options to packets, we can skip
this. */
@@ -1195,17 +1295,40 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
@@ -1316,17 +1415,40 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
op = sp;
#endif

Expand Down Expand Up @@ -227,7 +258,7 @@ index 344cee7..7b4c1ef 100644
}

if (adding_link_select) {
@@ -1224,7 +1347,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
@@ -1351,7 +1473,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
* If not, forward without adding the option.
*/
if (max - sp >= optlen + 3) {
Expand All @@ -236,7 +267,7 @@ index 344cee7..7b4c1ef 100644

/* Okay, cons up *our* Relay Agent Information option. */
*sp++ = DHO_DHCP_AGENT_OPTIONS;
@@ -1232,16 +1355,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
@@ -1359,16 +1481,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,

/* Copy in the circuit id... */
*sp++ = RAI_CIRCUIT_ID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Subject: [PATCH] Support for obtaining name of physical interface that is a
1 file changed, 65 insertions(+), 2 deletions(-)

diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 4659660..0f7d658 100644
index db1af9c..f2418e8 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -1072,6 +1072,47 @@ find_interface_by_agent_option(struct dhcp_packet *packet,
@@ -1192,6 +1192,47 @@ find_interface_by_agent_option(struct dhcp_packet *packet,
return (-1);
}

Expand Down Expand Up @@ -60,7 +60,7 @@ index 4659660..0f7d658 100644
/*
* Format the message that will be used by circuit_id and remote_id
*/
@@ -1104,8 +1145,30 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack
@@ -1224,8 +1265,30 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack
break;

case 'p': /* Name of interface that we received the request from */
Expand Down Expand Up @@ -89,7 +89,7 @@ index 4659660..0f7d658 100644
+ }
+
+ str = ifname;
+ }
+ }
break;

case 'P': /* Physical address of interface that we received the request from */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Subject: [PATCH] Support for loading port alias map file to replace port name
1 file changed, 104 insertions(+), 1 deletion(-)

diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 0f7d658..797dac6 100644
index 00c81d3..54f132a 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -126,6 +126,14 @@ static void setup_streams(void);
@@ -129,6 +129,14 @@ static void setup_streams(void);
char *dhcrelay_sub_id = NULL;
#endif

Expand All @@ -27,7 +27,7 @@ index 0f7d658..797dac6 100644
static void do_relay4(struct interface_info *, struct dhcp_packet *,
unsigned int, unsigned int, struct iaddr,
struct hardware *);
@@ -140,6 +148,10 @@ static int strip_relay_agent_options(struct interface_info *,
@@ -143,6 +151,10 @@ static int strip_relay_agent_options(struct interface_info *,

static void request_v4_interface(const char* name, int flags);

Expand All @@ -36,9 +36,9 @@ index 0f7d658..797dac6 100644
+static void free_interface_alias_map(void);
+
static const char copyright[] =
"Copyright 2004-2016 Internet Systems Consortium.";
"Copyright 2004-2018 Internet Systems Consortium.";
static const char arr[] = "All rights reserved.";
@@ -155,7 +167,7 @@ char *progname;
@@ -158,7 +170,7 @@ char *progname;
"\n" \
" %%%% A single %%\n" \
" %%h Hostname of device\n" \
Expand All @@ -47,23 +47,23 @@ index 0f7d658..797dac6 100644
" %%P Hardware address of interface that generated the request\n" \
" %%C Client hardware address\n" \
" %%I DHCP relay agent IP Address\n" \
@@ -166,6 +178,7 @@ char *progname;
" [-A <length>] [-c <hops>] [-p <port>]\n" \
@@ -171,6 +183,7 @@ char *progname;
" [-p <port> | -rp <relay-port>]\n" \
" [-pf <pid-file>] [--no-pid]\n"\
" [-m append|replace|forward|discard]\n" \
+" [--name-alias-map-file <name-alias-map-file>]\n" \
" [-i interface0 [ ... -i interfaceN]\n" \
" [-iu interface0 [ ... -iu interfaceN]\n" \
" [-id interface0 [ ... -id interfaceN]\n" \
@@ -173,6 +186,7 @@ char *progname;
" server0 [ ... serverN]\n\n" \
" %s -6 [-d] [-q] [-I] [-c <hops>] [-p <port>]\n" \
@@ -179,6 +192,7 @@ char *progname;
" %s -6 [-d] [-q] [-I] [-c <hops>]\n" \
" [-p <port> | -rp <relay-port>]\n" \
" [-pf <pid-file>] [--no-pid]\n" \
+" [--name-alias-map-file <name-alias-map-file>]\n" \
" [-s <subscriber-id>]\n" \
" -l lower0 [ ... -l lowerN]\n" \
" -u upper0 [ ... -u upperN]\n" \
@@ -503,6 +517,11 @@ main(int argc, char **argv) {
@@ -619,6 +633,11 @@ main(int argc, char **argv) {
no_dhcrelay_pid = ISC_TRUE;
} else if (!strcmp(argv[i], "--no-pid")) {
no_pid_file = ISC_TRUE;
Expand All @@ -72,26 +72,26 @@ index 0f7d658..797dac6 100644
+ usage(use_noarg, argv[i-1]);
+ if (load_interface_alias_map(argv[i]) != 0)
+ log_fatal("Failed to load interface name-alias map.");
} else if (!strcmp(argv[i], "--version")) {
log_info("isc-dhcrelay-%s", PACKAGE_VERSION);
exit(0);
@@ -726,6 +745,7 @@ main(int argc, char **argv) {
} else if (argv[i][0] == '-') {
usage("Unknown command: %s", argv[i]);
} else {
@@ -841,6 +860,7 @@ main(int argc, char **argv) {
dispatch();

/* In fact dispatch() never returns. */
+ free_interface_alias_map();
return (0);
}

@@ -1151,6 +1171,7 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack
@@ -1271,6 +1291,7 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack
*/
if (packet->htype && !packet->giaddr.s_addr) {
int ret = 0, vlanid = 0;
+ char ifalias[IFNAMSIZ] = { 0 };

ret = _bridgefdbquery(print_hw_addr(packet->htype, packet->hlen, packet->chaddr),
ifname,
@@ -1167,6 +1188,18 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack
@@ -1287,6 +1308,18 @@ format_relay_agent_rfc3046_msg(const struct interface_info *ip, struct dhcp_pack
strncpy(ifname, ip->name, IFNAMSIZ);
}

Expand All @@ -105,12 +105,12 @@ index 0f7d658..797dac6 100644
+ // ifname, ifalias, print_hw_addr (packet->htype, packet->hlen, packet->chaddr));
+
+ strncpy(ifname, ifalias, IFNAMSIZ);
+ }
+ }
+
str = ifname;
}
}
break;
@@ -2096,3 +2129,73 @@ void request_v4_interface(const char* name, int flags) {
@@ -2313,3 +2346,73 @@ void request_v4_interface(const char* name, int flags) {
interface_snorf(tmp, (INTERFACE_REQUESTED | flags));
interface_dereference(&tmp, MDL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Subject: [PATCH 1/3] Add --enable-use-sockets to configure flags in
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 114606b..9919237 100755
index d3fcc1d..2a7219d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,7 +23,7 @@ CFLAGS+=-D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"'
@@ -24,7 +24,7 @@ CFLAGS+=-D_PATH_DHCLIENT_CONF='\"/etc/dhcp/dhclient.conf\"'
CFLAGS+=-D_PATH_DHCLIENT_DB='\"$(LEASE_PATH)/dhclient.leases\"'
CFLAGS+=-D_PATH_DHCLIENT6_DB='\"$(LEASE_PATH)/dhclient6.leases\"'

-CONFFLAGS=--prefix=/usr --enable-log-pid --enable-paranoia
+CONFFLAGS=--prefix=/usr --enable-log-pid --enable-paranoia --enable-use-sockets
-CONFFLAGS=--prefix=/usr --with-libbind=/usr --enable-log-pid --enable-paranoia
+CONFFLAGS=--prefix=/usr --with-libbind=/usr --enable-log-pid --enable-paranoia --enable-use-sockets

# cross-architecture building
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
Expand Down
Loading