[PATCH 2/4] utils: Always pass MAC address in pb-udhcpc

Samuel Mendoza-Jonas sam at mendozajonas.com
Tue Sep 6 11:45:52 AEST 2016


pb-udhcpc currently only passes the interface's MAC address for an 'add'
event, however it is useful to know it for any user event concerning a
network interface. Pass it to pb-event in all cases.

Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
---
 utils/pb-udhcpc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/utils/pb-udhcpc b/utils/pb-udhcpc
index 7ed9035..2747c59 100644
--- a/utils/pb-udhcpc
+++ b/utils/pb-udhcpc
@@ -40,7 +40,7 @@ pb_add () {
 
 	# Collect relevant parameters to add an option to the bootfile
 	# parameter
-	for name in rootpath siaddr bootfile
+	for name in rootpath siaddr bootfile mac
         do
                 value=$(eval "echo \${$name}")
                 [ -n "$value" ] || continue;
@@ -53,7 +53,8 @@ pb_add () {
 }
 
 pb_remove () {
-	pb-event remove@${interface}
+	mac=$(cat /sys/class/net/$interface/address)
+	pb-event remove@${interface} $mac
 }
 
 case "$1" in
-- 
2.9.3



More information about the Petitboot mailing list