]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r310586,r310587,r310588,r311381:
authorngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 13 Jan 2017 09:19:04 +0000 (09:19 +0000)
committerngie <ngie@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 13 Jan 2017 09:19:04 +0000 (09:19 +0000)
commit0027a6cb11f46b3618044593dae25deb730d8fa7
treed0b114910287f21a3e2adb097f351c05055a661a
parent2ed6f6ad7d568bd6b319e3865ad0bdca4fb0b3b0
MFC r310586,r310587,r310588,r311381:

r310586:

Refactor transport sources a bit to facilitate changes coming down pipeline

Add recv callback to transport layer to better facilitate code reuse and
readability and for symmetry with send callback. Move recv_dgram and
recv_stream to udp_recv and lsock_recv, respectively, and make the
beforementioned functions recv callbacks for the udp and lsock transports,
respectively.

Consolidate the check_priv* functions in their relevant trans*.c source to
limit scope/use.

Note: this code is roughly based content from the submitter, although this
was modified to be more of a direct move from snmpd/main.c to the trans_*.c
sources, and to reduce unnecessary static function declarations.

r310587:

Fix definition for recv_dgram(..); it should be "ssize_t", not "int"

I'm not sure why this wasn't flagged as an issue by the compiler, yet

r310588:

Fix return type for `ret` (recv callback) and sort variables by alignment

Again, for reasons I don't yet understand, this is not being flagged by the
compiler. Unlike the issue addressed in r310587, this problem existed prior
to r310586

r311381:

lsock_init_port: address issues with initializing sockaddr_un object

- Use strlcpy to ensure p->name doesn't overflow sa.sun_path [*].
- Use SUN_LEN(..) instead of spelling out calculation longhand (inspired
  by comment by jmallett).

Tested with: dgram and stream support with both bsnmpwalk and snmpwalk

CID: 1006825

git-svn-id: svn://svn.freebsd.org/base/stable/10@312058 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
contrib/bsnmp/snmpd/main.c
contrib/bsnmp/snmpd/snmpd.h
contrib/bsnmp/snmpd/trans_lsock.c
contrib/bsnmp/snmpd/trans_udp.c