--blackhole)
blackhole="true"
;;
+ --mtu=*)
+ mtu=$(cli_get_val ${1})
+ ;;
*)
network=${1}
;;
fi
fi
+ if isset mtu && ! isinteger mtu; then
+ error "MTU must be an integer number: ${mtu}"
+ return ${EXIT_ERROR}
+ fi
+
local line
list_append line "network=\"${network}\""
fi
done
+ # Add MTU (if set).
+ if isset mtu; then
+ list_append line "mtu=\"${mtu}\""
+ fi
+
# Write line to file.
print "${line}" >> ${NETWORK_CONFIG_ROUTES}
return ${EXIT_OK}
fi
- local format="%-40s %-20s"
- print "${format}" "NETWORK/HOST" "GATEWAY"
+ local format="%-40s %-20s %-4s"
+ print "${format}" "NETWORK/HOST" "GATEWAY" "MTU"
local ${NETWORK_CONFIG_ROUTES_PARAMS}
local line
[ "${protocol}" = "${proto}" ] || continue
fi
- print "${format}" "${network}" "${gateway}"
+ # Print something when no MTU was set.
+ if ! isset mtu; then
+ mtu="-"
+ fi
+
+ print "${format}" "${network}" "${gateway}" "${mtu}"
done < ${NETWORK_CONFIG_ROUTES}
}
blackhole=*)
blackhole=$(cli_get_val ${arg})
;;
+ mtu=*)
+ mtu=$(cli_get_val ${arg})
+ ;;
esac
done <<< "$(args $@)"
[ ${counter} -eq 1 ] || return ${EXIT_ERROR}
fi
+ # mtu must be an integer number.
+ if isset mtu; then
+ isinteger mtu || return ${EXIT_ERROR}
+ fi
+
return ${EXIT_OK}
}
# Add the route.
route_entry_add ${network} --table="static" --proto="static" \
- --type="${type}" --gateway="${gateway}"
+ --type="${type}" --gateway="${gateway}" --mtu="${mtu}"
local ret=$?
if [ ${ret} -ne ${EXIT_OK} ]; then
local proto
local table
local type="unicast"
+ local mtu
local command
--proto=*)
proto=$(cli_get_val ${1})
;;
+ --mtu=*)
+ mtu=$(cli_get_val ${1})
+ ;;
*)
if isset network; then
warning "Unrecognized argument: ${1}"
# Validate input.
assert isoneof type unicast broadcast unreachable prohibit blackhole
assert ip_is_network ${network}
+ if isset mtu; then
+ assert isinteger mtu
+ fi
# Detect the protocol of the given network.
local protocol=$(ip_detect_protocol ${network})
list_append command "proto ${proto}"
fi
- cmd "${command}"
+ # Add MTU.
+ if isset mtu; then
+ list_append command "mtu ${mtu}"
+ fi
+
+ cmd_quiet "${command}"
}
function route_table_create() {
network-route \- Network Route Configuration Control Program
.SH SYNOPSIS
-\fBnetwork [OPTIONS] route add <network> [--gateway=..., --unreachable, --prohibit, --blackhole]\fR
+\fBnetwork [OPTIONS] route add <network> <--gateway=..., --unreachable, --prohibit, --blackhole> [--mtu=N]\fR
.P
\fBnetwork [OPTIONS] route remove <network>\fR
.P
.SH COMMANDS
The \fBnetwork route\fR command offers various sub commands:
-\fBadd <network> [--gateway=..., --unreachable, --prohibit, --blackhole]\fR
+\fBadd <network> <--gateway=..., --unreachable, --prohibit, --blackhole> [--mtu=N]\fR
.RS 4
A new route may be added by the \fBadd\fR command.
It is always required to pass a valid network prefix (\fB<network>\fR), which
.PP
Use \fB--unreachable\fR, \fB--prohibit\fR, \fB--blackhole\fR can be used to create
of that type. See \fBROUTE TYPES\fR below for more information about these options.
+.PP
+The optional \fB--mtu\fR parameter defines the MTU along the path to the
+destination and must be an integer number.
.RE
.PP
.RE
.PP
-\fBlist [--ipv6|--ipv4]\fR
+\fBlist [--protocol=ipv6|ipv4]\fR
.RS 4
Shows a list of all configured routes.
.PP
-Pass the protocol as shown above to filter.
+Pass the protocol option to filter the output only for the given
+protocol.
.RE
.PP