dhcpcd-discuss

Re: Re: Issues with static configuration: routers

Yegor Yefremov

Wed Mar 28 12:20:52 2018

On Wed, Mar 28, 2018 at 12:04 PM, Roy Marples <roy@xxxxxxxxxxxx> wrote:
> Hi Yegor
>
>
> On 27/03/2018 07:48, Yegor Yefremov wrote:
>>
>> Hi Roy,
>>
>> On Fri, Jan 19, 2018 at 8:11 PM, Roy Marples <roy@xxxxxxxxxxxx> wrote:
>>>
>>> Hi Yegor
>>>
>>> On 18/01/2018 14:44, Yegor Yefremov wrote:
>>>>
>>>>
>>>> On Wed, Jan 17, 2018 at 10:08 AM, Yegor Yefremov
>>>> <yegorslists@xxxxxxxxxxxxxx> wrote:
>>>>>
>>>>>
>>>>> I'm using the latest git version and have following problem when
>>>>> trying to set the default gateway. The command below complains, that I
>>>>> don't specify an interface though it is present on the command line:
>>>>>
>>>>> # dhcpcd -S ip_address=192.168.1.233/24 -S
>>>>> domain_name_servers="192.168.1.1 192.
>>>>> 168.1.3" -S broadcast_address=192.168.1.255 -S routers=192.168.1.1 eth0
>>>>> static routes require an interface
>>>>>
>>>>> I was working with dhcpcd version 6.x before and the router made no
>>>>> problem. Am I missing some configuration option?
>>>>
>>>>
>>>>
>>>> I've looked at the code and found following:
>>>>
>>>> The first invocation of add_options() will be made with NULL instead
>>>> of ifname [1]. This leads to return value -1, as neither ifname nor
>>>> ctx->ifaces are available.
>>>>
>>>> [1] https://github.com/rsmarples/dhcpcd/blob/master/src/dhcpcd.c#L1548
>>>
>>>
>>>
>>> I added the interface requirement here:
>>>
>>> https://roy.marples.name/git/dhcpcd.git/commit/src/if-options.c?id=f96eff45c257a7d70b6412db8ccf8c6bb5666839
>>>
>>> Don't crash when --static routers= is given on the command line.
>>> T116 will make it work for the control socket.
>>>
>>> Sadly my MySQL instance for Phabricator is still hosed so I get any more
>>> detail about this right now.
>>>
>>> I'll try and spend some time reverting the changeset and seeing where it
>>> crashes and try and find an alternative implementation.
>>> Unsure how long this will take though, so if you have an idea, patches
>>> welcome.
>>
>>
>> Could you already have a look at this issue?
>>
>> I've played with moving interface enumeration up, but it didn't help a
>> lot.
>
>
> Really sorry, but I had forgotten about this!
> I lack the time in bringing a new bug tracker online ....
>
> I've had a stab at fixing it here:
> https://roy.marples.name/git/dhcpcd.git/commit/?id=17644e6823711d25d6fa381f9930ef63f2df104d
>
> Not had a chance to test it properly though.
> Let me know if it fixes it for you!

Thanks for the patch. A quick test reveals a segmentation fault :-(

strace dhcpcd -S routers=192.168.1.1 eth0
.......
ioctl(7, SIOCGIFMTU, {ifr_name="eth0", ifr_mtu=1500}) = 0
mmap2(NULL, 36864, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7700e000
rt_sigprocmask(SIG_BLOCK, ~[], [HUP INT PIPE ALRM TERM USR1 USR2], 16) = 0
clone(child_stack=0x77016fe0, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 185
munmap(0x7700e000, 36864)               = 0
rt_sigprocmask(SIG_SETMASK, [HUP INT PIPE ALRM TERM USR1 USR2], NULL, 16) = 0
waitpid(185, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 185
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=185,
si_uid=0, si_status=0, si_utime=2, si_stime=0} ---
getpid()                                = 184
ioctl(7, SIOCGIFMTU, {ifr_name="eth0", ifr_mtu=1500}) = 0
mmap2(NULL, 36864, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7700e000
rt_sigprocmask(SIG_BLOCK, ~[], [HUP INT PIPE ALRM TERM USR1 USR2], 16) = 0
clone(child_stack=0x77016fe0, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 186
munmap(0x7700e000, 36864)               = 0
rt_sigprocmask(SIG_SETMASK, [HUP INT PIPE ALRM TERM USR1 USR2], NULL, 16) = 0
waitpid(186, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 186
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=186,
si_uid=0, si_status=0, si_utime=3, si_stime=0} ---
clock_gettime(CLOCK_MONOTONIC, {tv_sec=369, tv_nsec=274357505}) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
Segmentation fault

Yegor

Follow-Ups:
Re: Re: Issues with static configuration: routersRoy Marples
References:
Issues with static configuration: routersYegor Yefremov
Re: Issues with static configuration: routersYegor Yefremov
Re: Re: Issues with static configuration: routersRoy Marples
Re: Re: Issues with static configuration: routersYegor Yefremov
Re: Re: Issues with static configuration: routersRoy Marples
Archive administrator: postmaster@marples.name