2 * Copyright (C) 1999, 2000 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <net-snmp/net-snmp-config.h>
24 #include <net-snmp/net-snmp-includes.h>
35 #include "lib/version.h"
37 #include "bgpd/bgpd.h"
38 #include "bgpd/bgp_table.h"
39 #include "bgpd/bgp_aspath.h"
40 #include "bgpd/bgp_attr.h"
41 #include "bgpd/bgp_route.h"
42 #include "bgpd/bgp_fsm.h"
43 #include "bgpd/bgp_snmp.h"
44 #include "bgpd/bgp_snmp_bgp4.h"
45 #include "bgpd/bgp_mplsvpn_snmp.h"
47 /* Declare static local variables for convenience. */
50 /* BGP-MIB instances. */
51 static oid bgp_oid
[] = {BGP4MIB
};
52 static oid bgp_trap_oid
[] = {BGP4MIB
, 0};
54 /* IP address 0.0.0.0. */
55 static struct in_addr bgp_empty_addr
= {.s_addr
= 0};
57 static uint8_t *bgpVersion(struct variable
*v
, oid name
[], size_t *length
,
58 int exact
, size_t *var_len
,
59 WriteMethod
**write_method
)
61 static uint8_t version
;
63 if (smux_header_generic(v
, name
, length
, exact
, var_len
,
64 write_method
) == MATCH_FAILED
)
67 /* Return BGP version. Zebra bgpd only support version 4. */
68 version
= (0x80 >> (BGP_VERSION_4
- 1));
70 /* Return octet string length 1. */
75 static uint8_t *bgpLocalAs(struct variable
*v
, oid name
[], size_t *length
,
76 int exact
, size_t *var_len
,
77 WriteMethod
**write_method
)
81 if (smux_header_generic(v
, name
, length
, exact
, var_len
,
82 write_method
) == MATCH_FAILED
)
85 /* Get BGP structure. */
86 bgp
= bgp_get_default();
90 return SNMP_INTEGER(bgp
->as
);
93 static struct peer
*peer_lookup_addr_ipv4(struct in_addr
*src
)
97 struct listnode
*node
;
98 struct listnode
*bgpnode
;
100 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, bgpnode
, bgp
)) {
101 for (ALL_LIST_ELEMENTS_RO(bgp
->peer
, node
, peer
)) {
102 if (sockunion_family(&peer
->su
) != AF_INET
)
105 if (sockunion2ip(&peer
->su
) == src
->s_addr
)
113 static struct peer
*bgp_peer_lookup_next(struct in_addr
*src
)
117 struct peer
*next_peer
= NULL
;
118 struct listnode
*node
;
119 struct listnode
*bgpnode
;
121 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, bgpnode
, bgp
)) {
122 for (ALL_LIST_ELEMENTS_RO(bgp
->peer
, node
, peer
)) {
123 if (sockunion_family(&peer
->su
) != AF_INET
)
125 if (ntohl(sockunion2ip(&peer
->su
)) <=
130 ntohl(sockunion2ip(&next_peer
->su
)) >
131 ntohl(sockunion2ip(&peer
->su
))) {
138 src
->s_addr
= sockunion2ip(&next_peer
->su
);
145 /* 1.3.6.1.2.1.15.3.1.x = 10 */
146 #define PEERTAB_NAMELEN 10
148 static struct peer
*bgpPeerTable_lookup(struct variable
*v
, oid name
[],
149 size_t *length
, struct in_addr
*addr
,
152 struct peer
*peer
= NULL
;
153 size_t namelen
= v
? v
->namelen
: PEERTAB_NAMELEN
;
157 /* Check the length. */
158 if (*length
- namelen
!= sizeof(struct in_addr
))
161 oid2in_addr(name
+ namelen
, IN_ADDR_SIZE
, addr
);
163 peer
= peer_lookup_addr_ipv4(addr
);
166 len
= *length
- namelen
;
170 oid2in_addr(name
+ namelen
, len
, addr
);
172 peer
= bgp_peer_lookup_next(addr
);
177 oid_copy_in_addr(name
+ namelen
, addr
);
178 *length
= sizeof(struct in_addr
) + namelen
;
185 /* BGP write methods. */
186 static int write_bgpPeerTable(int action
, uint8_t *var_val
,
187 uint8_t var_val_type
, size_t var_val_len
,
188 uint8_t *statP
, oid
*name
, size_t length
)
194 if (var_val_type
!= ASN_INTEGER
) {
195 return SNMP_ERR_WRONGTYPE
;
197 if (var_val_len
!= sizeof(long)) {
198 return SNMP_ERR_WRONGLENGTH
;
201 intval
= *(long *)var_val
;
203 memset(&addr
, 0, sizeof(addr
));
205 peer
= bgpPeerTable_lookup(NULL
, name
, &length
, &addr
, 1);
207 return SNMP_ERR_NOSUCHNAME
;
209 if (action
!= SNMP_MSG_INTERNAL_SET_COMMIT
)
210 return SNMP_ERR_NOERROR
;
212 zlog_info("%s: SNMP write .%ld = %ld", peer
->host
,
213 (long)name
[PEERTAB_NAMELEN
- 1], intval
);
215 switch (name
[PEERTAB_NAMELEN
- 1]) {
216 case BGPPEERADMINSTATUS
:
217 #define BGP_PeerAdmin_stop 1
218 #define BGP_PeerAdmin_start 2
219 /* When the peer is established, */
220 if (intval
== BGP_PeerAdmin_stop
)
221 BGP_EVENT_ADD(peer
, BGP_Stop
);
222 else if (intval
== BGP_PeerAdmin_start
)
225 return SNMP_ERR_NOSUCHNAME
;
227 case BGPPEERCONNECTRETRYINTERVAL
:
228 peer_flag_set(peer
, PEER_FLAG_TIMER_CONNECT
);
229 peer
->connect
= intval
;
230 peer
->v_connect
= intval
;
232 case BGPPEERHOLDTIMECONFIGURED
:
233 peer_flag_set(peer
, PEER_FLAG_TIMER
);
234 peer
->holdtime
= intval
;
235 peer
->v_holdtime
= intval
;
237 case BGPPEERKEEPALIVECONFIGURED
:
238 peer_flag_set(peer
, PEER_FLAG_TIMER
);
239 peer
->keepalive
= intval
;
240 peer
->v_keepalive
= intval
;
242 case BGPPEERMINROUTEADVERTISEMENTINTERVAL
:
243 peer
->v_routeadv
= intval
;
246 return SNMP_ERR_NOERROR
;
249 static uint8_t *bgpPeerTable(struct variable
*v
, oid name
[], size_t *length
,
250 int exact
, size_t *var_len
,
251 WriteMethod
**write_method
)
253 static struct in_addr addr
;
257 if (smux_header_table(v
, name
, length
, exact
, var_len
, write_method
) ==
260 memset(&addr
, 0, sizeof(addr
));
262 peer
= bgpPeerTable_lookup(v
, name
, length
, &addr
, exact
);
267 case BGPPEERIDENTIFIER
:
268 return SNMP_IPADDRESS(peer
->remote_id
);
270 return SNMP_INTEGER(peer
->status
);
271 case BGPPEERADMINSTATUS
:
272 *write_method
= write_bgpPeerTable
;
273 #define BGP_PeerAdmin_stop 1
274 #define BGP_PeerAdmin_start 2
275 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
276 return SNMP_INTEGER(BGP_PeerAdmin_stop
);
278 return SNMP_INTEGER(BGP_PeerAdmin_start
);
279 case BGPPEERNEGOTIATEDVERSION
:
280 return SNMP_INTEGER(BGP_VERSION_4
);
281 case BGPPEERLOCALADDR
:
283 return SNMP_IPADDRESS(peer
->su_local
->sin
.sin_addr
);
285 return SNMP_IPADDRESS(bgp_empty_addr
);
286 case BGPPEERLOCALPORT
:
289 ntohs(peer
->su_local
->sin
.sin_port
));
291 return SNMP_INTEGER(0);
292 case BGPPEERREMOTEADDR
:
294 return SNMP_IPADDRESS(peer
->su_remote
->sin
.sin_addr
);
296 return SNMP_IPADDRESS(bgp_empty_addr
);
297 case BGPPEERREMOTEPORT
:
300 ntohs(peer
->su_remote
->sin
.sin_port
));
302 return SNMP_INTEGER(0);
303 case BGPPEERREMOTEAS
:
304 return SNMP_INTEGER(peer
->as
);
305 case BGPPEERINUPDATES
:
306 ui
= atomic_load_explicit(&peer
->update_in
,
307 memory_order_relaxed
);
308 return SNMP_INTEGER(ui
);
309 case BGPPEEROUTUPDATES
:
310 uo
= atomic_load_explicit(&peer
->update_out
,
311 memory_order_relaxed
);
312 return SNMP_INTEGER(uo
);
313 case BGPPEERINTOTALMESSAGES
:
314 return SNMP_INTEGER(PEER_TOTAL_RX(peer
));
315 case BGPPEEROUTTOTALMESSAGES
:
316 return SNMP_INTEGER(PEER_TOTAL_TX(peer
));
317 case BGPPEERLASTERROR
: {
318 static uint8_t lasterror
[2];
319 lasterror
[0] = peer
->notify
.code
;
320 lasterror
[1] = peer
->notify
.subcode
;
322 return (uint8_t *)&lasterror
;
324 case BGPPEERFSMESTABLISHEDTRANSITIONS
:
325 return SNMP_INTEGER(peer
->established
);
326 case BGPPEERFSMESTABLISHEDTIME
:
327 if (peer
->uptime
== 0)
328 return SNMP_INTEGER(0);
330 return SNMP_INTEGER(monotime(NULL
) - peer
->uptime
);
331 case BGPPEERCONNECTRETRYINTERVAL
:
332 *write_method
= write_bgpPeerTable
;
333 return SNMP_INTEGER(peer
->v_connect
);
334 case BGPPEERHOLDTIME
:
335 return SNMP_INTEGER(peer
->v_holdtime
);
336 case BGPPEERKEEPALIVE
:
337 return SNMP_INTEGER(peer
->v_keepalive
);
338 case BGPPEERHOLDTIMECONFIGURED
:
339 *write_method
= write_bgpPeerTable
;
340 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_TIMER
))
341 return SNMP_INTEGER(peer
->holdtime
);
343 return SNMP_INTEGER(peer
->v_holdtime
);
344 case BGPPEERKEEPALIVECONFIGURED
:
345 *write_method
= write_bgpPeerTable
;
346 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_TIMER
))
347 return SNMP_INTEGER(peer
->keepalive
);
349 return SNMP_INTEGER(peer
->v_keepalive
);
350 case BGPPEERMINROUTEADVERTISEMENTINTERVAL
:
351 *write_method
= write_bgpPeerTable
;
352 return SNMP_INTEGER(peer
->v_routeadv
);
353 case BGPPEERINUPDATEELAPSEDTIME
:
354 if (peer
->update_time
== 0)
355 return SNMP_INTEGER(0);
357 return SNMP_INTEGER(monotime(NULL
) - peer
->update_time
);
364 static uint8_t *bgpIdentifier(struct variable
*v
, oid name
[], size_t *length
,
365 int exact
, size_t *var_len
,
366 WriteMethod
**write_method
)
370 if (smux_header_generic(v
, name
, length
, exact
, var_len
,
371 write_method
) == MATCH_FAILED
)
374 bgp
= bgp_get_default();
378 return SNMP_IPADDRESS(bgp
->router_id
);
381 static uint8_t *bgpRcvdPathAttrTable(struct variable
*v
, oid name
[],
382 size_t *length
, int exact
, size_t *var_len
,
383 WriteMethod
**write_method
)
385 /* Received Path Attribute Table. This table contains, one entry
386 per path to a network, path attributes received from all peers
387 running BGP version 3 or less. This table is obsolete, having
388 been replaced in functionality with the bgp4PathAttrTable. */
392 static struct bgp_path_info
*bgp4PathAttrLookup(struct variable
*v
, oid name
[],
393 size_t *length
, struct bgp
*bgp
,
394 struct prefix_ipv4
*addr
,
399 struct bgp_path_info
*path
;
400 struct bgp_path_info
*min
;
401 struct bgp_dest
*dest
;
404 struct in_addr paddr
;
408 #define BGP_PATHATTR_ENTRY_OFFSET (IN_ADDR_SIZE + 1 + IN_ADDR_SIZE)
411 if (*length
- v
->namelen
!= BGP_PATHATTR_ENTRY_OFFSET
)
414 /* Set OID offset for prefix. */
415 offset
= name
+ v
->namelen
;
416 oid2in_addr(offset
, IN_ADDR_SIZE
, &addr
->prefix
);
417 offset
+= IN_ADDR_SIZE
;
420 addr
->prefixlen
= *offset
;
424 su
.sin
.sin_family
= AF_INET
;
425 oid2in_addr(offset
, IN_ADDR_SIZE
, &su
.sin
.sin_addr
);
428 dest
= bgp_node_lookup(bgp
->rib
[AFI_IP
][SAFI_UNICAST
],
429 (struct prefix
*)addr
);
431 for (path
= bgp_dest_get_bgp_path_info(dest
); path
;
433 if (sockunion_same(&path
->peer
->su
, &su
))
436 bgp_dest_unlock_node(dest
);
439 offset
= name
+ v
->namelen
;
440 offsetlen
= *length
- v
->namelen
;
444 dest
= bgp_table_top(bgp
->rib
[AFI_IP
][SAFI_UNICAST
]);
446 if (len
> IN_ADDR_SIZE
)
449 oid2in_addr(offset
, len
, &addr
->prefix
);
451 offset
+= IN_ADDR_SIZE
;
452 offsetlen
-= IN_ADDR_SIZE
;
455 addr
->prefixlen
= *offset
;
457 addr
->prefixlen
= len
* 8;
459 dest
= bgp_node_get(bgp
->rib
[AFI_IP
][SAFI_UNICAST
],
460 (struct prefix
*)addr
);
468 if (len
> IN_ADDR_SIZE
)
471 oid2in_addr(offset
, len
, &paddr
);
473 paddr
.s_addr
= INADDR_ANY
;
481 for (path
= bgp_dest_get_bgp_path_info(dest
); path
;
483 if (path
->peer
->su
.sin
.sin_family
== AF_INET
&&
484 ntohl(paddr
.s_addr
) <
485 ntohl(path
->peer
->su
.sin
.sin_addr
488 if (ntohl(path
->peer
->su
.sin
491 ntohl(min
->peer
->su
.sin
501 const struct prefix
*rn_p
=
502 bgp_dest_get_prefix(dest
);
505 v
->namelen
+ BGP_PATHATTR_ENTRY_OFFSET
;
507 offset
= name
+ v
->namelen
;
508 oid_copy_in_addr(offset
, &rn_p
->u
.prefix4
);
509 offset
+= IN_ADDR_SIZE
;
510 *offset
= rn_p
->prefixlen
;
512 oid_copy_in_addr(offset
,
513 &min
->peer
->su
.sin
.sin_addr
);
514 addr
->prefix
= rn_p
->u
.prefix4
;
515 addr
->prefixlen
= rn_p
->prefixlen
;
517 bgp_dest_unlock_node(dest
);
522 paddr
.s_addr
= INADDR_ANY
;
523 } while ((dest
= bgp_route_next(dest
)) != NULL
);
528 static uint8_t *bgp4PathAttrTable(struct variable
*v
, oid name
[],
529 size_t *length
, int exact
, size_t *var_len
,
530 WriteMethod
**write_method
)
533 struct bgp_path_info
*path
;
534 struct prefix_ipv4 addr
;
536 bgp
= bgp_get_default();
540 if (smux_header_table(v
, name
, length
, exact
, var_len
, write_method
) ==
543 memset(&addr
, 0, sizeof(addr
));
545 path
= bgp4PathAttrLookup(v
, name
, length
, bgp
, &addr
, exact
);
550 case BGP4PATHATTRPEER
: /* 1 */
551 return SNMP_IPADDRESS(path
->peer
->su
.sin
.sin_addr
);
552 case BGP4PATHATTRIPADDRPREFIXLEN
: /* 2 */
553 return SNMP_INTEGER(addr
.prefixlen
);
554 case BGP4PATHATTRIPADDRPREFIX
: /* 3 */
555 return SNMP_IPADDRESS(addr
.prefix
);
556 case BGP4PATHATTRORIGIN
: /* 4 */
557 return SNMP_INTEGER(path
->attr
->origin
);
558 case BGP4PATHATTRASPATHSEGMENT
: /* 5 */
559 return aspath_snmp_pathseg(path
->attr
->aspath
, var_len
);
560 case BGP4PATHATTRNEXTHOP
: /* 6 */
561 return SNMP_IPADDRESS(path
->attr
->nexthop
);
562 case BGP4PATHATTRMULTIEXITDISC
: /* 7 */
563 return SNMP_INTEGER(path
->attr
->med
);
564 case BGP4PATHATTRLOCALPREF
: /* 8 */
565 return SNMP_INTEGER(path
->attr
->local_pref
);
566 case BGP4PATHATTRATOMICAGGREGATE
: /* 9 */
567 return SNMP_INTEGER(1);
568 case BGP4PATHATTRAGGREGATORAS
: /* 10 */
569 return SNMP_INTEGER(path
->attr
->aggregator_as
);
570 case BGP4PATHATTRAGGREGATORADDR
: /* 11 */
571 return SNMP_IPADDRESS(path
->attr
->aggregator_addr
);
572 case BGP4PATHATTRCALCLOCALPREF
: /* 12 */
573 return SNMP_INTEGER(-1);
574 case BGP4PATHATTRBEST
: /* 13 */
575 #define BGP4_PathAttrBest_false 1
576 #define BGP4_PathAttrBest_true 2
577 if (CHECK_FLAG(path
->flags
, BGP_PATH_SELECTED
))
578 return SNMP_INTEGER(BGP4_PathAttrBest_true
);
580 return SNMP_INTEGER(BGP4_PathAttrBest_false
);
581 case BGP4PATHATTRUNKNOWN
: /* 14 */
589 static struct trap_object bgpTrapList
[] = {{3, {3, 1, BGPPEERREMOTEADDR
}},
590 {3, {3, 1, BGPPEERLASTERROR
}},
591 {3, {3, 1, BGPPEERSTATE
}}};
593 static struct variable bgp_variables
[] = {
595 {BGPVERSION
, OCTET_STRING
, RONLY
, bgpVersion
, 1, {1}},
597 {BGPLOCALAS
, INTEGER
, RONLY
, bgpLocalAs
, 1, {2}},
598 /* BGP peer table. */
599 {BGPPEERIDENTIFIER
, IPADDRESS
, RONLY
, bgpPeerTable
, 3, {3, 1, 1}},
600 {BGPPEERSTATE
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 2}},
601 {BGPPEERADMINSTATUS
, INTEGER
, RWRITE
, bgpPeerTable
, 3, {3, 1, 3}},
602 {BGPPEERNEGOTIATEDVERSION
,
608 {BGPPEERLOCALADDR
, IPADDRESS
, RONLY
, bgpPeerTable
, 3, {3, 1, 5}},
609 {BGPPEERLOCALPORT
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 6}},
610 {BGPPEERREMOTEADDR
, IPADDRESS
, RONLY
, bgpPeerTable
, 3, {3, 1, 7}},
611 {BGPPEERREMOTEPORT
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 8}},
612 {BGPPEERREMOTEAS
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 9}},
613 {BGPPEERINUPDATES
, COUNTER32
, RONLY
, bgpPeerTable
, 3, {3, 1, 10}},
614 {BGPPEEROUTUPDATES
, COUNTER32
, RONLY
, bgpPeerTable
, 3, {3, 1, 11}},
615 {BGPPEERINTOTALMESSAGES
, COUNTER32
, RONLY
, bgpPeerTable
, 3, {3, 1, 12}},
616 {BGPPEEROUTTOTALMESSAGES
,
622 {BGPPEERLASTERROR
, OCTET_STRING
, RONLY
, bgpPeerTable
, 3, {3, 1, 14}},
623 {BGPPEERFSMESTABLISHEDTRANSITIONS
,
629 {BGPPEERFSMESTABLISHEDTIME
,
635 {BGPPEERCONNECTRETRYINTERVAL
,
641 {BGPPEERHOLDTIME
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 18}},
642 {BGPPEERKEEPALIVE
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 19}},
643 {BGPPEERHOLDTIMECONFIGURED
,
649 {BGPPEERKEEPALIVECONFIGURED
,
655 {BGPPEERMINROUTEADVERTISEMENTINTERVAL
,
661 {BGPPEERINUPDATEELAPSEDTIME
,
667 /* BGP identifier. */
668 {BGPIDENTIFIER
, IPADDRESS
, RONLY
, bgpIdentifier
, 1, {4}},
669 /* BGP received path attribute table. */
670 {BGPPATHATTRPEER
, IPADDRESS
, RONLY
, bgpRcvdPathAttrTable
, 3, {5, 1, 1}},
671 {BGPPATHATTRDESTNETWORK
,
674 bgpRcvdPathAttrTable
,
677 {BGPPATHATTRORIGIN
, INTEGER
, RONLY
, bgpRcvdPathAttrTable
, 3, {5, 1, 3}},
681 bgpRcvdPathAttrTable
,
687 bgpRcvdPathAttrTable
,
690 {BGPPATHATTRINTERASMETRIC
,
693 bgpRcvdPathAttrTable
,
696 /* BGP-4 received path attribute table. */
697 {BGP4PATHATTRPEER
, IPADDRESS
, RONLY
, bgp4PathAttrTable
, 3, {6, 1, 1}},
698 {BGP4PATHATTRIPADDRPREFIXLEN
,
704 {BGP4PATHATTRIPADDRPREFIX
,
710 {BGP4PATHATTRORIGIN
, INTEGER
, RONLY
, bgp4PathAttrTable
, 3, {6, 1, 4}},
711 {BGP4PATHATTRASPATHSEGMENT
,
717 {BGP4PATHATTRNEXTHOP
,
723 {BGP4PATHATTRMULTIEXITDISC
,
729 {BGP4PATHATTRLOCALPREF
,
735 {BGP4PATHATTRATOMICAGGREGATE
,
741 {BGP4PATHATTRAGGREGATORAS
,
747 {BGP4PATHATTRAGGREGATORADDR
,
753 {BGP4PATHATTRCALCLOCALPREF
,
759 {BGP4PATHATTRBEST
, INTEGER
, RONLY
, bgp4PathAttrTable
, 3, {6, 1, 13}},
760 {BGP4PATHATTRUNKNOWN
,
768 int bgpTrapEstablished(struct peer
*peer
)
772 oid index
[sizeof(oid
) * IN_ADDR_SIZE
];
774 /* Check if this peer just went to Established */
775 if ((peer
->ostatus
!= OpenConfirm
) || !(peer_established(peer
)))
778 ret
= inet_aton(peer
->host
, &addr
);
782 oid_copy_in_addr(index
, &addr
);
784 smux_trap(bgp_variables
, array_size(bgp_variables
), bgp_trap_oid
,
785 array_size(bgp_trap_oid
), bgp_oid
,
786 sizeof(bgp_oid
) / sizeof(oid
), index
, IN_ADDR_SIZE
,
787 bgpTrapList
, array_size(bgpTrapList
), BGPESTABLISHED
);
791 int bgpTrapBackwardTransition(struct peer
*peer
)
795 oid index
[sizeof(oid
) * IN_ADDR_SIZE
];
797 ret
= inet_aton(peer
->host
, &addr
);
801 oid_copy_in_addr(index
, &addr
);
803 smux_trap(bgp_variables
, array_size(bgp_variables
), bgp_trap_oid
,
804 array_size(bgp_trap_oid
), bgp_oid
,
805 sizeof(bgp_oid
) / sizeof(oid
), index
, IN_ADDR_SIZE
,
806 bgpTrapList
, array_size(bgpTrapList
), BGPBACKWARDTRANSITION
);
810 int bgp_snmp_bgp4_init(struct thread_master
*tm
)
812 REGISTER_MIB("mibII/bgp", bgp_variables
, variable
, bgp_oid
);