Re: listen for multicast traps

2011-02-17 Thread th exterit
_MEMBERSHIP, (void*)&multicast_request, sizeof(multicast_request))<0){ perror("setsockopt"); exit(1); } On Thu, Feb 17, 2011 at 2:22 PM, th exterit wrote: > Hi there. I'm writing a trap listener and using netsnmp, obviously. > > I want to be able to join a multi

listen for multicast traps

2011-02-17 Thread th exterit
Hi there. I'm writing a trap listener and using netsnmp, obviously. I want to be able to join a multicast group before I bind the socket in order to receive multicast traps. When I call 'netsnmp_transport_open_server("snmptrapd", "udp:162")' is there any option I set prior to this or can I modif

Re: obtaining client ip address

2011-02-16 Thread th exterit
pdu->transport_data_length); which gives you a textual representation ... On Wed, Feb 16, 2011 at 12:28 PM, Abraham Varricatt < abraham.varricatt+s...@googlemail.com> wrote: > On Wed, Feb 16, 2011 at 5:38 PM, th exterit wrote: > >> Thanks but that hasn&#x

Re: obtaining client ip address

2011-02-16 Thread th exterit
Thanks but that hasn't worked, damn. When a trap is recieved, I cast the corresponding pdu->transport_data to a sockaddr_in like you said and the address I get is "2.0.11.184" and it never changes. I find it remarkable that this is proving to be so difficult. Should I post on the coders mailing l

obtaining client ip address

2011-02-16 Thread th exterit
Apologies for this, but I truly mucked up the last thread when replying. I'm trying to get the client ip address from a trap listener I wrote. >From some digging about, it looks like I should be able to grab the ip from "pdu->agent_addr" but I'm getting null when trying to print it out and test.

Re: obtaining ip address

2011-02-16 Thread th exterit
r = NULL; sess.isAuthoritative = SNMP_SESS_UNKNOWNAUTH; rc = snmp_add(session, t, NULL, NULL); if (rc == NULL) { snmp_sess_perror("exteritytrapd", session); } return rc; } Can anyone see anything that I'm doing wrong? Thanks, Tom On Wed, Feb 16, 2011 a

Re: obtaining ip address

2011-02-16 Thread th exterit
r = NULL; sess.isAuthoritative = SNMP_SESS_UNKNOWNAUTH; rc = snmp_add(session, t, NULL, NULL); if (rc == NULL) { snmp_sess_perror("exteritytrapd", session); } return rc; } Can anyone see anything that I'm doing wrong? Thanks, Tom On Wed, Feb 16, 2011 a

Re: obtaining ip address

2011-02-16 Thread th exterit
lback or some such? On Tue, Feb 15, 2011 at 7:13 PM, Wes Hardaker < harda...@users.sourceforge.net> wrote: > >>>>> On Tue, 15 Feb 2011 16:13:39 +, th exterit > said: > > te> Does net-snmp provide a way to grab the IP address from whoever sent a > te>

obtaining ip address

2011-02-15 Thread th exterit
Hi there. Does net-snmp provide a way to grab the IP address from whoever sent a trap? Basically, in snmptrapd.c, you have the main 'while(netsnmp_running)' loop and inside that 'snmp_read()' is called which hands a pdu to a callback function. I want to get the ip address of the system that sent

Re: snmptrapd.c

2011-02-09 Thread th exterit
id of but at least it's working. Thanks. On Fri, Feb 4, 2011 at 2:57 PM, Dave Shield wrote: > On 3 February 2011 16:36, th exterit wrote: > > Trying to strip snmptrapd.c down to the essentials. I just want to be > able > > to receive traps and print them to the terminal f

snmptrapd.c

2011-02-03 Thread th exterit
Hi, Trying to strip snmptrapd.c down to the essentials. I just want to be able to receive traps and print them to the terminal for now. Here is what I have so far: http://pastebin.com/7W6Gc7ne I am trying to compile this to test. I don't expect it to work yet. Here is my Makefile: --

Re: trap listener

2011-02-02 Thread th exterit
Nevermind, I am being an idiot. I don't need to use libpcap since traps are being broadcast. On Wed, Feb 2, 2011 at 3:40 PM, th exterit wrote: > After a little digging, it seems as though I need to look at snmp_read() > which calls snmp_parse(). snmp_parse() is a static function so

Re: trap listener

2011-02-02 Thread th exterit
ckets handed to me from libpcap. Is there an alternative that I have missed? Note, I am not writing a daemon to accept traps, I am 'sniffing' traps from a local LAN. Thanks for any help. On Wed, Feb 2, 2011 at 10:52 AM, th exterit wrote: > Hi. > > I am currently writing a trap li

trap listener

2011-02-02 Thread th exterit
Hi. I am currently writing a trap listener. Basically traps are being sent to 255.255.255.255 on port 162 and I am 'sniffing' the traps using libpcap which was simple enough. But now I have raw snmp trap packets and I do not fancy learning how to parse these myself. Are there a set of simple fu

trap daemon

2011-01-31 Thread th exterit
Hi, I've been tasked with writing a trap listener in C which will then take specific device info from these traps and shove them in a database (postgresql). Can somebody point me in the right direction? I have had a look at apps/snmptrap*.c but I quickly ran out of steam when trying to follow it