summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--babeld/message.c57
-rw-r--r--isisd/isis_tlvs.c13
-rwxr-xr-xtests/topotests/lib/mcast-tester.py34
-rwxr-xr-xtools/generate_support_bundle.py26
4 files changed, 108 insertions, 22 deletions
diff --git a/babeld/message.c b/babeld/message.c
index c8b1318c7a..cc751426ba 100644
--- a/babeld/message.c
+++ b/babeld/message.c
@@ -27,6 +27,7 @@ int split_horizon = 1;
unsigned short myseqno = 0;
#define UNICAST_BUFSIZE 1024
+#define RESERVED 0
static int unicast_buffered = 0;
static unsigned char *unicast_buffer = NULL;
struct neighbour *unicast_neighbour = NULL;
@@ -55,6 +56,16 @@ known_ae(int ae)
return ae <= 3;
}
+static inline bool
+is_all_zero(const unsigned char *data, int len) {
+ for (int j = 0; j < len; j++) {
+ if (data[j] != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
/* Parse a network prefix, encoded in the somewhat baroque compressed
representation used by Babel. Return the number of bytes parsed. */
static int
@@ -151,7 +162,11 @@ static bool parse_update_subtlv(const unsigned char *a, int alen,
"Received Mandatory bit set but this FRR version is not prepared to handle it at this point");
return true;
} else if (type == SUBTLV_PADN) {
- /* Nothing. */
+ if (!is_all_zero(a + i + 2, len)) {
+ debugf(BABEL_DEBUG_COMMON,
+ "Received pad%d with non zero MBZ field.",
+ len);
+ }
} else if (type == SUBTLV_DIVERSITY) {
if (len > DIVERSITY_HOPS) {
flog_err(
@@ -214,7 +229,11 @@ parse_hello_subtlv(const unsigned char *a, int alen,
"Received subtlv with Mandatory bit, this version of FRR is not prepared to handle this currently");
return -2;
} else if (type == SUBTLV_PADN) {
- /* Nothing to do. */
+ if (!is_all_zero(a + i + 2, len)) {
+ debugf(BABEL_DEBUG_COMMON,
+ "Received pad%d with non zero MBZ field.",
+ len);
+ }
} else if (type == SUBTLV_TIMESTAMP) {
if (len >= 4) {
DO_NTOHL(*hello_send_us, a + i + 2);
@@ -261,7 +280,11 @@ parse_ihu_subtlv(const unsigned char *a, int alen,
}
if(type == SUBTLV_PADN) {
- /* Nothing to do. */
+ if (!is_all_zero(a + i + 2, len)) {
+ debugf(BABEL_DEBUG_COMMON,
+ "Received pad%d with non zero MBZ field.",
+ len);
+ }
} else if(type == SUBTLV_TIMESTAMP) {
if(len >= 8) {
DO_NTOHL(*hello_send_us, a + i + 2);
@@ -462,12 +485,23 @@ parse_packet(const unsigned char *from, struct interface *ifp,
len = message[1];
if(type == MESSAGE_PADN) {
+ if (!is_all_zero(message + 2, len)) {
+ debugf(BABEL_DEBUG_COMMON,
+ "Received pad%d with non zero MBZ field.",
+ len);
+ }
debugf(BABEL_DEBUG_COMMON,"Received pad%d from %s on %s.",
len, format_address(from), ifp->name);
} else if(type == MESSAGE_ACK_REQ) {
- unsigned short nonce, interval;
+ unsigned short nonce, interval, Reserved;
+ DO_NTOHS(Reserved, message + 2);
DO_NTOHS(nonce, message + 4);
DO_NTOHS(interval, message + 6);
+ if (Reserved != RESERVED) {
+ debugf(BABEL_DEBUG_COMMON,"Received ack-req (%04X %d) with non zero Reserved from %s on %s.",
+ nonce, interval, format_address(from), ifp->name);
+ goto done;
+ }
debugf(BABEL_DEBUG_COMMON,"Received ack-req (%04X %d) from %s on %s.",
nonce, interval, format_address(from), ifp->name);
send_ack(neigh, nonce, interval);
@@ -528,8 +562,15 @@ parse_packet(const unsigned char *from, struct interface *ifp,
}
} else if(type == MESSAGE_IHU) {
unsigned short txcost, interval;
+ unsigned char Reserved;
unsigned char address[16];
int rc;
+ Reserved = message[3];
+ if (Reserved != RESERVED) {
+ debugf(BABEL_DEBUG_COMMON,"Received ihu with non zero Reserved from %s on %s.",
+ format_address(from), ifp->name);
+ goto done;
+ }
DO_NTOHS(txcost, message + 4);
DO_NTOHS(interval, message + 6);
rc = network_address(message[2], message + 8, len - 6, address);
@@ -765,8 +806,14 @@ parse_packet(const unsigned char *from, struct interface *ifp,
send_update(neigh->ifp, 0, prefix, plen);
}
} else if(type == MESSAGE_MH_REQUEST) {
- unsigned char prefix[16], plen;
+ unsigned char prefix[16], plen, Reserved;
unsigned short seqno;
+ Reserved = message[7];
+ if (Reserved != RESERVED) {
+ debugf(BABEL_DEBUG_COMMON,"Received request with non zero Reserved from %s on %s.",
+ format_address(from), ifp->name);
+ goto done;
+ }
int rc;
DO_NTOHS(seqno, message + 4);
rc = network_prefix(message[2], message[3], 0,
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index aa9d5e683b..41a17dbd1a 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -129,6 +129,7 @@ static int unpack_tlvs(enum isis_tlv_context context, size_t avail_len,
struct stream *stream, struct sbuf *log, void *dest,
int indent, bool *unpacked_known_tlvs);
static void isis_free_subsubtlvs(struct isis_subsubtlvs *subsubtlvs);
+static void isis_tlvs_del_asla_free(void *arg);
/* For tests/isisd, TLV text requires ipv4-unicast instead of standard */
static const char *isis_mtid2str_fake(uint16_t mtid)
@@ -147,6 +148,7 @@ struct isis_ext_subtlvs *isis_alloc_ext_subtlvs(void)
init_item_list(&ext->adj_sid);
init_item_list(&ext->lan_sid);
ext->aslas = list_new();
+ ext->aslas->del = isis_tlvs_del_asla_free;
init_item_list(&ext->srv6_endx_sid);
init_item_list(&ext->srv6_lan_endx_sid);
@@ -8136,12 +8138,19 @@ void isis_tlvs_del_srv6_lan_endx_sid(struct isis_ext_subtlvs *exts,
UNSET_SUBTLV(exts, EXT_SRV6_LAN_ENDX_SID);
}
+static void isis_tlvs_del_asla_free(void *arg)
+{
+ struct isis_asla_subtlvs *asla = arg;
+
+ admin_group_term(&asla->ext_admin_group);
+ XFREE(MTYPE_ISIS_SUBTLV, asla);
+}
+
void isis_tlvs_del_asla_flex_algo(struct isis_ext_subtlvs *ext,
struct isis_asla_subtlvs *asla)
{
- admin_group_term(&asla->ext_admin_group);
listnode_delete(ext->aslas, asla);
- XFREE(MTYPE_ISIS_SUBTLV, asla);
+ isis_tlvs_del_asla_free(asla);
}
struct isis_asla_subtlvs *
diff --git a/tests/topotests/lib/mcast-tester.py b/tests/topotests/lib/mcast-tester.py
index 3645eef25e..ecb99dc82b 100755
--- a/tests/topotests/lib/mcast-tester.py
+++ b/tests/topotests/lib/mcast-tester.py
@@ -25,28 +25,46 @@ import time
#
def interface_name_to_index(name):
"Gets the interface index using its name. Returns None on failure."
- interfaces = json.loads(subprocess.check_output("ip -j link show", shell=True))
+ try:
+ interfaces = json.loads(subprocess.check_output("ip -j link show", shell=True))
+ except subprocess.CalledProcessError as err:
+ print(f"Error executing command: {err}")
+ return None
+ except json.JSONDecodeError as err:
+ print(f"Error decoding JSON: {err}")
+ return None
for interface in interfaces:
- if interface["ifname"] == name:
- return interface["ifindex"]
+ if interface.get("ifname") == name:
+ return interface.get("ifindex")
return None
def interface_index_to_address(index, iptype="inet"):
"Gets the interface main address using its name. Returns None on failure."
- interfaces = json.loads(subprocess.check_output("ip -j addr show", shell=True))
+ try:
+ interfaces = json.loads(subprocess.check_output("ip -j addr show", shell=True))
+ except subprocess.CalledProcessError as err:
+ print(f"Error executing command: {err}")
+ return None
+ except json.JSONDecodeError as err:
+ print(f"Error decoding JSON: {err}")
+ return None
for interface in interfaces:
- if interface["ifindex"] == index:
+ if interface.get("ifindex") == index:
break
+ else:
+ return None
- for address in interface["addr_info"]:
- if address["family"] == iptype:
+ for address in interface.get("addr_info"):
+ if address.get("family") == iptype:
break
+ else:
+ return None
- local_address = ipaddress.ip_address(address["local"])
+ local_address = ipaddress.ip_address(address.get("local"))
return local_address.packed
diff --git a/tools/generate_support_bundle.py b/tools/generate_support_bundle.py
index 04a374d850..a646e7eea1 100755
--- a/tools/generate_support_bundle.py
+++ b/tools/generate_support_bundle.py
@@ -32,6 +32,9 @@ def main():
parser.add_argument(
"-l", "--log-dir", default="/var/log/frr", help="directory for logfiles"
)
+ parser.add_argument(
+ "-N", "--pathspace", help="Insert prefix into config & socket paths"
+ )
args = parser.parse_args()
collecting = False # file format has sentinels (seem superfluous)
@@ -69,13 +72,22 @@ def main():
# Spawn a vtysh to fetch each set of commands
procs = []
for proc in proc_cmds:
- ofn = os.path.join(args.log_dir, proc + "_support_bundle.log")
- p = subprocess.Popen(
- ["/usr/bin/env", "vtysh", "-t"],
- stdin=proc_cmds[proc],
- stdout=open_with_backup(ofn),
- stderr=subprocess.STDOUT,
- )
+ if args.pathspace:
+ ofn = os.path.join(args.log_dir, args.pathspace + "_" + proc + "_support_bundle.log")
+ p = subprocess.Popen(
+ ["/usr/bin/env", "vtysh", "-t", "-N", args.pathspace],
+ stdin=proc_cmds[proc],
+ stdout=open_with_backup(ofn),
+ stderr=subprocess.STDOUT,
+ )
+ else:
+ ofn = os.path.join(args.log_dir, proc + "_support_bundle.log")
+ p = subprocess.Popen(
+ ["/usr/bin/env", "vtysh", "-t"],
+ stdin=proc_cmds[proc],
+ stdout=open_with_backup(ofn),
+ stderr=subprocess.STDOUT,
+ )
procs.append(p)
for p in procs: