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:
parent
1a117215c7
commit
57c6d42784
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354858
@ -458,12 +458,10 @@ struct inet_port_params {
|
|||||||
static int
|
static int
|
||||||
ipv4_create(struct inet_port *port, struct inet_port_params *params)
|
ipv4_create(struct inet_port *port, struct inet_port_params *params)
|
||||||
{
|
{
|
||||||
uint32_t ip;
|
|
||||||
|
|
||||||
if (params->addr_len != 4)
|
if (params->addr_len != 4)
|
||||||
return (SNMP_ERR_INCONS_VALUE);
|
return (SNMP_ERR_INCONS_VALUE);
|
||||||
|
|
||||||
memcpy(&ip, params->addr, 4);
|
|
||||||
struct port_sock *sock = calloc(1, sizeof(struct port_sock));
|
struct port_sock *sock = calloc(1, sizeof(struct port_sock));
|
||||||
if (sock == NULL)
|
if (sock == NULL)
|
||||||
return (SNMP_ERR_GENERR);
|
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_len = sizeof(struct sockaddr_in);
|
||||||
sin->sin_family = AF_INET;
|
sin->sin_family = AF_INET;
|
||||||
sin->sin_addr.s_addr = htonl(ip);
|
|
||||||
sin->sin_port = htons(params->port);
|
sin->sin_port = htons(params->port);
|
||||||
|
memcpy(&sin->sin_addr, params->addr, 4); /* network byte order */
|
||||||
|
|
||||||
sock->port = port;
|
sock->port = port;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user