summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog20
-rw-r--r--lib/if.c48
-rw-r--r--lib/smux.c14
3 files changed, 73 insertions, 9 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index e2c25ca6..896e1b37 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,23 @@
+2006-10-14 Paul Jakma <paul.jakma@sun.com>
+
+ * if.c: (general) Handle upgrades from SUNWzebra, which tried
+ to track each logical interface as a seperate struct
+ interface, to Quagga, which assigns only one struct interface
+ per ifindex.
+ (if_sunwzebra_get) Try decompose a logical interface name
+ (fooX:Y) to the 'primary' name (fooX), for Solaris.
+ (interface_cmd) Use if_sunwzebra_get on Solaris.
+
+2006-09-26 Pierre-Yves Ritschard <pierre-yves@spootnik.org>
+
+ * smux.c: (smux_open,smux_trap,smux_register) Fix various
+ asn_build_* calls to pass the proper length in the final
+ argument: use sizeof(<variable>) instead of sizeof(<type>),
+ since there were several inconsistencies between the actual
+ variable type and the size that was passed. This should
+ fix some problems on 64-bit architectures where sizeof(int)
+ != sizeof(long).
+
2006-08-25 Paul Jakma <paul.jakma@sun.com>
* thread.c: (general) Add support for monotonic clock, it may still
diff --git a/lib/if.c b/lib/if.c
index c43d9564..4493cc74 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -501,9 +501,49 @@ DEFUN (no_interface_desc,
return CMD_SUCCESS;
}
+
+#ifdef SUNOS_5
+/* Need to handle upgrade from SUNWzebra to Quagga. SUNWzebra created
+ * a seperate struct interface for each logical interface, so config
+ * file may be full of 'interface fooX:Y'. Solaris however does not
+ * expose logical interfaces via PF_ROUTE, so trying to track logical
+ * interfaces can be fruitless, for that reason Quagga only tracks
+ * the primary IP interface.
+ *
+ * We try accomodate SUNWzebra by:
+ * - looking up the interface name, to see whether it exists, if so
+ * its useable
+ * - for protocol daemons, this could only because zebra told us of
+ * the interface
+ * - for zebra, only because it learnt from kernel
+ * - if not:
+ * - search the name to see if it contains a sub-ipif / logical interface
+ * seperator, the ':' char. If it does:
+ * - text up to that char must be the primary name - get that name.
+ * if not:
+ * - no idea, just get the name in its entirety.
+ */
+static struct interface *
+if_sunwzebra_get (const char *name, size_t nlen)
+{
+ struct interface *ifp;
+ size_t seppos = 0;
-
-/* See also wrapper function zebra_interface() in zebra/interface.c */
+ if ( (ifp = if_lookup_by_name_len(name, nlen)) != NULL)
+ return ifp;
+
+ /* hunt the primary interface name... */
+ while (seppos < nlen && name[seppos] != ':')
+ seppos++;
+
+ /* Wont catch seperator as last char, e.g. 'foo0:' but thats invalid */
+ if (seppos < nlen)
+ return if_get_by_name_len (name, seppos);
+ else
+ return if_get_by_name_len (name, nlen);
+}
+#endif /* SUNOS_5 */
+
DEFUN (interface,
interface_cmd,
"interface IFNAME",
@@ -521,7 +561,11 @@ DEFUN (interface,
return CMD_WARNING;
}
+#ifdef SUNOS_5
+ ifp = if_sunwzebra_get (argv[0], sl);
+#else
ifp = if_get_by_name_len(argv[0], sl);
+#endif /* SUNOS_5 */
vty->index = ifp;
vty->node = INTERFACE_NODE;
diff --git a/lib/smux.c b/lib/smux.c
index c9b7a880..1bec1209 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -963,7 +963,7 @@ smux_open (int sock)
version = 0;
ptr = asn_build_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- &version, sizeof (u_long));
+ &version, sizeof (version));
/* SMUX connection oid. */
ptr = asn_build_objid (ptr, &len,
@@ -1026,25 +1026,25 @@ smux_trap (oid *name, size_t namelen,
ptr = asn_build_string (ptr, &len,
(u_char)
(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_IPADDRESS),
- (u_char *)&addr, sizeof (struct in_addr));
+ (u_char *)&addr, sizeof (addr));
/* Generic trap integer. */
val = SNMP_TRAP_ENTERPRISESPECIFIC;
ptr = asn_build_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- &val, sizeof (int));
+ &val, sizeof (val));
/* Specific trap integer. */
val = sptrap;
ptr = asn_build_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- &val, sizeof (int));
+ &val, sizeof (val));
/* Timeticks timestamp. */
val = 0;
ptr = asn_build_unsigned_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_TIMETICKS),
- &val, sizeof (int));
+ &val, sizeof (val));
/* Variables. */
h1 = ptr;
@@ -1148,13 +1148,13 @@ smux_register (int sock)
priority = -1;
ptr = asn_build_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- &priority, sizeof (u_long));
+ &priority, sizeof (priority));
/* Operation. */
operation = 2; /* Register R/W */
ptr = asn_build_int (ptr, &len,
(u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER),
- &operation, sizeof (u_long));
+ &operation, sizeof (operation));
if (debug_smux)
{