These are chat archives for CZ-NIC/knot-resolver

13th
Mar 2018
Narzhan
@Narzhan
Mar 13 2018 09:13
I'd like to follow-up on @robcza question about multiple processes, I've started several instances with -f parameter and went on to experiment with aplication fw. All map commands were successful (at least no error happend) but when I tried to access fw rules (with map) it only returned one rule as if there was only one instance of knot running. I suspect that I was in the leaf knot instance, is there a way to know in which kresd instance i am or I have an issue elsewhere
Narzhan
@Narzhan
Mar 13 2018 09:29
Steps I took:
/ # kresd -f 4 . > kresd.log & pstree $$ -p
ash(10)-+-kresd(11)-+-kresd(13)
        |           |-kresd(14)
        |           `-kresd(15)
        |-kresd(16)
        `-pstree(17)
/ # kill 16
/ # [system] stopping ipc because of: No such file or directory

[2]+  Done                       kresd -f 4 . 1>kresd.log
/ # 
/ # pstree $$ -p
ash(10)-+-kresd(11)-+-kresd(13)
        |           |-kresd(14)
        |           `-kresd(15)
        `-pstree(21)
> map "hostname()"
[1] => narzhanpc

> map"modules = {'daf'}"

> map "daf.add 'src = 127.0.0.1 pass'"
[1] => {
    [rule] => {
        [count] => 0
        [id] => 0
        [cb] => function: 0x40a6d110
    }
    [info] => src = 127.0.0.1 pass
    [policy] => function: 0x40a6d110
}

> map "daf.rules"
[1] => {
    [1] => {
        [rule] => {
            [count] => 0
            [id] => 0
            [cb] => function: 0x40a6d110
        }
        [info] => src = 127.0.0.1 pass
        [policy] => function: 0x40a6d110
    }
}

> map 'worker.id'
[1] => 0

> map 'cache.stats()'
[1] => {
    [hit] => 0
    [delete] => 0
    [miss] => 0
    [insert] => 0
}
Petr Špaček
@pspacek
Mar 13 2018 14:06
@Narzhan Hello. map command works when you send it from the master/parent process, e.g. in your example from process ID 11. How do you connect to the processes?
kresd does not provide interactive command line when run with -f, so it unclear how you sent your commands.
My example:
$ socat unix-connect:/home/pspacek/tty/16712 -
> map "worker.id"
[1] => 0
[2] => 3
[3] => 2
[4] => 1
16712 is PID of the first process (which is parent of the others). We plan to rework this in a way which does not depend on parent/child relation ship but we are not there yet.