mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-30 18:25:15 +00:00

Some results: ``` ==== PCRE ==== % ./a.out "^65001" "65001" comparing: ^65001 / 65001 ret status: 0 [14:31] donatas-pc donatas /home/donatas % ./a.out "^65001_" "65001" comparing: ^65001_ / 65001 ret status: 0 ===== PCRE2 ===== % ./a.out "^65001" "65001" comparing: ^65001 / 65001 ret status: 0 [14:30] donatas-pc donatas /home/donatas % ./a.out "^65001_" "65001" comparing: ^65001_ / 65001 ret status: 1 ``` Seems that if using PCRE2, we need to escape outer `()` chars and `|`. Sounds like a bug. But this is only with some older PCRE2 versions. With >= 10.36, I wasn't able to reproduce this, everything is fine and working as expected. Adding _FRR_PCRE2_POSIX definition because pcre2posix.h does not have include's guard. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
/* AS regular expression routine
|
|
* Copyright (C) 1999 Kunihiro Ishiguro
|
|
*
|
|
* This file is part of GNU Zebra.
|
|
*
|
|
* GNU Zebra is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
* later version.
|
|
*
|
|
* GNU Zebra is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; see the file COPYING; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#ifndef _FRR_BGP_REGEX_H
|
|
#define _FRR_BGP_REGEX_H
|
|
|
|
#include <zebra.h>
|
|
|
|
#ifdef HAVE_LIBPCRE2_POSIX
|
|
#ifndef _FRR_PCRE2_POSIX
|
|
#define _FRR_PCRE2_POSIX
|
|
#include <pcre2posix.h>
|
|
#endif /* _FRR_PCRE2_POSIX */
|
|
#elif defined(HAVE_LIBPCREPOSIX)
|
|
#include <pcreposix.h>
|
|
#else
|
|
#include <regex.h>
|
|
#endif /* HAVE_LIBPCRE2_POSIX */
|
|
|
|
extern void bgp_regex_free(regex_t *regex);
|
|
extern regex_t *bgp_regcomp(const char *str);
|
|
extern int bgp_regexec(regex_t *regex, struct aspath *aspath);
|
|
|
|
#endif /* _FRR_BGP_REGEX_H */
|