]> git.ozlabs.org Git - petitboot/commitdiff
utils: Always pass MAC address in pb-udhcpc
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 5 Sep 2016 04:21:44 +0000 (14:21 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Thu, 8 Sep 2016 05:05:17 +0000 (15:05 +1000)
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@mendozajonas.com>
(cherry picked from commit 4da0965a861bedd4332217c131abf399bc2b5a18)

utils/pb-udhcpc

index 7ed9035d5e9dad89f7880a0815e645320b8939d4..4495266e4614ee31bd6cf3068acf15e591300b06 100644 (file)
@@ -40,7 +40,7 @@ pb_add () {
 
        # Collect relevant parameters to add an option to the bootfile
        # parameter
 
        # 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;
         do
                 value=$(eval "echo \${$name}")
                 [ -n "$value" ] || continue;
@@ -53,7 +53,8 @@ pb_add () {
 }
 
 pb_remove () {
 }
 
 pb_remove () {
-       pb-event remove@${interface}
+       mac=$(cat /sys/class/net/$interface/address)
+       pb-event remove@${interface} mac=$mac
 }
 
 case "$1" in
 }
 
 case "$1" in