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

[DHCP Relay]: Add support for custom Option 82 circuit_id of the form '<hostname>:<portname>' #747

Merged
merged 10 commits into from
Jun 24, 2017
21 changes: 0 additions & 21 deletions dockers/docker-dhcp-relay/Dockerfile

This file was deleted.

31 changes: 31 additions & 0 deletions dockers/docker-dhcp-relay/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM docker-config-engine

# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

# Update apt's cache of available packages
RUN apt-get update

{% if docker_dhcp_relay_debs.strip() -%}
# Copy built Debian packages
{%- for deb in docker_dhcp_relay_debs.split(' ') %}
COPY debs/{{ deb }}{{' '}} debs/
{%- endfor %}

# Install built Debian packages and implicitly install their dependencies
{%- for deb in docker_dhcp_relay_debs.split(' ') %}
#RUN dpkg -i debs/{{ deb }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like commented code. it's confusing. Someone didn't removed old code, or necessary code wasn't uncommented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion. I was looking as the wrong comment!

RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt debs/{{ deb }}
{%- endfor %}
{%- endif %}

# Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

COPY ["start.sh", "isc-dhcp-relay.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["isc-dhcp-relay.j2", "/usr/share/sonic/templates/"]

ENTRYPOINT ["/usr/bin/supervisord"]

4 changes: 2 additions & 2 deletions dockers/docker-dhcp-relay/isc-dhcp-relay.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ INTERFACES="
{%- endif %}
{%- endfor %}"

# '-a' option provides option 82 circuit id information
OPTIONS="-a"
# '-a' option provides option 82 circuit_id and remote_id information
OPTIONS="-a \"%h:%p\" \"\""

3 changes: 2 additions & 1 deletion rules/docker-dhcp-relay.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

DOCKER_DHCP_RELAY = docker-dhcp-relay.gz
$(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay
$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY)
$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE)
SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)
SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)


Expand Down
13 changes: 13 additions & 0 deletions rules/isc-dhcp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# isc-dhcp packages

ISC_DHCP_VERSION = 4.3.1-6

export ISC_DHCP_VERSION

ISC_DHCP_COMMON = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb
$(ISC_DHCP_COMMON)_SRC_PATH = $(SRC_PATH)/isc-dhcp
SONIC_MAKE_DEBS += $(ISC_DHCP_COMMON)

ISC_DHCP_RELAY = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(ISC_DHCP_COMMON),$(ISC_DHCP_RELAY)))

3 changes: 3 additions & 0 deletions sonic-slave/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ RUN apt-get update && apt-get install -y \
# For sonic config engine testing
pyangbind

# Install dependencies for building isc-dhcp-relay
RUN apt-get -y build-dep isc-dhcp

RUN cd /usr/src/gtest && cmake . && make -C /usr/src/gtest

RUN mkdir /var/run/sshd
Expand Down
30 changes: 30 additions & 0 deletions src/isc-dhcp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e

MAIN_TARGET = isc-dhcp-common_$(ISC_DHCP_VERSION)_amd64.deb
DERIVED_TARGETS = isc-dhcp-relay_$(ISC_DHCP_VERSION)_amd64.deb

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Remove any stale files
rm -rf ./isc-dhcp

# Clone isc-dhcp repo
git clone git://anonscm.debian.org/pkg-dhcp/isc-dhcp.git
pushd ./isc-dhcp
git checkout -f debian/4.3.1-6
popd

# Apply patch
patch -p1 < isc-dhcp-4.3.1_dhcrelay-custom-circuit_id-remote_id-and-bridge-iface-support.patch

# Build source and Debian packages
pushd ./isc-dhcp
dpkg-buildpackage -rfakeroot -b -us -uc
popd

# Move the newly-built .deb packages to the destination directory
mv $* $(DERIVED_TARGETS) $(DEST)/

$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

Loading