Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Apr 2019 10:49:15 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236930] bsnmpd snmp_target wrong port
Message-ID:  <bug-236930-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236930

            Bug ID: 236930
           Summary: bsnmpd snmp_target wrong port
           Product: Base System
           Version: 11.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: t.ermakova@securitycode.ru

Created attachment 203290
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D203290&action=
=3Dedit
A fix-patch

We've been trying to use smnp traps via snmp_target module and have encount=
ered
the situation, when big port number is not set correctly.
I've managed to track this down in trap.c. Here is a simple example in c++,
showing the problem.=20

vector<uint8_t> address =3D {0x07, 0x06, 0x05, 0x04, 0x1a, 0x85};
unsigned short from_code =3D htons(address[4]) << 8 | htons(address[5]) << =
0;
unsigned short correct =3D htons(address[4] << 8 | address[5]);
cout << ntohs(from_code) << ' ' << ntohs(correct) << endl;

The output is:
133 6789

133 is 0x85, while 6789 is the expected result for {0x1a, 0x85}.

I'm also attaching the patch that we'll be using in our project, so a
reply/review would be great. Thanks in advance.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236930-227>