Re: Getting listening port number while processing request

2024-05-22 Thread Teus Benschop
On Wed, 22 May 2024 at 01:58, Bart Van Assche wrote: > The attached patch in combination with a patch that reduces code > duplication have been applied. Please retest. > > Hello Bart, That is a nice update to reduce code duplication, and thanks for applying the patch plus the update. I've teste

Re: Getting listening port number while processing request

2024-05-21 Thread Bart Van Assche via Net-snmp-coders
On 5/21/24 5:14 AM, Teus Benschop wrote: Thank you for the go-ahead. I went ahead and created the patch for the UDP domain. In line with the previous patch where you had added support for IPv6, I have added that support to this patch too. It was tested and works fine when the snmpd listens on ud

Re: Getting listening port number while processing request

2024-05-21 Thread Teus Benschop
On Mon, 13 May 2024 at 14:26, Bart Van Assche wrote: > On 5/13/24 03:05, Teus Benschop wrote: > > > The patches work for the TCP domain, and that certainly is sufficient for > us, and we are happy. > > Would it also be helpful if I would create similar patches for the *UDP* > domain? > > Generali

Re: Getting listening port number while processing request

2024-05-13 Thread Bart Van Assche via Net-snmp-coders
On 5/13/24 03:05, Teus Benschop wrote: The patches work for the TCP domain, and that certainly is sufficient for us, and we are happy. Would it also be helpful if I would create similar patches for the *UDP* domain? Generalizing this work by adding UDP support for this mechanism sounds go

Re: Getting listening port number while processing request

2024-05-13 Thread Teus Benschop
On Thu, 9 May 2024 at 18:20, Teus Benschop wrote: > > I have tested the master branch on GitHub, including branch V5-9, on > getting the local listening port number of the agent. > It works well for TCP over IPv4 and also over IPv6. > In both cases I get to see the local listening port number whe

Re: Getting listening port number while processing request

2024-05-09 Thread Teus Benschop
Hello Bart, Thank you for adding IPv6 support to the patch, and for integrating all the changes into the V5-9 branch. We are so glad about that. I have tested the master branch on GitHub, including branch V5-9, on getting the local listening port number of the agent. It works well for TCP over I

Re: Getting listening port number while processing request

2024-05-08 Thread Bart Van Assche via Net-snmp-coders
On 5/8/24 1:42 AM, Teus Benschop wrote: I have implemented the f_setup_session() callback in the snmpTCPBaseDomain.h/.c files. This callback obtains the port number and copies that into the session object. Then from the session object, the local_port is available while processing the SNMP req

Re: Getting listening port number while processing request

2024-05-08 Thread Teus Benschop
On Wed, 3 Apr 2024 at 18:45, Bart Van Assche wrote: > I think this is the callchain for registering the ports that the agent > listens on: > > init_master_agent() > netsnmp_agent_listen_on() > netsnmp_transport_open_server() > netsnmp_register_agent_nsap() > netsnmp_sess_config_tr

Re: Getting listening port number while processing request

2024-04-04 Thread Teus Benschop
On Wed, 3 Apr 2024 at 18:45, Bart Van Assche wrote: > > I think this is the callchain for registering the ports that the agent > listens on: > [...] > One possible approach is to implement the .f_setup_session() callback in > the TCP transport and to make it copy the port information from the >

Re: Getting listening port number while processing request

2024-04-03 Thread Bart Van Assche
On 4/3/24 02:35, Teus Benschop wrote: A snmpd was set to listen on 10 ports through multiple entries like “agentaddress tcp:” in the snmpd.conf file. It was verified through snmpget that the snmpd listens on all 10 ports. Function “netsnmp_callback_open” in file snmplib/transports/snmpCallba

Re: Getting listening port number while processing request

2024-04-03 Thread Teus Benschop
On Thu, 28 Mar 2024 at 00:13, Bart Van Assche wrote: > Thanks for the background information. I'm not sure the Net-SNMP API needs > to be modified to realize this. How about the following approach: > >- Use netsnmp_register_handler() in MIB implementations to associate >OIDs with callback

Re: Getting listening port number while processing request

2024-03-27 Thread Teus Benschop
On Thu, 28 Mar 2024 at 00:13, Bart Van Assche wrote: > Hi Teus, > > Thanks for the background information. I'm not sure the Net-SNMP API needs > to be modified to realize this. How about the following approach: > >- Use netsnmp_register_handler() in MIB implementations to associate >OIDs

Re: Getting listening port number while processing request

2024-03-27 Thread Bart Van Assche
On 3/27/24 00:15, Teus Benschop wrote: On Wed, 27 Mar 2024 at 00:58, Bart Van Assche wrote: Please explain why you want to obtain that information and also how you plan to use it. Which APIs to modify will depend on the answer to that question. Hello Bert, Thank you for asking t

Re: Getting listening port number while processing request

2024-03-27 Thread Teus Benschop
On Wed, 27 Mar 2024 at 00:58, Bart Van Assche wrote: > Please explain why you want to obtain that information and also how you > plan to use it. Which APIs to modify will depend on the answer to that > question. > > > Hello Bert, Thank you for asking this question. The background to this is tha

Re: Getting listening port number while processing request

2024-03-26 Thread Bart Van Assche
On 3/25/24 11:26, Teus Benschop wrote: 2. What are the ideas to expose this agent_tcp_port_number via the API? (Possibly I could add a function in the public API, that gets this variable and exposes it as a call.) Ideas? Please explain why you want to obtain that information and also how you

Re: Getting listening port number while processing request

2024-03-25 Thread Teus Benschop
Hello again, On the topic of getting the agent listening port number while processing a SNMP equest, discussed in previous emails: I am working on a proposal for a patch, and have this code already, as a first possible partial solution to the above wish. File: snmplib/transports/snmpTCPBaseDomai

Re: Getting listening port number while processing request

2023-09-08 Thread Craig Small via Net-snmp-coders
On Tue, 5 Sept 2023 at 22:16, Teus Benschop wrote: > I could not find a way to display the port number, also not using the > various debug tokens. > I ran snmpd as snmpd -f -Le -Dnetsnmp_udp 2000,3000 and got netsnmp_udp: recvfrom fd 6 got 41 bytes (from UDP: [127.0.0.1]:36600->[127.0.0.1]:2000)

Getting listening port number while processing request

2023-09-05 Thread Teus Benschop
Hello, I've been digging around in the library for a while to check out whether the port number that the agent listens on, if it listens on multiple ports, can be retrieved via the API, while the snmpd processes a request via snmpget or snmpset. I could not find a way to display the port number,