Page MenuHomeFreeBSD

genl: stop using struct _getfamily_attrs, snl_genl_ctrl_mcast_group
ClosedPublic

Authored by glebius on Thu, Jan 16, 7:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jan 19, 1:35 PM
Unknown Object (File)
Sun, Jan 19, 8:15 AM
Unknown Object (File)
Sun, Jan 19, 5:08 AM
Unknown Object (File)
Sun, Jan 19, 3:13 AM
Unknown Object (File)
Fri, Jan 17, 4:35 AM
Subscribers

Details

Summary

This program has two modes: monitor a single family and dump known
families. The former uses directly snl_get_genl_family_info() which uses
supposedly internal struct _getfamily_attrs as the argument. The latter
uses a parser named genl_family_parser that makes a mixture of local
definitions and definitions from <netlink_snl_generic.h>. While the
struct genl_family_parser is local, it points at struct
snl_genl_ctrl_mcast_groups and struct snl_genl_ctrl_mcast_group that are
supposedly private to netlink_snl_generic.h, as are hanging off the
underscored _getfamily_attrs.

Rewrite this mess by using same parser for both modes, that is fully
implemented locally. This parser has another very important difference to
the one declared in the header library. It will copy strings out of the
message into memory allocated within the snl_state. With the header
library parser strings point into received packet and contents will be
overwritten on next netlink message. This is not a bug with existing
genl(1) program, but it would be with future changes.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable