* [PATCH] utils/net/rtnet: use NETMASK also with TDMA_CONFIG on master stations
@ 2022-07-22 14:48 Mauro Salvini
2022-07-24 14:58 ` Jan Kiszka
0 siblings, 1 reply; 2+ messages in thread
From: Mauro Salvini @ 2022-07-22 14:48 UTC (permalink / raw)
To: xenomai; +Cc: Mauro Salvini
Before this change, on TDMA master stations using the TDMA_CONFIG file
the NETMASK parameter was not used and netmask was assigned automatically
by [rt]ifconfig (deriving from IP class of the address assigned to the station),
both on master and on slaves.
Instead, on TDMA master stations not using the TDMA_CONFIG file, the NETMASK
parameter specified in rtnet.conf was used both for master and slaves.
This commit uniforms the NETMASK usage between configurations with and without
TDMA_CONFIG file.
Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
---
utils/net/rtnet.conf.in | 6 ++++--
utils/net/rtnet.in | 7 +++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/utils/net/rtnet.conf.in b/utils/net/rtnet.conf.in
index 12335d26e..6b542b8d6 100644
--- a/utils/net/rtnet.conf.in
+++ b/utils/net/rtnet.conf.in
@@ -27,9 +27,11 @@ RT_DRIVER_OPTIONS=""
REBIND_RT_NICS=""
# IP address and netmask of this station
-# The TDMA_CONFIG file overrides these parameters for masters and backup
-# masters. Leave blank if you do not use IP addresses or if this station is
+# The TDMA_CONFIG file overrides the IPADDR parameter for masters.
+# Leave blank if you do not use IP addresses or if this station is
# intended to retrieve its IP from the master based on its MAC address.
+# If this station is a TDMA master, netmask is used also for slaves.
+# If leaved blank, the default netmask for the IPADDR IP class will be used.
IPADDR="10.0.0.1"
NETMASK=""
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index 9b5f70440..a5c31ad40 100644
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -78,7 +78,7 @@ init_rtnet() {
submit_cfg() {
case "$STATION_TYPE" in
master)
- $RTIFCONFIG rteth0 up "$STATION_IP"
+ $RTIFCONFIG rteth0 up "$STATION_IP" $NETMASK_OPT
if [ -n "$UPDELAY" ]; then
sleep "$UPDELAY"
@@ -88,7 +88,6 @@ submit_cfg() {
eval "$TDMA_SLOTS"
IPADDR=$STATION_IP
- NETMASK_OPT=
;;
slave)
if [ ! "$STATION_IP" = "" ]; then
@@ -101,7 +100,7 @@ submit_cfg() {
RTCFG_CLIENT="$STATION_MAC"
fi
- ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
+ ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP $NETMASK_OPT"
echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
$RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
@@ -117,7 +116,7 @@ submit_cfg() {
RTCFG_CLIENT="$STATION_MAC"
fi
- ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
+ ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP $NETMASK_OPT"
STAGE_2_OPT=
if [ ! "$STATION_STAGE_2_SRC" = "" ]; then
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] utils/net/rtnet: use NETMASK also with TDMA_CONFIG on master stations
2022-07-22 14:48 [PATCH] utils/net/rtnet: use NETMASK also with TDMA_CONFIG on master stations Mauro Salvini
@ 2022-07-24 14:58 ` Jan Kiszka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2022-07-24 14:58 UTC (permalink / raw)
To: Mauro Salvini, xenomai
On 22.07.22 16:48, Mauro Salvini wrote:
> Before this change, on TDMA master stations using the TDMA_CONFIG file
> the NETMASK parameter was not used and netmask was assigned automatically
> by [rt]ifconfig (deriving from IP class of the address assigned to the station),
> both on master and on slaves.
> Instead, on TDMA master stations not using the TDMA_CONFIG file, the NETMASK
> parameter specified in rtnet.conf was used both for master and slaves.
> This commit uniforms the NETMASK usage between configurations with and without
> TDMA_CONFIG file.
>
> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
> ---
> utils/net/rtnet.conf.in | 6 ++++--
> utils/net/rtnet.in | 7 +++----
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/utils/net/rtnet.conf.in b/utils/net/rtnet.conf.in
> index 12335d26e..6b542b8d6 100644
> --- a/utils/net/rtnet.conf.in
> +++ b/utils/net/rtnet.conf.in
> @@ -27,9 +27,11 @@ RT_DRIVER_OPTIONS=""
> REBIND_RT_NICS=""
>
> # IP address and netmask of this station
> -# The TDMA_CONFIG file overrides these parameters for masters and backup
> -# masters. Leave blank if you do not use IP addresses or if this station is
> +# The TDMA_CONFIG file overrides the IPADDR parameter for masters.
> +# Leave blank if you do not use IP addresses or if this station is
> # intended to retrieve its IP from the master based on its MAC address.
> +# If this station is a TDMA master, netmask is used also for slaves.
> +# If leaved blank, the default netmask for the IPADDR IP class will be used.
> IPADDR="10.0.0.1"
> NETMASK=""
>
> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
> index 9b5f70440..a5c31ad40 100644
> --- a/utils/net/rtnet.in
> +++ b/utils/net/rtnet.in
> @@ -78,7 +78,7 @@ init_rtnet() {
> submit_cfg() {
> case "$STATION_TYPE" in
> master)
> - $RTIFCONFIG rteth0 up "$STATION_IP"
> + $RTIFCONFIG rteth0 up "$STATION_IP" $NETMASK_OPT
>
> if [ -n "$UPDELAY" ]; then
> sleep "$UPDELAY"
> @@ -88,7 +88,6 @@ submit_cfg() {
> eval "$TDMA_SLOTS"
>
> IPADDR=$STATION_IP
> - NETMASK_OPT=
> ;;
> slave)
> if [ ! "$STATION_IP" = "" ]; then
> @@ -101,7 +100,7 @@ submit_cfg() {
> RTCFG_CLIENT="$STATION_MAC"
> fi
>
> - ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
> + ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP $NETMASK_OPT"
>
> echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
> @@ -117,7 +116,7 @@ submit_cfg() {
> RTCFG_CLIENT="$STATION_MAC"
> fi
>
> - ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
> + ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP $NETMASK_OPT"
>
> STAGE_2_OPT=
> if [ ! "$STATION_STAGE_2_SRC" = "" ]; then
Thanks, applied. Once again, I do not recall anyway why I did it the way
it was before and not like you propose now, but it makes sense this way.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-24 14:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22 14:48 [PATCH] utils/net/rtnet: use NETMASK also with TDMA_CONFIG on master stations Mauro Salvini
2022-07-24 14:58 ` Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.