Author: ae Date: Tue Nov 19 16:29:47 2019 New Revision: 354858 URL: https://svnweb.freebsd.org/changeset/base/354858
Log: 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 Modified: head/contrib/bsnmp/snmpd/trans_inet.c Modified: head/contrib/bsnmp/snmpd/trans_inet.c ============================================================================== --- head/contrib/bsnmp/snmpd/trans_inet.c Tue Nov 19 15:38:55 2019 (r354857) +++ head/contrib/bsnmp/snmpd/trans_inet.c Tue Nov 19 16:29:47 2019 (r354858) @@ -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_p 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; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"