summaryrefslogtreecommitdiffstats
path: root/lib/resolver.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-11/+4
| | | | | | | The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: resolver per vrf supportPhilippe Guibert2021-11-231-1/+13
| | | | | | | | | add a parameter to resolver api that is the vrf identifier. this permits to make resolution self to each vrf. in case vrf netns backend is used, this is very practical, since resolution can happen on one netns, while it is not the case in an other one. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* lib: fix c-ares thread misuseDavid Lamparter2021-11-081-68/+110
| | | | | | | | | | | | | | | | | | | The `struct thread **ref` that the thread code takes is written to and needs to stay valid over the lifetime of a thread. This does not hold up if thread pointers are directly put in a `vector` since adding items to a `vector` may reallocate the entire array. The thread code would then write to a now-invalid `ref`, potentially corrupting entirely unrelated data. This should be extremely rare to trigger in practice since we only use one c-ares channel, which will likely only ever use one fd, so the vector is never resized. That said, c-ares using only one fd is just plain fragile luck. Either way, fix this by creating a resolver_fd tracking struct, and clean up the code while we're at it. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: fix incorrect thread managementIgor Ryzhov2021-10-061-13/+15
| | | | | | | | | | | The current code passes an address of a local variable to `thread_add_read` which stores it into `thread->ref` by the lib. The next time the thread callback is executed, the lib stores NULL into the `thread->ref` which means it writes into some random memory on the stack. To fix this, we should pass a pointer to the vector entry to the lib. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: require semicolon after FRR_DAEMON_INFO & co.David Lamparter2021-03-171-1/+1
| | | | | | ... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
* lib/xref: put setup calls in librariesDavid Lamparter2021-02-011-0/+3
| | | | | | | | Our "true" libraries (i.e. not modules) don't invoke neither FRR_DAEMON_INFO nor FRR_MODULE_SETUP, hence XREF_SETUP isn't invoked either. Invoke it directly to get things working. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: move CLI node names to cmd_node->nameDavid Lamparter2020-04-161-0/+1
| | | | | | | And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
* *: remove second parameter on install_node()David Lamparter2020-04-161-1/+3
| | | | | | | | | | There is really no reason to not put this in the cmd_node. And while we're add it, rename from pointless ".func" to ".config_write". [v2: fix forgotten ldpd config_write] Signed-off-by: David Lamparter <equinox@diac24.net>
* *: remove cmd_node->vtyshDavid Lamparter2020-04-161-1/+0
| | | | | | | The only nodes that have this as 0 don't have a "->func" anyway, so the entire thing is really just pointless. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: clean up cmd_node initializersDavid Lamparter2020-04-161-1/+5
| | | | | | ... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
* lib,nhrpd,bgpd/bmp: pass resolver failure detailsDavid Lamparter2019-12-111-8/+11
| | | | | | | | To keep the calling code agnostic of the DNS resolver libary used, pass a strerror-style string instead of a status code that would need extra handling. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib/resolver: support/bypass IP literalsDavid Lamparter2019-12-111-1/+31
| | | | | | | | libc-ares doesn't do IP literals, so we have to do that before running off to do DNS. Since this isn't BMP specific, move to lib/ so NHRP can benefit too. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib/resolver: NULL out callback before callDavid Lamparter2019-07-031-4/+6
| | | | | | | | The callback itself might want to reschedule the resolver, so it is useful to clear out the callback field before making the call instead of after. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: split off c-ares code from nhrpdDavid Lamparter2019-07-031-0/+245
This is useful in other places too, e.g. for BMP outbound connections. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>