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>
36 #include "bgpd/bgpd.h"
37 #include "bgpd/bgp_table.h"
38 #include "bgpd/bgp_aspath.h"
39 #include "bgpd/bgp_attr.h"
40 #include "bgpd/bgp_route.h"
41 #include "bgpd/bgp_fsm.h"
42 #include "bgpd/bgp_snmp.h"
43 #include "bgpd/bgp_snmp_bgp4.h"
44 #include "bgpd/bgp_mplsvpn_snmp.h"
46 /* Declare static local variables for convenience. */
49 /* BGP-MIB instances. */
50 static oid bgp_oid
[] = {BGP4MIB
};
51 static oid bgp_trap_oid
[] = {BGP4MIB
, 0};
53 /* IP address 0.0.0.0. */
54 static struct in_addr bgp_empty_addr
= {.s_addr
= 0};
56 static uint8_t *bgpVersion(struct variable
*v
, oid name
[], size_t *length
,
57 int exact
, size_t *var_len
,
58 WriteMethod
**write_method
)
60 static uint8_t version
;
62 if (smux_header_generic(v
, name
, length
, exact
, var_len
,
63 write_method
) == MATCH_FAILED
)
66 /* Return BGP version. Zebra bgpd only support version 4. */
67 version
= (0x80 >> (BGP_VERSION_4
- 1));
69 /* Return octet string length 1. */
74 static uint8_t *bgpLocalAs(struct variable
*v
, oid name
[], size_t *length
,
75 int exact
, size_t *var_len
,
76 WriteMethod
**write_method
)
80 if (smux_header_generic(v
, name
, length
, exact
, var_len
,
81 write_method
) == MATCH_FAILED
)
84 /* Get BGP structure. */
85 bgp
= bgp_get_default();
89 return SNMP_INTEGER(bgp
->as
);
92 static struct peer
*peer_lookup_addr_ipv4(struct in_addr
*src
)
96 struct listnode
*node
;
97 struct listnode
*bgpnode
;
99 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, bgpnode
, bgp
)) {
100 for (ALL_LIST_ELEMENTS_RO(bgp
->peer
, node
, peer
)) {
101 if (sockunion_family(&peer
->su
) != AF_INET
)
104 if (sockunion2ip(&peer
->su
) == src
->s_addr
)
112 static struct peer
*bgp_peer_lookup_next(struct in_addr
*src
)
116 struct peer
*next_peer
= NULL
;
117 struct listnode
*node
;
118 struct listnode
*bgpnode
;
120 for (ALL_LIST_ELEMENTS_RO(bm
->bgp
, bgpnode
, bgp
)) {
121 for (ALL_LIST_ELEMENTS_RO(bgp
->peer
, node
, peer
)) {
122 if (sockunion_family(&peer
->su
) != AF_INET
)
124 if (ntohl(sockunion2ip(&peer
->su
)) <=
129 ntohl(sockunion2ip(&next_peer
->su
)) >
130 ntohl(sockunion2ip(&peer
->su
))) {
137 src
->s_addr
= sockunion2ip(&next_peer
->su
);
144 /* 1.3.6.1.2.1.15.3.1.x = 10 */
145 #define PEERTAB_NAMELEN 10
147 static struct peer
*bgpPeerTable_lookup(struct variable
*v
, oid name
[],
148 size_t *length
, struct in_addr
*addr
,
151 struct peer
*peer
= NULL
;
152 size_t namelen
= v
? v
->namelen
: PEERTAB_NAMELEN
;
156 /* Check the length. */
157 if (*length
- namelen
!= sizeof(struct in_addr
))
160 oid2in_addr(name
+ namelen
, IN_ADDR_SIZE
, addr
);
162 peer
= peer_lookup_addr_ipv4(addr
);
165 len
= *length
- namelen
;
169 oid2in_addr(name
+ namelen
, len
, addr
);
171 peer
= bgp_peer_lookup_next(addr
);
176 oid_copy_in_addr(name
+ namelen
, addr
);
177 *length
= sizeof(struct in_addr
) + namelen
;
184 /* BGP write methods. */
185 static int write_bgpPeerTable(int action
, uint8_t *var_val
,
186 uint8_t var_val_type
, size_t var_val_len
,
187 uint8_t *statP
, oid
*name
, size_t length
)
193 if (var_val_type
!= ASN_INTEGER
) {
194 return SNMP_ERR_WRONGTYPE
;
196 if (var_val_len
!= sizeof(long)) {
197 return SNMP_ERR_WRONGLENGTH
;
200 intval
= *(long *)var_val
;
202 memset(&addr
, 0, sizeof(addr
));
204 peer
= bgpPeerTable_lookup(NULL
, name
, &length
, &addr
, 1);
206 return SNMP_ERR_NOSUCHNAME
;
208 if (action
!= SNMP_MSG_INTERNAL_SET_COMMIT
)
209 return SNMP_ERR_NOERROR
;
211 zlog_info("%s: SNMP write .%ld = %ld", peer
->host
,
212 (long)name
[PEERTAB_NAMELEN
- 1], intval
);
214 switch (name
[PEERTAB_NAMELEN
- 1]) {
215 case BGPPEERADMINSTATUS
:
216 #define BGP_PeerAdmin_stop 1
217 #define BGP_PeerAdmin_start 2
218 /* When the peer is established, */
219 if (intval
== BGP_PeerAdmin_stop
)
220 BGP_EVENT_ADD(peer
, BGP_Stop
);
221 else if (intval
== BGP_PeerAdmin_start
)
224 return SNMP_ERR_NOSUCHNAME
;
226 case BGPPEERCONNECTRETRYINTERVAL
:
227 peer_flag_set(peer
, PEER_FLAG_TIMER_CONNECT
);
228 peer
->connect
= intval
;
229 peer
->v_connect
= intval
;
231 case BGPPEERHOLDTIMECONFIGURED
:
232 peer_flag_set(peer
, PEER_FLAG_TIMER
);
233 peer
->holdtime
= intval
;
234 peer
->v_holdtime
= intval
;
236 case BGPPEERKEEPALIVECONFIGURED
:
237 peer_flag_set(peer
, PEER_FLAG_TIMER
);
238 peer
->keepalive
= intval
;
239 peer
->v_keepalive
= intval
;
241 case BGPPEERMINROUTEADVERTISEMENTINTERVAL
:
242 peer
->v_routeadv
= intval
;
245 return SNMP_ERR_NOERROR
;
248 static uint8_t *bgpPeerTable(struct variable
*v
, oid name
[], size_t *length
,
249 int exact
, size_t *var_len
,
250 WriteMethod
**write_method
)
252 static struct in_addr addr
;
256 if (smux_header_table(v
, name
, length
, exact
, var_len
, write_method
) ==
259 memset(&addr
, 0, sizeof(addr
));
261 peer
= bgpPeerTable_lookup(v
, name
, length
, &addr
, exact
);
266 case BGPPEERIDENTIFIER
:
267 return SNMP_IPADDRESS(peer
->remote_id
);
269 return SNMP_INTEGER(peer
->status
);
270 case BGPPEERADMINSTATUS
:
271 *write_method
= write_bgpPeerTable
;
272 #define BGP_PeerAdmin_stop 1
273 #define BGP_PeerAdmin_start 2
274 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_SHUTDOWN
))
275 return SNMP_INTEGER(BGP_PeerAdmin_stop
);
277 return SNMP_INTEGER(BGP_PeerAdmin_start
);
278 case BGPPEERNEGOTIATEDVERSION
:
279 return SNMP_INTEGER(BGP_VERSION_4
);
280 case BGPPEERLOCALADDR
:
282 return SNMP_IPADDRESS(peer
->su_local
->sin
.sin_addr
);
284 return SNMP_IPADDRESS(bgp_empty_addr
);
285 case BGPPEERLOCALPORT
:
288 ntohs(peer
->su_local
->sin
.sin_port
));
290 return SNMP_INTEGER(0);
291 case BGPPEERREMOTEADDR
:
293 return SNMP_IPADDRESS(peer
->su_remote
->sin
.sin_addr
);
295 return SNMP_IPADDRESS(bgp_empty_addr
);
296 case BGPPEERREMOTEPORT
:
299 ntohs(peer
->su_remote
->sin
.sin_port
));
301 return SNMP_INTEGER(0);
302 case BGPPEERREMOTEAS
:
303 return SNMP_INTEGER(peer
->as
);
304 case BGPPEERINUPDATES
:
305 ui
= atomic_load_explicit(&peer
->update_in
,
306 memory_order_relaxed
);
307 return SNMP_INTEGER(ui
);
308 case BGPPEEROUTUPDATES
:
309 uo
= atomic_load_explicit(&peer
->update_out
,
310 memory_order_relaxed
);
311 return SNMP_INTEGER(uo
);
312 case BGPPEERINTOTALMESSAGES
:
313 return SNMP_INTEGER(PEER_TOTAL_RX(peer
));
314 case BGPPEEROUTTOTALMESSAGES
:
315 return SNMP_INTEGER(PEER_TOTAL_TX(peer
));
316 case BGPPEERLASTERROR
: {
317 static uint8_t lasterror
[2];
318 lasterror
[0] = peer
->notify
.code
;
319 lasterror
[1] = peer
->notify
.subcode
;
321 return (uint8_t *)&lasterror
;
323 case BGPPEERFSMESTABLISHEDTRANSITIONS
:
324 return SNMP_INTEGER(peer
->established
);
325 case BGPPEERFSMESTABLISHEDTIME
:
326 if (peer
->uptime
== 0)
327 return SNMP_INTEGER(0);
329 return SNMP_INTEGER(monotime(NULL
) - peer
->uptime
);
330 case BGPPEERCONNECTRETRYINTERVAL
:
331 *write_method
= write_bgpPeerTable
;
332 return SNMP_INTEGER(peer
->v_connect
);
333 case BGPPEERHOLDTIME
:
334 return SNMP_INTEGER(peer
->v_holdtime
);
335 case BGPPEERKEEPALIVE
:
336 return SNMP_INTEGER(peer
->v_keepalive
);
337 case BGPPEERHOLDTIMECONFIGURED
:
338 *write_method
= write_bgpPeerTable
;
339 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_TIMER
))
340 return SNMP_INTEGER(peer
->holdtime
);
342 return SNMP_INTEGER(peer
->v_holdtime
);
343 case BGPPEERKEEPALIVECONFIGURED
:
344 *write_method
= write_bgpPeerTable
;
345 if (CHECK_FLAG(peer
->flags
, PEER_FLAG_TIMER
))
346 return SNMP_INTEGER(peer
->keepalive
);
348 return SNMP_INTEGER(peer
->v_keepalive
);
349 case BGPPEERMINROUTEADVERTISEMENTINTERVAL
:
350 *write_method
= write_bgpPeerTable
;
351 return SNMP_INTEGER(peer
->v_routeadv
);
352 case BGPPEERINUPDATEELAPSEDTIME
:
353 if (peer
->update_time
== 0)
354 return SNMP_INTEGER(0);
356 return SNMP_INTEGER(monotime(NULL
) - peer
->update_time
);
363 static uint8_t *bgpIdentifier(struct variable
*v
, oid name
[], size_t *length
,
364 int exact
, size_t *var_len
,
365 WriteMethod
**write_method
)
369 if (smux_header_generic(v
, name
, length
, exact
, var_len
,
370 write_method
) == MATCH_FAILED
)
373 bgp
= bgp_get_default();
377 return SNMP_IPADDRESS(bgp
->router_id
);
380 static uint8_t *bgpRcvdPathAttrTable(struct variable
*v
, oid name
[],
381 size_t *length
, int exact
, size_t *var_len
,
382 WriteMethod
**write_method
)
384 /* Received Path Attribute Table. This table contains, one entry
385 per path to a network, path attributes received from all peers
386 running BGP version 3 or less. This table is obsolete, having
387 been replaced in functionality with the bgp4PathAttrTable. */
391 static struct bgp_path_info
*bgp4PathAttrLookup(struct variable
*v
, oid name
[],
392 size_t *length
, struct bgp
*bgp
,
393 struct prefix_ipv4
*addr
,
398 struct bgp_path_info
*path
;
399 struct bgp_path_info
*min
;
400 struct bgp_dest
*dest
;
403 struct in_addr paddr
;
407 #define BGP_PATHATTR_ENTRY_OFFSET (IN_ADDR_SIZE + 1 + IN_ADDR_SIZE)
410 if (*length
- v
->namelen
!= BGP_PATHATTR_ENTRY_OFFSET
)
413 /* Set OID offset for prefix. */
414 offset
= name
+ v
->namelen
;
415 oid2in_addr(offset
, IN_ADDR_SIZE
, &addr
->prefix
);
416 offset
+= IN_ADDR_SIZE
;
419 addr
->prefixlen
= *offset
;
423 su
.sin
.sin_family
= AF_INET
;
424 oid2in_addr(offset
, IN_ADDR_SIZE
, &su
.sin
.sin_addr
);
427 dest
= bgp_node_lookup(bgp
->rib
[AFI_IP
][SAFI_UNICAST
],
428 (struct prefix
*)addr
);
430 for (path
= bgp_dest_get_bgp_path_info(dest
); path
;
432 if (sockunion_same(&path
->peer
->su
, &su
))
435 bgp_dest_unlock_node(dest
);
438 offset
= name
+ v
->namelen
;
439 offsetlen
= *length
- v
->namelen
;
443 dest
= bgp_table_top(bgp
->rib
[AFI_IP
][SAFI_UNICAST
]);
445 if (len
> IN_ADDR_SIZE
)
448 oid2in_addr(offset
, len
, &addr
->prefix
);
450 offset
+= IN_ADDR_SIZE
;
451 offsetlen
-= IN_ADDR_SIZE
;
454 addr
->prefixlen
= *offset
;
456 addr
->prefixlen
= len
* 8;
458 dest
= bgp_node_get(bgp
->rib
[AFI_IP
][SAFI_UNICAST
],
459 (struct prefix
*)addr
);
467 if (len
> IN_ADDR_SIZE
)
470 oid2in_addr(offset
, len
, &paddr
);
472 paddr
.s_addr
= INADDR_ANY
;
480 for (path
= bgp_dest_get_bgp_path_info(dest
); path
;
482 if (path
->peer
->su
.sin
.sin_family
== AF_INET
&&
483 ntohl(paddr
.s_addr
) <
484 ntohl(path
->peer
->su
.sin
.sin_addr
487 if (ntohl(path
->peer
->su
.sin
490 ntohl(min
->peer
->su
.sin
500 const struct prefix
*rn_p
=
501 bgp_dest_get_prefix(dest
);
504 v
->namelen
+ BGP_PATHATTR_ENTRY_OFFSET
;
506 offset
= name
+ v
->namelen
;
507 oid_copy_in_addr(offset
, &rn_p
->u
.prefix4
);
508 offset
+= IN_ADDR_SIZE
;
509 *offset
= rn_p
->prefixlen
;
511 oid_copy_in_addr(offset
,
512 &min
->peer
->su
.sin
.sin_addr
);
513 addr
->prefix
= rn_p
->u
.prefix4
;
514 addr
->prefixlen
= rn_p
->prefixlen
;
516 bgp_dest_unlock_node(dest
);
521 paddr
.s_addr
= INADDR_ANY
;
522 } while ((dest
= bgp_route_next(dest
)) != NULL
);
527 static uint8_t *bgp4PathAttrTable(struct variable
*v
, oid name
[],
528 size_t *length
, int exact
, size_t *var_len
,
529 WriteMethod
**write_method
)
532 struct bgp_path_info
*path
;
533 struct prefix_ipv4 addr
;
535 bgp
= bgp_get_default();
539 if (smux_header_table(v
, name
, length
, exact
, var_len
, write_method
) ==
542 memset(&addr
, 0, sizeof(addr
));
544 path
= bgp4PathAttrLookup(v
, name
, length
, bgp
, &addr
, exact
);
549 case BGP4PATHATTRPEER
: /* 1 */
550 return SNMP_IPADDRESS(path
->peer
->su
.sin
.sin_addr
);
551 case BGP4PATHATTRIPADDRPREFIXLEN
: /* 2 */
552 return SNMP_INTEGER(addr
.prefixlen
);
553 case BGP4PATHATTRIPADDRPREFIX
: /* 3 */
554 return SNMP_IPADDRESS(addr
.prefix
);
555 case BGP4PATHATTRORIGIN
: /* 4 */
556 return SNMP_INTEGER(path
->attr
->origin
);
557 case BGP4PATHATTRASPATHSEGMENT
: /* 5 */
558 return aspath_snmp_pathseg(path
->attr
->aspath
, var_len
);
559 case BGP4PATHATTRNEXTHOP
: /* 6 */
560 return SNMP_IPADDRESS(path
->attr
->nexthop
);
561 case BGP4PATHATTRMULTIEXITDISC
: /* 7 */
562 return SNMP_INTEGER(path
->attr
->med
);
563 case BGP4PATHATTRLOCALPREF
: /* 8 */
564 return SNMP_INTEGER(path
->attr
->local_pref
);
565 case BGP4PATHATTRATOMICAGGREGATE
: /* 9 */
566 return SNMP_INTEGER(1);
567 case BGP4PATHATTRAGGREGATORAS
: /* 10 */
568 return SNMP_INTEGER(path
->attr
->aggregator_as
);
569 case BGP4PATHATTRAGGREGATORADDR
: /* 11 */
570 return SNMP_IPADDRESS(path
->attr
->aggregator_addr
);
571 case BGP4PATHATTRCALCLOCALPREF
: /* 12 */
572 return SNMP_INTEGER(-1);
573 case BGP4PATHATTRBEST
: /* 13 */
574 #define BGP4_PathAttrBest_false 1
575 #define BGP4_PathAttrBest_true 2
576 if (CHECK_FLAG(path
->flags
, BGP_PATH_SELECTED
))
577 return SNMP_INTEGER(BGP4_PathAttrBest_true
);
579 return SNMP_INTEGER(BGP4_PathAttrBest_false
);
580 case BGP4PATHATTRUNKNOWN
: /* 14 */
588 static struct trap_object bgpTrapList
[] = {{3, {3, 1, BGPPEERREMOTEADDR
}},
589 {3, {3, 1, BGPPEERLASTERROR
}},
590 {3, {3, 1, BGPPEERSTATE
}}};
592 static struct variable bgp_variables
[] = {
594 {BGPVERSION
, OCTET_STRING
, RONLY
, bgpVersion
, 1, {1}},
596 {BGPLOCALAS
, INTEGER
, RONLY
, bgpLocalAs
, 1, {2}},
597 /* BGP peer table. */
598 {BGPPEERIDENTIFIER
, IPADDRESS
, RONLY
, bgpPeerTable
, 3, {3, 1, 1}},
599 {BGPPEERSTATE
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 2}},
600 {BGPPEERADMINSTATUS
, INTEGER
, RWRITE
, bgpPeerTable
, 3, {3, 1, 3}},
601 {BGPPEERNEGOTIATEDVERSION
,
607 {BGPPEERLOCALADDR
, IPADDRESS
, RONLY
, bgpPeerTable
, 3, {3, 1, 5}},
608 {BGPPEERLOCALPORT
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 6}},
609 {BGPPEERREMOTEADDR
, IPADDRESS
, RONLY
, bgpPeerTable
, 3, {3, 1, 7}},
610 {BGPPEERREMOTEPORT
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 8}},
611 {BGPPEERREMOTEAS
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 9}},
612 {BGPPEERINUPDATES
, COUNTER32
, RONLY
, bgpPeerTable
, 3, {3, 1, 10}},
613 {BGPPEEROUTUPDATES
, COUNTER32
, RONLY
, bgpPeerTable
, 3, {3, 1, 11}},
614 {BGPPEERINTOTALMESSAGES
, COUNTER32
, RONLY
, bgpPeerTable
, 3, {3, 1, 12}},
615 {BGPPEEROUTTOTALMESSAGES
,
621 {BGPPEERLASTERROR
, OCTET_STRING
, RONLY
, bgpPeerTable
, 3, {3, 1, 14}},
622 {BGPPEERFSMESTABLISHEDTRANSITIONS
,
628 {BGPPEERFSMESTABLISHEDTIME
,
634 {BGPPEERCONNECTRETRYINTERVAL
,
640 {BGPPEERHOLDTIME
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 18}},
641 {BGPPEERKEEPALIVE
, INTEGER
, RONLY
, bgpPeerTable
, 3, {3, 1, 19}},
642 {BGPPEERHOLDTIMECONFIGURED
,
648 {BGPPEERKEEPALIVECONFIGURED
,
654 {BGPPEERMINROUTEADVERTISEMENTINTERVAL
,
660 {BGPPEERINUPDATEELAPSEDTIME
,
666 /* BGP identifier. */
667 {BGPIDENTIFIER
, IPADDRESS
, RONLY
, bgpIdentifier
, 1, {4}},
668 /* BGP received path attribute table. */
669 {BGPPATHATTRPEER
, IPADDRESS
, RONLY
, bgpRcvdPathAttrTable
, 3, {5, 1, 1}},
670 {BGPPATHATTRDESTNETWORK
,
673 bgpRcvdPathAttrTable
,
676 {BGPPATHATTRORIGIN
, INTEGER
, RONLY
, bgpRcvdPathAttrTable
, 3, {5, 1, 3}},
680 bgpRcvdPathAttrTable
,
686 bgpRcvdPathAttrTable
,
689 {BGPPATHATTRINTERASMETRIC
,
692 bgpRcvdPathAttrTable
,
695 /* BGP-4 received path attribute table. */
696 {BGP4PATHATTRPEER
, IPADDRESS
, RONLY
, bgp4PathAttrTable
, 3, {6, 1, 1}},
697 {BGP4PATHATTRIPADDRPREFIXLEN
,
703 {BGP4PATHATTRIPADDRPREFIX
,
709 {BGP4PATHATTRORIGIN
, INTEGER
, RONLY
, bgp4PathAttrTable
, 3, {6, 1, 4}},
710 {BGP4PATHATTRASPATHSEGMENT
,
716 {BGP4PATHATTRNEXTHOP
,
722 {BGP4PATHATTRMULTIEXITDISC
,
728 {BGP4PATHATTRLOCALPREF
,
734 {BGP4PATHATTRATOMICAGGREGATE
,
740 {BGP4PATHATTRAGGREGATORAS
,
746 {BGP4PATHATTRAGGREGATORADDR
,
752 {BGP4PATHATTRCALCLOCALPREF
,
758 {BGP4PATHATTRBEST
, INTEGER
, RONLY
, bgp4PathAttrTable
, 3, {6, 1, 13}},
759 {BGP4PATHATTRUNKNOWN
,
767 int bgpTrapEstablished(struct peer
*peer
)
771 oid index
[sizeof(oid
) * IN_ADDR_SIZE
];
773 /* Check if this peer just went to Established */
774 if ((peer
->ostatus
!= OpenConfirm
) || !(peer_established(peer
)))
777 ret
= inet_aton(peer
->host
, &addr
);
781 oid_copy_in_addr(index
, &addr
);
783 smux_trap(bgp_variables
, array_size(bgp_variables
), bgp_trap_oid
,
784 array_size(bgp_trap_oid
), bgp_oid
,
785 sizeof(bgp_oid
) / sizeof(oid
), index
, IN_ADDR_SIZE
,
786 bgpTrapList
, array_size(bgpTrapList
), BGPESTABLISHED
);
790 int bgpTrapBackwardTransition(struct peer
*peer
)
794 oid index
[sizeof(oid
) * IN_ADDR_SIZE
];
796 ret
= inet_aton(peer
->host
, &addr
);
800 oid_copy_in_addr(index
, &addr
);
802 smux_trap(bgp_variables
, array_size(bgp_variables
), bgp_trap_oid
,
803 array_size(bgp_trap_oid
), bgp_oid
,
804 sizeof(bgp_oid
) / sizeof(oid
), index
, IN_ADDR_SIZE
,
805 bgpTrapList
, array_size(bgpTrapList
), BGPBACKWARDTRANSITION
);
809 int bgp_snmp_bgp4_init(struct thread_master
*tm
)
811 REGISTER_MIB("mibII/bgp", bgp_variables
, variable
, bgp_oid
);