utils/net/rtnet: use NETMASK also with TDMA_CONFIG on master stations
PATCH 1/1 utils/net/rtnet: use NETMASK also with TDMA_CONFIG on master stations
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.
--- utils/net/rtnet.conf.in | 6 ++++-- utils/net/rtnet.in | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-)
utils/net/rtnet.conf.in +4 -2
@@ -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=""
utils/net/rtnet.in +3 -4
@@ -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
Signature · 1 line
2.17.1
Jan Kiszka
AppliedQuoted 64 lines · Mauro Salvini
Before this change, on TDMA master stations using the
TDMA_CONFIGfile 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 theTDMA_CONFIGfile, the NETMASK parameter specified in rtnet.conf was used both for master and slaves. This commit uniforms the NETMASK usage between configurations with and withoutTDMA_CONFIGfile.Signed-off-by Mauro Salvini <[email protected]>--- utils/net/rtnet.conf.in | 6 ++++-- utils/net/rtnet.in | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-)utils/net/rtnet.conf.in +4
-2@@ -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=""utils/net/rtnet.in +2
-3@@ -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 -
utils/net/rtnet.in submit_cfg() { · line 122
Quoted 8 lines
utils/net/rtnet.in +1
-1@@ -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
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux