]>
git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_addr.c
bc9beca4ef6f61418068c298680162ff24a0d4e3
2 * PIM address generalizations
3 * Copyright (C) 2022 David Lamparter for NetDEF, Inc.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 printfrr_ext_autoreg_p("PA", printfrr_pimaddr
)
28 static ssize_t
printfrr_pimaddr(struct fbuf
*buf
, struct printfrr_eargs
*ea
,
31 const pim_addr
*addr
= vptr
;
32 bool use_star
= false;
34 if (ea
->fmt
[0] == 's') {
40 return bputs(buf
, "(null)");
45 if (memcmp(addr
, &zero
, sizeof(zero
)) == 0)
46 return bputch(buf
, '*');
50 return bprintfrr(buf
, "%pI4", addr
);
52 return bprintfrr(buf
, "%pI6", addr
);
56 printfrr_ext_autoreg_p("SG", printfrr_sgaddr
)
57 static ssize_t
printfrr_sgaddr(struct fbuf
*buf
, struct printfrr_eargs
*ea
,
60 const pim_sgaddr
*sga
= vptr
;
63 return bputs(buf
, "(null)");
65 return bprintfrr(buf
, "(%pPAs,%pPAs)", &sga
->src
, &sga
->grp
);