dhcpcd-discuss

Re: dhcpcd-dbus

Roy Marples

Fri Jun 06 11:36:09 2014

Hi

On 06/06/2014 12:10, Meran Ahmad wrote:
I’ve am trying to build an small API which using dhcocd-dbus.
unfortunately, I couldn’t find any guid or documentation for that. My
questions are:

What the arguments for “GetConfigBlocks” , “GetConfig “  and
“SetConfig” it askes a string input ?
What the deference between both of them ?
I assume that “SetConfig” method will set the ip configuration if we
want to configure them manually is that correct ?

Well, there is very little documentation for it.
dhcpcd-dbus primarily served dhcpcd-gtk, although a new dhcpcd-gtk version will no longer use dhcpcd-dbus and instead talk natively via sockets.

In answer to your question, GetConfigBlocks returns "blocks".
A block is an interface definition, ssid definition or profile definition.
Here is an example

# Top of file, global block
noipv6rs

# Config block interface eth0
interface eth0
static ip_address=1.2.3.4/16

# Config block for ssid Foo
ssid Foo
static ip_address=2.3.4.5/16

# Config block for ARP profile 1.1.1.1
profile 1.1.1.1
static ip_address=3.4.5.6/16

# Config block for ARP profile 00:11:22:33:44:55
profile 00:11:22:33:44:55
static ip_address=4.5.6.7/16

So GetConfigBlocks should return
interface eth0
ssid Foo
profile 1.1.1.1
profile 00:11:22:33:44:55

GetConfig "interface eth0" will return
static ip_address=1.2.3.4/16

the dhcpcd starts on boot and connect to the ethernet if the ethernet
is plugged. How can I stop that? I want to start the dhcp request from
my API

You can't stop it. dhcpcd is in control of itself and reacts to kernel events. If you wanted to try and control it you could do something like so, although I've not tested this

interface eth0
nodhcp
noipv6rs
noipv4ll

dhcpcd -k (there is a dbus reconfigure or rebind function I think)

That essentially writes a configuration which disables all activity on eth0 but keeps dhcpcd running.
When you want to activate it you could then write this

interface eth0

dhcpcd -k

And dhcpcd should then start DHCP as normal.

But I would ask why you want to do this? dhcpcd by design is meant to be left alone once configured and it will correctly react to kernel messages.
Let dhcpcd notify you when things happen :)

Roy

Follow-Ups:
Re: dhcpcd-dbusMeran Ahmad
References:
dhcpcd-dbusMeran Ahmad
Archive administrator: postmaster@marples.name