Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ifi_baudrate as interface speed when if_media is not known #285

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ getmibstat.o: mibgroup/kernel_sunos5.c
snmpd$(EXEEXT): ${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG)
$(LINK) $(CFLAGS) -o $@ ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}

libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS} $(USELIBS)
libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION): ${LLIBAGENTOBJS} $(USELIBS) subdirs
$(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} @LD_NO_UNDEFINED@ $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) @AGENTLIBS@
$(RANLIB) $(AGENTLIB)

Expand Down
7 changes: 7 additions & 0 deletions agent/mibgroup/if-mib/data_access/interface_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,13 @@ netsnmp_arch_interface_container_load(netsnmp_container* container,
/* try to guess the speed from media type */
netsnmp_sysctl_get_if_speed(entry->name, &entry->speed,
&entry->speed_high);
#ifdef __FreeBSD__
if (entry->speed == 0) {
entry->speed = ifp->ifm_data.ifi_baudrate;
entry->speed_high = (ifp->ifm_data.ifi_baudrate +
499999) / 1000000;
}
#endif
if (entry->speed_high != 0) {
entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_HIGH_SPEED;
} else {
Expand Down