forked from oxidecomputer/omicron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
set -o errexit | ||
set -o pipefail | ||
|
||
. /lib/svc/share/smf_include.sh | ||
|
||
LISTEN_ADDR="$(svcprop -c -p config/listen_addr "${SMF_FMRI}")" | ||
LISTEN_PORT="$(svcprop -c -p config/listen_port "${SMF_FMRI}")" | ||
DATALINK="$(svcprop -c -p config/datalink "${SMF_FMRI}")" | ||
GATEWAY="$(svcprop -c -p config/gateway "${SMF_FMRI}")" | ||
ID="$(svcprop -c -p config/id "${SMF_FMRI}")" | ||
|
||
if [[ $DATALINK == unknown ]] || [[ $GATEWAY == unknown ]]; then | ||
printf 'ERROR: missing datalink or gateway\n' >&2 | ||
exit "$SMF_EXIT_ERR_CONFIG" | ||
fi | ||
|
||
# TODO remove when https://github.com/oxidecomputer/stlouis/issues/435 is addressed | ||
ipadm delete-if "$DATALINK" || true | ||
ipadm create-if -t "$DATALINK" | ||
|
||
ipadm set-ifprop -t -p mtu=9000 -m ipv4 "$DATALINK" | ||
ipadm set-ifprop -t -p mtu=9000 -m ipv6 "$DATALINK" | ||
|
||
ipadm show-addr "$DATALINK/ll" || ipadm create-addr -t -T addrconf "$DATALINK/ll" | ||
ipadm show-addr "$DATALINK/omicron6" || ipadm create-addr -t -T static -a "$LISTEN_ADDR" "$DATALINK/omicron6" | ||
route get -inet6 default -inet6 "$GATEWAY" || route add -inet6 default -inet6 "$GATEWAY" | ||
|
||
args=( | ||
'--address' "[$LISTEN_ADDR]:$LISTEN_PORT" | ||
'--id' "$ID" | ||
) | ||
|
||
exec /opt/oxide/oximeter/bin/oximeter run /var/svc/manifest/site/oximeter/config.toml "${args[@]}" & |