frr: Fix build with bison rejecting paths in output directives

bison now carries the fix for CVE-2026-56390, which rejects '/' in
%header/%defines and %output file names, so generating the command
parser fails:

  lib/command_parse.y:20.10-30: error: invalid %header file name ignored
  lib/command_parse.y:21.10-30: error: invalid %output file name ignored

Backport the upstream fix which drops these directives and passes the
output file name with -o instead.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-10-20 07:47:50 -07:00
1 parent 06117c896a
commit cf06742a7c
2 files changed
+55

No files matched your search

@@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Donatas Abraitis <donatas@opensourcerouting.org>
Date: Tue, 13 Oct 2026 15:33:02 +0300
Subject: [PATCH] lib: Don't use paths in bison %output/%defines directives
The fix for CVE-2026-56390 rejects any '/' in %output and %header (%defines)
file names. The directive is then ignored, and bison reports an error
and exits non-zero, which breaks the build:
invalid %output file name ignored
invalid %header file name ignored
We only used these directives to place the generated files in lib/,
because the .y.c rule ran bison without -o. Drop them and pass
`-o $@` instead. With -d, bison derives lib/command_parse.h from the
-o name, so the generated files stay the same.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Upstream-Status: Backport [https://github.com/FRRouting/frr/commit/b7ad39d799d98c982713b29c1d0ba6d49691308b]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
lib/command_parse.y | 4 ----
lib/subdir.am | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/lib/command_parse.y b/lib/command_parse.y
index bc04bc93bb4c..4d9377e5df87 100644
--- a/lib/command_parse.y
+++ b/lib/command_parse.y
@@ -16,10 +16,6 @@
%define api.pure full
/* define api.prefix {cmd_yy} */
-/* names for generated header and parser files */
-%defines "lib/command_parse.h"
-%output "lib/command_parse.c"
-
/* note: code blocks are output in order, to both .c and .h:
* 1. %code requires
* 2. %union + bison forward decls
diff --git a/lib/subdir.am b/lib/subdir.am
index 20947c306d60..dafebacf8e7a 100644
--- a/lib/subdir.am
+++ b/lib/subdir.am
@@ -537,7 +537,7 @@ CLEANFILES += vtysh/vtysh_cmd.c $(vtysh_cmd_split)
.l.c:
$(AM_V_LEX)$(am__skiplex) $(LEXCOMPILE) $<
.y.c:
- $(AM_V_YACC)$(am__skipyacc) $(YACCCOMPILE) $<
+ $(AM_V_YACC)$(am__skipyacc) $(YACCCOMPILE) -o $@ $<
#
# generated sources & extra foo
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://doc/licenses/GPL-2.0;md5=b234ee4d69f5fce4486a80fdaf4a
SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/${@oe.utils.trim_version('${PV}', 2)};tag=frr-${PV} \
file://frr.pam \
file://0001-lib-Don-t-use-paths-in-bison-output-defines-directiv.patch \
"
SRCREV = "c8efb33af96f9f1220d0fdda6ac049f9126edd6f"