NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Network Oddities

On Sat 07 May 2022 at 13:50:42 -0400, Ron Georgia wrote:
> This sounds fun, I love testing and troubleshooting, but (no laughing) I
> don't even know what the debug sets are or how to use them. I can look it
> up, and if you have some helpful docs, point me at them and I'll read those
> too.

In short, the debug sets are one option of the installer, of the
"things" you can install (such as base, compiler, X11, ...) , but it's
not included in the default. The set is rather big and it contains
exactly the sort of information that is useful to use with core files:
the correspondence between places in the excutable code and the source
code. With this the debugger can tell you more about what's going on, in
case of a crash.  If you have them installed, you have about 1.2GB of
files in /usr/libdata/debug.

On my laptop with NetBSD 9.2/amd64 installed, I have both a wifi and a
wired interface, which both connect to the same network. I made
ifconfig.* files for both of them, with the same content you mentioned;
booting with that dhcpcd seemed to work ok.  But a "service dhcpcd
restart" gave me a /dhcpcd.core file, like you.

> Any instructions on how to "read" the dhcpcd.core file to help discover
> where and how it failed?

With the debug files installed, gdb can tell you this sort of stuff:

vargaz:/$ sudo gdb /sbin/dhcpcd /dhcpcd.core 
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64--netbsd".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /sbin/dhcpcd...
Reading symbols from /usr/libdata/debug//sbin/dhcpcd.debug...
[New process 1]
Core was generated by `dhcpcd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000017e22799f in ipv6nd_applyra (ifp=ifp@entry=0x7bdd4398f100, 
    ctx=<optimized out>) at /usr/src/external/bsd/dhcpcd/dist/src/ipv6nd.c:628
628     /usr/src/external/bsd/dhcpcd/dist/src/ipv6nd.c: No such file or directory.
(gdb) bt      (that's short for backtrace)
#0  0x000000017e22799f in ipv6nd_applyra (ifp=ifp@entry=0x7bdd4398f100, 
    ctx=<optimized out>) at /usr/src/external/bsd/dhcpcd/dist/src/ipv6nd.c:628
#1  0x000000017e228277 in ipv6nd_handlera (hoplimit=<optimized out>, len=0, 
    icp=<optimized out>, ifp=0x7bdd4398f100, 
    sfrom=0x7f7fff05d990 "fe80::a96:d7ff:fea9:5c20", from=<optimized out>, 
    ctx=0x7f7fff06db10) at /usr/src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1356
#2  ipv6nd_recvmsg (msg=0x7f7fff05d930, ctx=0x7f7fff06db10)
    at /usr/src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1814
#3  ipv6nd_handledata (arg=0x7f7fff06db10)
    at /usr/src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1866
#4  0x000000017e20b408 in eloop_start (eloop=0x7bdd439e1aa0, 
    signals=<optimized out>)
    at /usr/src/external/bsd/dhcpcd/dist/src/eloop.c:983
#5  0x000000017e23190e in main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/external/bsd/dhcpcd/dist/src/dhcpcd.c:2120

(gdb) print rap
$1 = (struct ra *) 0x7bdd4394acc0
(gdb) print ifp->ctx->ra_routers
$2 = (struct ra_head *) 0x7bdd44832a80
(gdb) print ifp
$3 = (struct interface *) 0x7bdd4398f100
(gdb) print state
$4 = (struct rs_state *) 0x0	# AHA!! state->retrans =... would crash on this!
(gdb) print *ifp
$5 = {ctx = 0x7f7fff06db10, next = {tqe_next = 0x7bdd4398f200, 
    tqe_prev = 0x7bdd4398f008}, name = "re0", '\000' <repeats 12 times>, 
  index = 2, active = 2, flags = 4294936643, family = 1 '\001', 
  hwaddr = "\000&\236\316\214T", '\000' <repeats 13 times>, hwlen = 6 '\006', 
  vlanid = 0, metric = 202, carrier = 1, wireless = false, 
  ssid = '\000' <repeats 31 times>, ssid_len = 0, 
  profile = '\000' <repeats 63 times>, options = 0x7bdd43965440, if_data = {
    0x7bdd439e60f0, 0x0, 0x0, 0x0, 0x7bdd439a3140, 0x0, 0x0}}
    ^0                                             ^5

(some bits from the source:)

        struct rs_state *state = RS_STATE(ifp);
#define RS_STATE(a) ((struct rs_state *)(ifp)->if_data[IF_DATA_IPV6ND])
#define IF_DATA_IPV6ND  5

I don't have the source of 9.2 installed right now, but the crash would
be on line /usr/src/external/bsd/dhcpcd/dist/src/ipv6nd.c:628 in the
function ipv6nd_applyra(). The print commands that I tried were inspired
by the -current version of the ipv6nd_applyra() function, with the
reasoning that maybe the function was not changed, just moved in the

The -current version of dhcpcd is different from the one in 9.2:
line 628 is in function ipv6nd_sortrouters() now and ipv6nd_handlera()
starts at line 661.

It is therefore quite possible that this bug no longer exists in
-current; but I have not tried it.

If you want to puzzle this one out a bit further, there are at least 2
avenues of research possible: get the source from 9.2 and match it up
with the stack trace (do check for yourself you're getting the same one
that I found!), or you can install -current (maybe in a VM?), and try to
reproduce it there.

___ "Buying carbon credits is a bit like a serial killer paying someone else to
\X/  have kids to make his activity cost neutral." -The BOFH

Attachment: signature.asc
Description: PGP signature

Home | Main Index | Thread Index | Old Index