RDK-59964 : ZeroConfig (IPv4LL) support for EntOS - AirPlay Devices#406
RDK-59964 : ZeroConfig (IPv4LL) support for EntOS - AirPlay Devices#406gururaajar wants to merge 14 commits intodevelopfrom
Conversation
Reason for change: NetworkManager Dispatcher to launch avahi-autoipd to launch, when interface connected and clean-up IPv4LL when IPv4 is received. Test Procedure: check whether link local IPv4 is assigned to wlan0 and eth0 when there is no valid IP. Priority:P1 Risks: Medium Signed-off-by: Gururaaja ESR<Gururaja_ErodeSriranganRamlingham@comcast.com>
Reason for change: NetworkManager Dispatcher to launch avahi-autoipd to launch, when interface connected and clean-up IPv4LL when IPv4 is received. Test Procedure: check whether link local IPv4 is assigned to wlan0 and eth0 when there is no valid IP. Priority:P1 Risks: Medium Signed-off-by: Gururaaja ESR<Gururaja_ErodeSriranganRamlingham@comcast.com>
…to topic/RDK-59964_new
…to topic/RDK-59964_new
…to topic/RDK-59964_new
…to topic/RDK-59964_new
…to topic/RDK-59964_new
…to topic/RDK-59964_new
…to topic/RDK-59964_new
…to topic/RDK-59964_new
…to topic/RDK-59964_new
There was a problem hiding this comment.
Pull request overview
This PR adds IPv4 Link-Local (ZeroConfig) support for CentOS-based AirPlay devices using avahi-autoipd. When network interfaces connect without receiving a valid IPv4 address via DHCP, a link-local IPv4 address (169.254.x.x) is automatically assigned. The implementation uses NetworkManager dispatcher to manage the lifecycle of avahi-autoipd services.
Changes:
- Added new script to start avahi-autoipd when network interfaces come up without global IPv4
- Modified NetworkManager dispatcher to stop avahi-autoipd when DHCP IPv4 is received
- Configured DHCP timeout behavior for eth0 interface to support ZeroConfig fallback
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/rdk/startLinkLocal.sh | New script that launches avahi-autoipd service for eth0/wlan0 interfaces when no global IPv4 is present |
| lib/rdk/NM_Dispatcher.sh | Added stop_zero_conf() function to clean up IPv4LL when DHCP IPv4 is acquired; adjusted DHCP timeout settings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| interfaceName=$1 | ||
|
|
||
| Log "From NM_preUp.sh $interfaceName" |
There was a problem hiding this comment.
The comment references 'NM_preUp.sh' but this script is 'startLinkLocal.sh'. This should be corrected to reference the actual script name.
| Log "From NM_preUp.sh $interfaceName" | |
| Log "From startLinkLocal.sh $interfaceName" |
|
|
||
| Log() | ||
| { | ||
| echo "$(/bin/timestamp) : $0: $*" >> $LOG_FILE |
There was a problem hiding this comment.
The variable $LOG_FILE should be quoted to prevent word splitting and globbing issues if the path contains spaces or special characters. Use >> "$LOG_FILE" instead.
| echo "$(/bin/timestamp) : $0: $*" >> $LOG_FILE | |
| echo "$(/bin/timestamp) : $0: $*" >> "$LOG_FILE" |
| if [[ "$interfaceName" == "eth0" ]]; then | ||
| WiredConnectionUUID=$(nmcli -t -f UUID,DEVICE connection show --active | grep ":$interfaceName$" | cut -d: -f1) | ||
| if [ -n "$WiredConnectionUUID" ]; then | ||
| nmcli connection modify "$WiredConnectionUUID" ipv4.dhcp-timeout 0 | ||
| nmcli device reapply "$interfaceName" | ||
| fi | ||
| fi |
There was a problem hiding this comment.
This block sets DHCP timeout to 0 when DHCP is received, but there's no comment explaining why this is necessary or how it relates to the ZeroConfig cleanup. Adding a comment would improve maintainability, especially since startLinkLocal.sh sets it to 'infinity'.
…to topic/RDK-59964_new
…to topic/RDK-59964_new
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [[ -n "$interfaceName" && ("$interfaceName" == "wlan0" || "$interfaceName" == "eth0") ]];then | ||
| if [[ "$interfaceName" == "eth0" ]];then |
There was a problem hiding this comment.
The condition syntax mixes POSIX test construct with bash-specific double brackets. For consistency with the shebang '#!/bin/sh' and broader portability, consider using POSIX-compliant syntax: if [ -n \"$interfaceName\" ] && { [ \"$interfaceName\" = \"wlan0\" ] || [ \"$interfaceName\" = \"eth0\" ]; }; then
| if [[ -n "$interfaceName" && ("$interfaceName" == "wlan0" || "$interfaceName" == "eth0") ]];then | |
| if [[ "$interfaceName" == "eth0" ]];then | |
| if [ -n "$interfaceName" ] && { [ "$interfaceName" = "wlan0" ] || [ "$interfaceName" = "eth0" ]; }; then | |
| if [ "$interfaceName" = "eth0" ]; then |
| if [[ -n "$interfaceName" && ("$interfaceName" == "wlan0" || "$interfaceName" == "eth0") ]];then | ||
| if [[ "$interfaceName" == "eth0" ]];then |
There was a problem hiding this comment.
The condition uses bash-specific double brackets and '==' operator. For consistency with the shebang '#!/bin/sh' and broader portability, use POSIX-compliant syntax: if [ \"$interfaceName\" = \"eth0\" ]; then
| if [[ -n "$interfaceName" && ("$interfaceName" == "wlan0" || "$interfaceName" == "eth0") ]];then | |
| if [[ "$interfaceName" == "eth0" ]];then | |
| if [ -n "$interfaceName" ] && { [ "$interfaceName" = "wlan0" ] || [ "$interfaceName" = "eth0" ]; }; then | |
| if [ "$interfaceName" = "eth0" ]; then |
| if [[ "$interfaceName" == "eth0" ]]; then | ||
| WiredConnectionUUID=$(nmcli -t -f UUID,DEVICE connection show --active | grep ":$interfaceName$" | cut -d: -f1) | ||
| if [ -n "$WiredConnectionUUID" ]; then | ||
| nmcli connection modify "$WiredConnectionUUID" ipv4.dhcp-timeout 0 | ||
| nmcli device reapply "$interfaceName" | ||
| fi | ||
| fi | ||
| if [[ "$interfaceName" == "wlan0" ]]; then | ||
| WifiConnectionUUID=$(nmcli -t -f UUID,DEVICE connection show --active | grep ":$interfaceName$" | cut -d: -f1) | ||
| if [ -n "$WifiConnectionUUID" ]; then | ||
| nmcli connection modify "$WifiConnectionUUID" ipv4.dhcp-timeout 0 | ||
| nmcli device reapply "$interfaceName" | ||
| fi | ||
| fi |
There was a problem hiding this comment.
This code block contains significant duplication - the same logic is repeated for both eth0 and wlan0. Consider consolidating this into a single block that executes for both interfaces, reducing code duplication and improving maintainability.
| if [[ "$interfaceName" == "eth0" ]]; then | |
| WiredConnectionUUID=$(nmcli -t -f UUID,DEVICE connection show --active | grep ":$interfaceName$" | cut -d: -f1) | |
| if [ -n "$WiredConnectionUUID" ]; then | |
| nmcli connection modify "$WiredConnectionUUID" ipv4.dhcp-timeout 0 | |
| nmcli device reapply "$interfaceName" | |
| fi | |
| fi | |
| if [[ "$interfaceName" == "wlan0" ]]; then | |
| WifiConnectionUUID=$(nmcli -t -f UUID,DEVICE connection show --active | grep ":$interfaceName$" | cut -d: -f1) | |
| if [ -n "$WifiConnectionUUID" ]; then | |
| nmcli connection modify "$WifiConnectionUUID" ipv4.dhcp-timeout 0 | |
| nmcli device reapply "$interfaceName" | |
| fi | |
| fi | |
| if [[ "$interfaceName" == "eth0" || "$interfaceName" == "wlan0" ]]; then | |
| ConnectionUUID=$(nmcli -t -f UUID,DEVICE connection show --active | grep ":$interfaceName$" | cut -d: -f1) | |
| if [ -n "$ConnectionUUID" ]; then | |
| nmcli connection modify "$ConnectionUUID" ipv4.dhcp-timeout 0 | |
| nmcli device reapply "$interfaceName" | |
| fi | |
| fi |
|
|
||
| if [ "x$interfaceName" != "x" ] && [ "$interfaceName" != "lo" ]; then | ||
| if [ "$interfaceStatus" == "dhcp4-change" ]; then | ||
| if [[ "$interfaceName" == "eth0" ]]; then |
There was a problem hiding this comment.
The condition uses bash-specific double brackets and '==' operator. For consistency with the shebang '#!/bin/sh' in this file and broader portability, use POSIX-compliant syntax: if [ \"$interfaceName\" = \"eth0\" ]; then
| nmcli device reapply "$interfaceName" | ||
| fi | ||
| fi | ||
| if [[ "$interfaceName" == "wlan0" ]]; then |
There was a problem hiding this comment.
The condition uses bash-specific double brackets and '==' operator. For consistency with the shebang '#!/bin/sh' in this file and broader portability, use POSIX-compliant syntax: if [ \"$interfaceName\" = \"wlan0\" ]; then
Reason for change: NetworkManager Dispatcher to launch avahi-autoipd to launch, when interface connected and clean-up IPv4LL when IPv4 is received.
Test Procedure: check whether link local IPv4 is assigned to wlan0 and eth0 when there is no valid IP.
Priority:P1
Risks: Medium