Bug 231996 - [PATCH] net-mgmt/net-snmp: first byte of IF-MIB::ifPhysAddress is always 0
Summary: [PATCH] net-mgmt/net-snmp: first byte of IF-MIB::ifPhysAddress is always 0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-06 11:01 UTC by Yuri Pankov
Modified: 2022-02-21 21:01 UTC (History)
2 users (show)

See Also:
pi: maintainer-feedback+


Attachments
use temporary copy for if_name (2.19 KB, patch)
2018-10-06 11:01 UTC, Yuri Pankov
no flags Details | Diff
updated-patch (1.88 KB, patch)
2019-09-29 07:16 UTC, Kurt Jaeger
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Pankov 2018-10-06 11:01:59 UTC
Created attachment 197828 [details]
use temporary copy for if_name

netsnmp_arch_interface_container_load() writes terminating NUL directly to the sdl_data *past* the length specified in sdl_nlen, overwriting first byte of physadrr.
Comment 1 Ryan Steinmetz freebsd_committer freebsd_triage 2018-10-06 19:52:11 UTC
This should probably be submitted to the upstream developers for net-snmp so that the patches can be included in the source.

I'm happy to apply these after they have accepted them.
Comment 2 Kurt Jaeger freebsd_committer freebsd_triage 2018-10-06 19:58:59 UTC
yuri already submitted this upstream:

https://sourceforge.net/p/net-snmp/code/merge-requests/20/

net-snmp released 5.8 in August this year, after 4(?) years since 5.7.3.
So a new release does not look likely.
Comment 3 Ryan Steinmetz freebsd_committer freebsd_triage 2018-10-07 01:38:35 UTC
Kurt,

I'm not sure what the net-snmp release schedule has to do with upstream accepting the patch, but, as previously stated, I'll get it committed once they do.
Comment 4 Kurt Jaeger freebsd_committer freebsd_triage 2018-10-07 08:32:45 UTC
yuri, can you test if the problem still persists with net-snmp-5.8 ?

There's a patch in

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232025
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2018-10-07 08:41:32 UTC
I checked the 5.8 code, the problem is still there.
Comment 6 Yuri Pankov 2018-10-07 09:02:21 UTC
I checked just to be sure, 1-4 are igb, of which 1,3,4 has physaddr starting with 0 themselves, but igb1 physaddr was set to 'aa:bb:cc:dd:ee:ff' using ifconfig.

$ snmpwalk -v 2c -c public localhost IF-MIB::ifTable.1.6
IF-MIB::ifPhysAddress.1 = STRING: 0:25:90:85:4e:98
IF-MIB::ifPhysAddress.2 = STRING: 0:bb:cc:dd:ee:ff
IF-MIB::ifPhysAddress.3 = STRING: 0:25:90:85:4e:9a
IF-MIB::ifPhysAddress.4 = STRING: 0:25:90:85:4e:9b
IF-MIB::ifPhysAddress.5 = STRING:
Comment 7 Kurt Jaeger freebsd_committer freebsd_triage 2019-09-29 07:16:10 UTC
Created attachment 207928 [details]
updated-patch

This patch is updated to work in 5.8. It's already in upstream, but not in 5.8.
Comment 8 Kurt Jaeger freebsd_committer freebsd_triage 2019-09-29 10:02:25 UTC
Ups, it's not in upstream.
Comment 9 commit-hook freebsd_committer freebsd_triage 2019-09-29 19:42:48 UTC
A commit references this bug:

Author: pi
Date: Sun Sep 29 19:41:49 UTC 2019
New revision: 513264
URL: https://svnweb.freebsd.org/changeset/ports/513264

Log:
  net-mgmt/net-snmp: fix for first byte of IF-MIB::ifPhysAddress is always 0

  - netsnmp_arch_interface_container_load() writes terminating NUL
    directly to the sdl_data *past* the length specified in sdl_nlen,
    overwriting first byte of physadrr.

  PR:		231996
  Submitted by:	Yuri Pankov <yuripv@yuripv.net>
  Reviewed by:	Bart Van Assche <bvanassche@acm.org> (upstream maintainer)
  Approved by:	zi (maintainer)
  Obtained from:	https://sourceforge.net/p/net-snmp/code/merge-requests/20/

Changes:
  head/net-mgmt/net-snmp/files/patch-agent_mibgroup_if-mib_data__access_interface__sysctl.c
Comment 10 Kurt Jaeger freebsd_committer freebsd_triage 2019-09-29 19:43:28 UTC
Committed as merged by upstream, thanks!
Comment 11 aamiinjimcaale6@gmail.com 2022-02-21 21:01:40 UTC
MARKED AS SPAM