Implement netlink support for gre in ifconfig
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 70771 Build 67654: arc lint + arc unit
Event Timeline
| sbin/ifconfig/ifgre.c | ||
|---|---|---|
| 110–132 | Also, we have to add IFLA_LINKINFO parsers in every ifconfig modules to be able to access the IFLA_ driver specific data (same in geneve). | |
| 148 | Also, I hate that I have to do this comparison in order to stop running status functions for other drivers. | |
| 161 | @glebius Steps to reproduce: ifconfig gre0 create then to debug: gdb --args ifconfig gre0
(gdb) br gre_status_nl
Breakpoint 1 at 0x2cbb6: file /usr/src/sbin/ifconfig/ifgre.c, line 145.
(gdb) run
Starting program: /sbin/ifconfig gre0
gre0: flags=8050<POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1476
options=80000<LINKSTATE>
tunnel inet 127.0.0.1 --> 127.0.0.2
groups: gre
Breakpoint 1, gre_status_nl (ctx=0x7fffffffe4b8)
at /usr/src/sbin/ifconfig/ifgre.c:145
145 struct snl_errmsg_data errmsg = {};
(gdb) n
148 if (strncmp(ctx->ifname, "gre", sizeof("gre") - 1) != 0)
(gdb)
148 if (strncmp(ctx->ifname, "gre", sizeof("gre") - 1) != 0)
(gdb)
151 snl_init_writer(ctx->io_ss, &nw);
(gdb)
152 hdr = snl_create_msg_request(&nw, NL_RTM_GETLINK);
(gdb)
153 hdr->nlmsg_flags |= NLM_F_DUMP;
(gdb)
154 snl_reserve_msg_object(&nw, struct ifinfomsg);
(gdb)
155 snl_add_msg_attr_string(&nw, IFLA_IFNAME, ctx->ifname);
(gdb)
157 hdr = snl_finalize_msg(&nw);
(gdb)
158 if (hdr == NULL || !snl_send_message(ctx->io_ss, hdr))
(gdb)
161 if (!snl_read_reply_code(ctx->io_ss, hdr->nlmsg_seq, &errmsg))
(gdb) s
snl_read_reply_code (ss=0x7fffffffe450, nlmsg_seq=3, e=e@entry=0x7fffffffe340)
at /usr/include/netlink/netlink_snl.h:994
994 struct nlmsghdr *hdr = snl_read_reply(ss, nlmsg_seq);
(gdb) n
998 } else if (hdr->nlmsg_type == NLMSG_ERROR) {
(gdb) p hdr->nlmsg_type
$1 = 16 | |
| 247 | Also, I don't like to parse whole data structure of driver to fetch specific member. | |