I am trying to write a C function to start the wired network interfaces eth0, eth1 up to eth2. This is how I wrote it, but I would like your opinion about it especially where I should declare err.
The attachment is best viewed with medit with a tab space of 2. On 27/08/2015, Edward Bartolo <[email protected]> wrote: > I don't think it is necessary to daemonise the backend as connection > to and disconnecting from a network is not something that is done > continuously. Therefore, in my humble opinion, running the backend on > request seems to be the best approach. This also avoids additional > complexity of requiring a dedicated init script. An SUID belonging to > root is enough for the backend to be allowed privileges automatically > whenever it is invoked. This means, the post installation script will > only need to "chmod u+s backend" and create a launcher on user > request. > > I will now test an installation to /usr/bin of both backend and > frontend using an SUID for the backend. If everthing goes well, it > would mean, the time for an ALPHA release of a .deb package for > netman, is possible now. > > I included more functionality in the frontend to recognise the > existence of an /etc/network/interfaces displaying and option to > connect to eth0 if that is found. I also included a compiler > conditional directive to compile the frontend so as to bypass the > requirement of sudo. > > When I am ready, and I think the project can be package, I will upload > to git.devuan.org > > > Edward > > On 26/08/2015, Isaac Dunham <[email protected]> wrote: >> On Wed, Aug 26, 2015 at 02:27:57PM +0200, tilt! wrote: >>> On 08/26/2015 01:36 PM, Irrwahn wrote: >>> >[...] >>> >Or, even better, you could easily pass the IF name as an additional >>> >parameter to the backend (and possily even use it as additional >>> > component >>> >to construct the interface file names). >>> >>> An easy way to obtain a list of interface names on Linux is: >>> >>> awk 'NR>2{gsub(/:/,"");print $1}' /proc/net/dev >> >> Or "ls /sys/class/net". >> For listing non-loopback devices only, use >> ls -d /sys/class/net/*/device | cut -d/ -f5 >> >> For wireless, check for the files "phy80211" or "wireless". >> >> The equivalent can be done trivially in C with readdir(); ask if you'd >> like >> an example. >> >> HTH, >> Isaac Dunham >> _______________________________________________ >> Dng mailing list >> [email protected] >> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng >> > _______________________________________________ Dng mailing list [email protected] https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
