diff options
Diffstat (limited to 'pimd/pim_util.c')
| -rw-r--r-- | pimd/pim_util.c | 76 |
1 files changed, 58 insertions, 18 deletions
diff --git a/pimd/pim_util.c b/pimd/pim_util.c index f5b6a8210a..139c0e3fb1 100644 --- a/pimd/pim_util.c +++ b/pimd/pim_util.c @@ -1,26 +1,26 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - This program 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 of the License, or - (at your option) any later version. - - This program 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 + */ #include <zebra.h> #include "log.h" +#include "prefix.h" #include "pim_util.h" @@ -103,3 +103,43 @@ void pim_pkt_dump(const char *label, const uint8_t *buf, int size) size); zlog_hexdump(buf, size); } + +int +pim_is_group_224_0_0_0_24 (struct in_addr group_addr) +{ + static int first = 1; + static struct prefix group_224; + struct prefix group; + + if (first) + { + str2prefix ("224.0.0.0/24", &group_224); + first = 0; + } + + group.family = AF_INET; + group.u.prefix4 = group_addr; + group.prefixlen = 32; + + return prefix_match (&group_224, &group); +} + +int +pim_is_group_224_4 (struct in_addr group_addr) +{ + static int first = 1; + static struct prefix group_all; + struct prefix group; + + if (first) + { + str2prefix ("224.0.0.0/4", &group_all); + first = 0; + } + + group.family = AF_INET; + group.u.prefix4 = group_addr; + group.prefixlen = 32; + + return prefix_match (&group_all, &group); +} |
