0

Here is a code block in LuCI (OpenWrt web UI) project.

I don't understand what this function is doing, and I am unable to find where it is called. Where is this function being called and what it is doing?

p = s:option(ListValue, "proto", translate("Protocol"))
p.override_values = true

p:value("pppoe", "PPPoE") 
p:value("pptp",  "PPTP")  

function p.write(self, section, value)
    if value == "pptp" or value == "pppoe" then
        self.map:set(section, "peerdns", "1")
        self.map:set(section, "defaultroute", "1")
    end
    return ListValue.write(self, section, value)
end
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
teik
  • 508
  • 4
  • 26

2 Answers2

0

I'm not sure where it is being called, but I assume from a network configuration LuCI web page.

It writes to the UCI Network configuration file (logically, a commit is needed for physical write).

References

Community
  • 1
  • 1
0

The function p.write(self, section, value) is overriding the abstract parent method. LuCI is an MVC, so Listvalue calls the write function when the page appling automatic.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131