diff options
author | Chris Hall <GMCH@hestia.halldom.com> | 2010-01-27 22:37:55 +0000 |
---|---|---|
committer | Chris Hall <GMCH@hestia.halldom.com> | 2010-01-27 22:37:55 +0000 |
commit | e29ed2adec0ef11ca1c84b40b2c98247f162f3df (patch) | |
tree | d0a65837f2a544c8e46f8ddda654e70686c531a1 /lib | |
parent | e6d986058f23f350aa6aedac4da5fe9f3afda6e8 (diff) | |
download | quagga-e29ed2adec0ef11ca1c84b40b2c98247f162f3df.tar.bz2 quagga-e29ed2adec0ef11ca1c84b40b2c98247f162f3df.tar.xz |
Binding to interfaces and counting of messages.
Wired up message counters in bgp_session structure.
Added fields to session for neighbor interface and
neighbor update-source -- so that these can be set when connect()
is done. Peering Engine resolves any interface name to an address,
so that BGP Engine doesn't have to.
Reinstated as much code as necessary in bgp_network to bind to
specific interfaces, as set in the session.
Moved setting of bgp_nexthop_set() back into Routeing Engine.
Result is that only Peering Engine talks to Zebra or uses the
iflist.
Wired up setting of TTL.
Reworked connections locking of the session mutex so more robust
if/when connections are cut loose from the session.
Made peer_index entry point at connection, not session. Works
better in bgp_network that way.
modified: bgpd/bgp_connection.c
modified: bgpd/bgp_connection.h
modified: bgpd/bgp_fsm.c
modified: bgpd/bgp_msg_read.c
modified: bgpd/bgp_msg_write.c
modified: bgpd/bgp_network.c
modified: bgpd/bgp_network.h
modified: bgpd/bgp_peer.c
modified: bgpd/bgp_peer.h
modified: bgpd/bgp_peer_index.c
modified: bgpd/bgp_peer_index.h
modified: bgpd/bgp_session.c
modified: bgpd/bgp_session.h
modified: lib/prefix.h
modified: lib/sockunion.c
modified: lib/sockunion.h
Diffstat (limited to 'lib')
-rw-r--r-- | lib/prefix.h | 8 | ||||
-rw-r--r-- | lib/sockunion.c | 33 | ||||
-rw-r--r-- | lib/sockunion.h | 4 |
3 files changed, 41 insertions, 4 deletions
diff --git a/lib/prefix.h b/lib/prefix.h index 1ccd4dd6..9fd02ea6 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -29,6 +29,8 @@ #define Inline static inline #endif +typedef const union sockunion* const_sockunion ; + /* * A struct prefix contains an address family, a prefix length, and an * address. This can represent either a 'network prefix' as defined @@ -163,9 +165,9 @@ extern int prefix_cmp (const struct prefix *, const struct prefix *); extern void prefix_copy (struct prefix *dest, const struct prefix *src); extern void apply_mask (struct prefix *); -extern struct prefix *sockunion2prefix (const union sockunion *dest, - const union sockunion *mask); -extern struct prefix *sockunion2hostprefix (const union sockunion *); +extern struct prefix *sockunion2prefix (const_sockunion dest, + const_sockunion mask); +extern struct prefix *sockunion2hostprefix (const_sockunion src); extern struct prefix_ipv4 *prefix_ipv4_new (void); extern void prefix_ipv4_free (struct prefix_ipv4 *); diff --git a/lib/sockunion.c b/lib/sockunion.c index 700d539f..bfcadc96 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -735,6 +735,37 @@ sockunion_free (union sockunion *su) * Sockunion reference utilities */ +extern sockunion +sockunion_new(struct prefix* p) +{ + sockunion nsu = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)) ; + + if (p == NULL) + return NULL ; + + switch (p->family) + { + case AF_INET: + nsu->sin.sin_family = AF_INET ; + nsu->sin.sin_port = 0 ; + nsu->sin.sin_addr = p->u.prefix4 ; + break ; + +#ifdef HAVE_IPV6 + case AF_INET6: + nsu->sin6.sin6_family = AF_INET ; + nsu->sin6.sin6_port = 0 ; + nsu->sin6.sin6_addr = p->u.prefix6 ; + break ; +#endif + + default: + break ; + } ; + + return nsu ; +} ; + /*------------------------------------------------------------------------------ * Unset pointer to sockunion -- free any sockunion referenced * @@ -744,7 +775,7 @@ extern void sockunion_unset(sockunion* p_su) { if (*p_su != NULL) - XFREE(MTYPE_BGP_NOTIFY, *p_su) ; /* sets *p_su NULL */ + XFREE(MTYPE_SOCKUNION, *p_su) ; /* sets *p_su NULL */ } ; /*------------------------------------------------------------------------------ diff --git a/lib/sockunion.h b/lib/sockunion.h index c00c02e4..ea76a955 100644 --- a/lib/sockunion.h +++ b/lib/sockunion.h @@ -25,6 +25,7 @@ #include "zebra.h" #include "symtab.h" +#include "prefix.h" #if 0 union sockunion { @@ -41,6 +42,8 @@ union sockunion { #define su_port su_si.si_port #endif /* 0 */ +typedef struct prefix* prefix ; + typedef union sockunion* sockunion ; union sockunion { @@ -120,6 +123,7 @@ extern int sockunion_getpeername (int, union sockunion*); extern union sockunion *sockunion_dup (union sockunion *); extern void sockunion_free (union sockunion *); +extern sockunion sockunion_new(prefix p) ; extern void sockunion_unset(sockunion* p_su) ; extern void sockunion_set(sockunion* p_dst, sockunion su) ; extern void sockunion_set_dup(sockunion* p_dst, sockunion su) ; |