[ZBX-15206] 'remote_port' is deprecated Created: 2018 Nov 26  Updated: 2024 Apr 10  Resolved: 2018 Dec 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 3.0.24rc1, 4.0.2rc1, 4.2.0alpha1
Fix Version/s: 3.0.25rc1, 4.0.3rc1, 4.2.0alpha2, 4.2 (plan)

Type: Problem report Priority: Minor
Reporter: richlv Assignee: Michael Veksler
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team A
Team: Team A
Sprint: Sprint 46, Nov 2018, Sprint 47, Dec 2018
Story Points: 0.25

 Description   

Steps to reproduce:
gcc 8.2.1
net-snmp 5.8

Compile Zabbix.

Result:

checks_snmp.c: In function 'zbx_snmp_open_session':
checks_snmp.c:483:2: warning: 'remote_port' is deprecated [-Wdeprecated-declarations]
  session.remote_port = item->interface.port;
  ^~~~~~~
In file included from /usr/include/net-snmp/definitions.h:22,
                 from /usr/include/net-snmp/net-snmp-includes.h:67,
                 from checks_snmp.c:26:
/usr/include/net-snmp/types.h:345:21: note: declared here
     u_short         remote_port NETSNMP_ATTRIBUTE_DEPRECATED;
                     ^~~~~~~~~~~

Expected:
No deprecation messages.



 Comments   
Comment by richlv [ 2018 Nov 26 ]

Unable to edit the issue, but this is with trunk r87213.

Comment by richlv [ 2018 Nov 26 ]

Warning seems to be added in 5.8, released in 2018-07-16.
Port to be included (colon-separated) in session.peername.

From https://fossies.org/linux/net-snmp/ChangeLog:

commit 06bfd94bc00509146e84752065bd2669fc3bc828
Author: Bart Van Assche <[email protected]>
Date: Sun Apr 2 09:03:40 2017 -0700

snmplib: Mark snmp_session.remote_port as deprecated

Ensure that the compiler issues a warning if a value is assigned to
remote_port. This member has been deprecated a long time ago.

Comment by Vladislavs Sokurenko [ 2018 Dec 05 ]

(1) Minimal final version 4.2.7.1 2008-06-09 supports both peername and remote_port see http://www.net-snmp.org/dev/schedule.html and http://www.net-snmp.org/download.html
However version 5.0.11.2 2008-06-19 and upwards only support peername.
Both versions reached end of life and current LTS version is 5.4.x released in 2011-06-24 that also supports only peername.

So it is suggested to simply remove redundant deprecated parameter.
If someone still uses 4.2.7.1 then it will still work due to existing code:

	zbx_snprintf(addr, sizeof(addr), "%s:%hu", item->interface.addr, item->interface.port);

MVekslers I agree. Since even CentOS31 uses net-snmp-5.0.9
RESOLVED in r87657.

vso CLOSED

Comment by Michael Veksler [ 2018 Dec 11 ]

Available in:

  • 3.0.25rc1 r87734
  • 4.0.3rc1 r87735
  • 4.2.0alpha2 (trunk) r87736
Generated at Sat Apr 20 02:01:55 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.