Skip to content
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
8 changes: 6 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pkgname=amazon-ec2-net-utils
version=2.6.0
version=2.7.0

# Used by 'install'
PREFIX?=/usr/local
Expand All @@ -26,12 +26,16 @@ ${DIRS}:
define varsubst
sed -i "s,AMAZON_EC2_NET_UTILS_LIBDIR,${PREFIX}/share/${pkgname},g" $1
endef
define varsubstlibs
sed -i "s,AMAZON_EC2_NET_UTILS_VERSION,${version},g" $1
endef

.PHONY: install
install: ${SHELLSCRIPTS} ${UDEVRULES} ${SHELLLIBS} | ${DIRS} ## Install the software. Respects DESTDIR
$(foreach f,${SHELLSCRIPTS},tgt=${BINDIR}/$$(basename --suffix=.sh $f);\
install -m755 $f $$tgt;${call varsubst,$$tgt};)
$(foreach f,${SHELLLIBS},install -m644 $f ${SHARE_DIR})
$(foreach f,${SHELLLIBS},tgt=${SHARE_DIR}/$$(basename $f);\
install -m644 $f $$tgt;${call varsubstlibs,$$tgt};)
$(foreach f,${UDEVRULES},install -m644 $f ${UDEVDIR};)
$(foreach f,$(wildcard systemd/network/*.network),install -m644 $f ${SYSTEMD_NETWORK_DIR};)
$(foreach f,$(wildcard systemd/system/*.service systemd/system/*.timer),install -m644 $f ${SYSTEMD_SYSTEM_DIR};)
Expand Down
2 changes: 1 addition & 1 deletion amazon-ec2-net-utils.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: amazon-ec2-net-utils
%define base_version 2.6.0
%define base_version 2.7.0
%define source_version %{base_version}%{?_source_version_suffix}
Version: %{base_version}%{?_rpm_version_suffix}
Release: 1%{?dist}
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
amazon-ec2-net-utils (2.7.0) unstable; urgency=medium

* New upstream release 2.7.0

-- Joe Kurokawa <joekurok@amazon.com> Thu, 26 Jun 2025 01:04:33 +0000

amazon-ec2-net-utils (2.6.0) unstable; urgency=medium

* New upstream release 2.6.0
Expand Down
23 changes: 21 additions & 2 deletions lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ declare unitdir
declare lockdir
declare reload_flag

# Version information - substituted during installation
declare PACKAGE_VERSION="AMAZON_EC2_NET_UTILS_VERSION"
if [ -z "$PACKAGE_VERSION" ]; then
PACKAGE_VERSION="unknown"
fi
declare -r USER_AGENT="amazon-ec2-net-utils/$PACKAGE_VERSION"
declare -r imds_endpoints=("http://169.254.169.254/latest" "http://[fd00:ec2::254]/latest")
declare -r imds_token_path="api/token"
declare -r syslog_facility="user"
Expand All @@ -39,7 +45,15 @@ declare self_iface_name=""
make_token_request() {
local ep=${1:-""}
local interface=${2:-""}
local -a curl_opts=(--max-time 5 --connect-timeout 0.15 -s --fail -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
local -a curl_opts=(
--max-time 5
--connect-timeout 0.15
-s
--fail
-X PUT
-H "X-aws-ec2-metadata-token-ttl-seconds: 60"
-A "$USER_AGENT"
)
if [ -n "$interface" ]; then
curl_opts+=(--interface "$interface")
fi
Expand Down Expand Up @@ -133,7 +147,12 @@ get_meta() {
fi
local url="${imds_endpoint}/meta-data/${key}"
local meta rc
local curl_opts=(-s --max-time 5 -H "X-aws-ec2-metadata-token:${imds_token}" -f)
local curl_opts=(
-s
--max-time 5
-H "X-aws-ec2-metadata-token:${imds_token}"
-f
-A "$USER_AGENT")
if [[ "$imds_interface" != "$default_route" ]]; then
curl_opts+=(--interface "$imds_interface")
fi
Expand Down