Fix the byte order of IPv4 address parsed from begemotSnmpdTransInetStatus

config option.

An address is already in network byte order, there is no need to do
htonl().

PR:		242056
MFC after:	1 week
This commit is contained in:
Andrey V. Elsukov 2019-11-19 16:29:47 +00:00
parent 1a117215c7
commit 57c6d42784

View File

@ -458,12 +458,10 @@ struct inet_port_params {
static int
ipv4_create(struct inet_port *port, struct inet_port_params *params)
{
uint32_t ip;
if (params->addr_len != 4)
return (SNMP_ERR_INCONS_VALUE);
memcpy(&ip, params->addr, 4);
struct port_sock *sock = calloc(1, sizeof(struct port_sock));
if (sock == NULL)
return (SNMP_ERR_GENERR);
@ -477,8 +475,8 @@ ipv4_create(struct inet_port *port, struct inet_port_params *params)
sin->sin_len = sizeof(struct sockaddr_in);
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = htonl(ip);
sin->sin_port = htons(params->port);
memcpy(&sin->sin_addr, params->addr, 4); /* network byte order */
sock->port = port;