]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_mroute.c
Merge pull request #4743 from opensourcerouting/7.1/ospfd-default-originate
[mirror_frr.git] / pimd / pim_mroute.c
CommitLineData
12e41d03 1/*
896014f4
DL
2 * PIM for Quagga
3 * Copyright (C) 2008 Everton da Silva Marques
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
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
18 */
12e41d03
DL
19
20#include <zebra.h>
21#include "log.h"
22#include "privs.h"
744d91b3 23#include "if.h"
065bee4b 24#include "prefix.h"
dfe43e25
DW
25#include "vty.h"
26#include "plist.h"
fe232c19 27#include "sockopt.h"
3613d898 28#include "lib_errors.h"
12e41d03
DL
29
30#include "pimd.h"
8e38a2cf 31#include "pim_rpf.h"
12e41d03 32#include "pim_mroute.h"
37653d4f 33#include "pim_oil.h"
12e41d03
DL
34#include "pim_str.h"
35#include "pim_time.h"
36#include "pim_iface.h"
37#include "pim_macro.h"
c8ae3ce8 38#include "pim_rp.h"
59471fb8 39#include "pim_oil.h"
998af219 40#include "pim_register.h"
56638739 41#include "pim_ifchannel.h"
e3be0432 42#include "pim_zlookup.h"
15a5dafe 43#include "pim_ssm.h"
2002dcdb 44#include "pim_sock.h"
37c3fd98 45#include "pim_vxlan.h"
12e41d03 46
8ea5d944 47static void mroute_read_on(struct pim_instance *pim);
12e41d03 48
cdbfaec5 49static int pim_mroute_set(struct pim_instance *pim, int enable)
12e41d03 50{
d62a17ae 51 int err;
e5a2ebe6
DS
52 int opt, data;
53 socklen_t data_len = sizeof(data);
d62a17ae 54 long flags;
55
cdbfaec5
DS
56 /*
57 * We need to create the VRF table for the pim mroute_socket
58 */
59 if (pim->vrf_id != VRF_DEFAULT) {
01b9e3fd 60 frr_elevate_privs(&pimd_privs) {
f507c196 61
e5a2ebe6 62 data = pim->vrf->data.l.table_id;
01b9e3fd
DL
63 err = setsockopt(pim->mroute_socket, IPPROTO_IP,
64 MRT_TABLE,
e5a2ebe6 65 &data, data_len);
01b9e3fd
DL
66 if (err) {
67 zlog_warn(
68 "%s %s: failure: setsockopt(fd=%d,IPPROTO_IP, MRT_TABLE=%d): errno=%d: %s",
69 __FILE__, __PRETTY_FUNCTION__,
e5a2ebe6 70 pim->mroute_socket, data, errno,
01b9e3fd
DL
71 safe_strerror(errno));
72 return -1;
73 }
f507c196 74
01b9e3fd 75 }
f507c196
DS
76 }
77
f0b009a4
DS
78 frr_elevate_privs(&pimd_privs) {
79 opt = enable ? MRT_INIT : MRT_DONE;
e5a2ebe6
DS
80 /*
81 * *BSD *cares* about what value we pass down
82 * here
83 */
84 data = 1;
f0b009a4 85 err = setsockopt(pim->mroute_socket, IPPROTO_IP,
e5a2ebe6 86 opt, &data, data_len);
f0b009a4
DS
87 if (err) {
88 zlog_warn(
89 "%s %s: failure: setsockopt(fd=%d,IPPROTO_IP,%s=%d): errno=%d: %s",
90 __FILE__, __PRETTY_FUNCTION__,
91 pim->mroute_socket,
e5a2ebe6 92 enable ? "MRT_INIT" : "MRT_DONE", data, errno,
f0b009a4
DS
93 safe_strerror(errno));
94 return -1;
95 }
cdbfaec5
DS
96 }
97
466e4e5b
DS
98#if defined(HAVE_IP_PKTINFO)
99 if (enable) {
100 /* Linux and Solaris IP_PKTINFO */
e5a2ebe6
DS
101 data = 1;
102 if (setsockopt(pim->mroute_socket, IPPROTO_IP, IP_PKTINFO,
103 &data, data_len)) {
466e4e5b
DS
104 zlog_warn(
105 "Could not set IP_PKTINFO on socket fd=%d: errno=%d: %s",
106 pim->mroute_socket, errno,
107 safe_strerror(errno));
108 }
109 }
110#endif
111
cdbfaec5 112 setsockopt_so_recvbuf(pim->mroute_socket, 1024 * 1024 * 8);
d62a17ae 113
cdbfaec5 114 flags = fcntl(pim->mroute_socket, F_GETFL, 0);
d62a17ae 115 if (flags < 0) {
cdbfaec5
DS
116 zlog_warn("Could not get flags on socket fd:%d %d %s",
117 pim->mroute_socket, errno, safe_strerror(errno));
118 close(pim->mroute_socket);
d62a17ae 119 return -1;
120 }
cdbfaec5
DS
121 if (fcntl(pim->mroute_socket, F_SETFL, flags | O_NONBLOCK)) {
122 zlog_warn("Could not set O_NONBLOCK on socket fd:%d %d %s",
123 pim->mroute_socket, errno, safe_strerror(errno));
124 close(pim->mroute_socket);
d62a17ae 125 return -1;
126 }
127
128 if (enable) {
77b7d90b 129#if defined linux
d62a17ae 130 int upcalls = IGMPMSG_WRVIFWHOLE;
131 opt = MRT_PIM;
132
cdbfaec5 133 err = setsockopt(pim->mroute_socket, IPPROTO_IP, opt, &upcalls,
d62a17ae 134 sizeof(upcalls));
135 if (err) {
136 zlog_warn(
137 "Failure to register for VIFWHOLE and WRONGVIF upcalls %d %s",
138 errno, safe_strerror(errno));
139 return -1;
140 }
77b7d90b 141#else
d62a17ae 142 zlog_warn(
143 "PIM-SM will not work properly on this platform, until the ability to receive the WRVIFWHOLE upcall");
77b7d90b 144#endif
d62a17ae 145 }
146
147 return 0;
12e41d03
DL
148}
149
08e1fe76 150static const char *igmpmsgtype2str[IGMPMSG_WRVIFWHOLE + 1] = {
d62a17ae 151 "<unknown_upcall?>", "NOCACHE", "WRONGVIF", "WHOLEPKT", "WRVIFWHOLE"};
152
153static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
154 const struct igmpmsg *msg)
12e41d03 155{
d62a17ae 156 struct pim_interface *pim_ifp = ifp->info;
157 struct pim_upstream *up;
158 struct pim_rpf *rpg;
159 struct prefix_sg sg;
160
b575a12c 161 rpg = pim_ifp ? RP(pim_ifp->pim, msg->im_dst) : NULL;
d62a17ae 162 /*
163 * If the incoming interface is unknown OR
164 * the Interface type is SSM we don't need to
165 * do anything here
166 */
b5469d02 167 if (!rpg || pim_rpf_addr_is_inaddr_none(rpg)) {
d62a17ae 168 if (PIM_DEBUG_MROUTE_DETAIL)
169 zlog_debug(
b5469d02 170 "%s: Interface is not configured correctly to handle incoming packet: Could be !pim_ifp, !SM, !RP",
d62a17ae 171 __PRETTY_FUNCTION__);
b5469d02 172
d62a17ae 173 return 0;
174 }
04b40f02 175
d62a17ae 176 /*
177 * If we've received a multicast packet that isn't connected to
178 * us
179 */
180 if (!pim_if_connected_to_source(ifp, msg->im_src)) {
181 if (PIM_DEBUG_MROUTE_DETAIL)
182 zlog_debug(
183 "%s: Received incoming packet that doesn't originate on our seg",
184 __PRETTY_FUNCTION__);
185 return 0;
186 }
065bee4b 187
d62a17ae 188 memset(&sg, 0, sizeof(struct prefix_sg));
189 sg.src = msg->im_src;
190 sg.grp = msg->im_dst;
191
b5469d02
DS
192 if (!(PIM_I_am_DR(pim_ifp))) {
193 struct channel_oil *c_oil;
194
195 if (PIM_DEBUG_MROUTE_DETAIL)
196 zlog_debug("%s: Interface is not the DR blackholing incoming traffic for %s",
197 __PRETTY_FUNCTION__, pim_str_sg_dump(&sg));
198
199 /*
200 * We are not the DR, but we are still receiving packets
201 * Let's blackhole those packets for the moment
202 * As that they will be coming up to the cpu
203 * and causing us to consider them.
204 */
205 c_oil = pim_channel_oil_add(pim_ifp->pim, &sg,
206 pim_ifp->mroute_vif_index);
207 pim_mroute_add(c_oil, __PRETTY_FUNCTION__);
208
209 return 0;
210 }
211
d62a17ae 212 up = pim_upstream_find_or_add(&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR,
213 __PRETTY_FUNCTION__);
214 if (!up) {
215 if (PIM_DEBUG_MROUTE) {
216 zlog_debug(
217 "%s: Failure to add upstream information for %s",
218 __PRETTY_FUNCTION__, pim_str_sg_dump(&sg));
219 }
220 return 0;
221 }
c29a5806 222
d62a17ae 223 /*
224 * I moved this debug till after the actual add because
225 * I want to take advantage of the up->sg_str being filled in.
226 */
227 if (PIM_DEBUG_MROUTE) {
228 zlog_debug("%s: Adding a Route %s for WHOLEPKT consumption",
229 __PRETTY_FUNCTION__, up->sg_str);
230 }
8bfb8b67 231
d62a17ae 232 PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags);
19b807ca 233 pim_upstream_keep_alive_timer_start(up, pim_ifp->pim->keep_alive_time);
d62a17ae 234
235 up->channel_oil->cc.pktcnt++;
236 PIM_UPSTREAM_FLAG_SET_FHR(up->flags);
237 // resolve mfcc_parent prior to mroute_add in channel_add_oif
957d93ea
SP
238 if (up->rpf.source_nexthop.interface &&
239 up->channel_oil->oil.mfcc_parent >= MAXVIFS) {
d62a17ae 240 int vif_index = 0;
241 vif_index = pim_if_find_vifindex_by_ifindex(
7cfc7bcf 242 pim_ifp->pim,
d62a17ae 243 up->rpf.source_nexthop.interface->ifindex);
244 up->channel_oil->oil.mfcc_parent = vif_index;
245 }
246 pim_register_join(up);
59471fb8 247
d62a17ae 248 return 0;
e355e30f 249}
12e41d03 250
d62a17ae 251static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
252 const char *buf)
e355e30f 253{
d62a17ae 254 struct pim_interface *pim_ifp;
255 struct prefix_sg sg;
256 struct pim_rpf *rpg;
257 const struct ip *ip_hdr;
258 struct pim_upstream *up;
259
9b29ea95
DS
260 pim_ifp = ifp->info;
261
d62a17ae 262 ip_hdr = (const struct ip *)buf;
263
264 memset(&sg, 0, sizeof(struct prefix_sg));
265 sg.src = ip_hdr->ip_src;
266 sg.grp = ip_hdr->ip_dst;
267
9b29ea95 268 up = pim_upstream_find(pim_ifp->pim, &sg);
d62a17ae 269 if (!up) {
270 struct prefix_sg star = sg;
271 star.src.s_addr = INADDR_ANY;
272
9b29ea95 273 up = pim_upstream_find(pim_ifp->pim, &star);
d62a17ae 274
275 if (up && PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(up->flags)) {
2002dcdb 276 up = pim_upstream_add(pim_ifp->pim, &sg, ifp,
d62a17ae 277 PIM_UPSTREAM_FLAG_MASK_SRC_LHR,
0885a9f1 278 __PRETTY_FUNCTION__, NULL);
d62a17ae 279 if (!up) {
280 if (PIM_DEBUG_MROUTE)
281 zlog_debug(
282 "%s: Unable to create upstream information for %s",
283 __PRETTY_FUNCTION__,
284 pim_str_sg_dump(&sg));
285 return 0;
286 }
287 pim_upstream_keep_alive_timer_start(
19b807ca 288 up, pim_ifp->pim->keep_alive_time);
9b29ea95 289 pim_upstream_inherited_olist(pim_ifp->pim, up);
1eca8576
DS
290 pim_upstream_switch(pim_ifp->pim, up,
291 PIM_UPSTREAM_JOINED);
d62a17ae 292
293 if (PIM_DEBUG_MROUTE)
294 zlog_debug("%s: Creating %s upstream on LHR",
295 __PRETTY_FUNCTION__, up->sg_str);
296 return 0;
297 }
298 if (PIM_DEBUG_MROUTE_DETAIL) {
299 zlog_debug(
300 "%s: Unable to find upstream channel WHOLEPKT%s",
301 __PRETTY_FUNCTION__, pim_str_sg_dump(&sg));
302 }
303 return 0;
304 }
59471fb8 305
957d93ea
SP
306 if (!up->rpf.source_nexthop.interface) {
307 if (PIM_DEBUG_TRACE)
308 zlog_debug("%s: up %s RPF is not present",
309 __PRETTY_FUNCTION__, up->sg_str);
310 return 0;
311 }
312
d62a17ae 313 pim_ifp = up->rpf.source_nexthop.interface->info;
998af219 314
b575a12c 315 rpg = pim_ifp ? RP(pim_ifp->pim, sg.grp) : NULL;
c8ae3ce8 316
d62a17ae 317 if ((pim_rpf_addr_is_inaddr_none(rpg)) || (!pim_ifp)
318 || (!(PIM_I_am_DR(pim_ifp)))) {
319 if (PIM_DEBUG_MROUTE) {
320 zlog_debug("%s: Failed Check send packet",
321 __PRETTY_FUNCTION__);
322 }
323 return 0;
324 }
84366c7e 325
d62a17ae 326 /*
327 * If we've received a register suppress
328 */
329 if (!up->t_rs_timer) {
6f439a70 330 if (pim_is_grp_ssm(pim_ifp->pim, sg.grp)) {
d62a17ae 331 if (PIM_DEBUG_PIM_REG)
332 zlog_debug(
333 "%s register forward skipped as group is SSM",
334 pim_str_sg_dump(&sg));
335 return 0;
336 }
337 pim_register_send((uint8_t *)buf + sizeof(struct ip),
338 ntohs(ip_hdr->ip_len) - sizeof(struct ip),
339 pim_ifp->primary_address, rpg, 0, up);
340 }
341 return 0;
e355e30f 342}
12e41d03 343
d62a17ae 344static int pim_mroute_msg_wrongvif(int fd, struct interface *ifp,
345 const struct igmpmsg *msg)
e355e30f 346{
d62a17ae 347 struct pim_ifchannel *ch;
348 struct pim_interface *pim_ifp;
349 struct prefix_sg sg;
350
351 memset(&sg, 0, sizeof(struct prefix_sg));
352 sg.src = msg->im_src;
353 sg.grp = msg->im_dst;
354
355 /*
356 Send Assert(S,G) on iif as response to WRONGVIF kernel upcall.
357
358 RFC 4601 4.8.2. PIM-SSM-Only Routers
359
360 iif is the incoming interface of the packet.
361 if (iif is in inherited_olist(S,G)) {
362 send Assert(S,G) on iif
363 }
364 */
365
366 if (!ifp) {
367 if (PIM_DEBUG_MROUTE)
368 zlog_debug(
369 "%s: WRONGVIF (S,G)=%s could not find input interface for input_vif_index=%d",
370 __PRETTY_FUNCTION__, pim_str_sg_dump(&sg),
371 msg->im_vif);
372 return -1;
373 }
12e41d03 374
d62a17ae 375 pim_ifp = ifp->info;
376 if (!pim_ifp) {
377 if (PIM_DEBUG_MROUTE)
378 zlog_debug(
379 "%s: WRONGVIF (S,G)=%s multicast not enabled on interface %s",
380 __PRETTY_FUNCTION__, pim_str_sg_dump(&sg),
381 ifp->name);
382 return -2;
383 }
c29a5806 384
d62a17ae 385 ch = pim_ifchannel_find(ifp, &sg);
386 if (!ch) {
387 struct prefix_sg star_g = sg;
388 if (PIM_DEBUG_MROUTE)
389 zlog_debug(
390 "%s: WRONGVIF (S,G)=%s could not find channel on interface %s",
391 __PRETTY_FUNCTION__, pim_str_sg_dump(&sg),
392 ifp->name);
393
394 star_g.src.s_addr = INADDR_ANY;
395 ch = pim_ifchannel_find(ifp, &star_g);
396 if (!ch) {
397 if (PIM_DEBUG_MROUTE)
398 zlog_debug(
399 "%s: WRONGVIF (*,G)=%s could not find channel on interface %s",
400 __PRETTY_FUNCTION__,
401 pim_str_sg_dump(&star_g), ifp->name);
402 return -3;
403 }
404 }
12e41d03 405
d62a17ae 406 /*
407 RFC 4601: 4.6.1. (S,G) Assert Message State Machine
408
409 Transitions from NoInfo State
410
411 An (S,G) data packet arrives on interface I, AND
412 CouldAssert(S,G,I)==TRUE An (S,G) data packet arrived on an
413 downstream interface that is in our (S,G) outgoing interface
414 list. We optimistically assume that we will be the assert
415 winner for this (S,G), and so we transition to the "I am Assert
416 Winner" state and perform Actions A1 (below), which will
417 initiate the assert negotiation for (S,G).
418 */
419
420 if (ch->ifassert_state != PIM_IFASSERT_NOINFO) {
421 if (PIM_DEBUG_MROUTE) {
422 zlog_debug(
423 "%s: WRONGVIF (S,G)=%s channel is not on Assert NoInfo state for interface %s",
424 __PRETTY_FUNCTION__, ch->sg_str, ifp->name);
425 }
426 return -4;
427 }
e355e30f 428
d62a17ae 429 if (!PIM_IF_FLAG_TEST_COULD_ASSERT(ch->flags)) {
430 if (PIM_DEBUG_MROUTE) {
431 zlog_debug(
432 "%s: WRONGVIF (S,G)=%s interface %s is not downstream for channel",
433 __PRETTY_FUNCTION__, ch->sg_str, ifp->name);
434 }
435 return -5;
436 }
437
438 if (assert_action_a1(ch)) {
439 if (PIM_DEBUG_MROUTE) {
440 zlog_debug(
441 "%s: WRONGVIF (S,G)=%s assert_action_a1 failure on interface %s",
442 __PRETTY_FUNCTION__, ch->sg_str, ifp->name);
443 }
444 return -6;
445 }
e355e30f 446
d62a17ae 447 return 0;
e355e30f
DS
448}
449
d62a17ae 450static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
451 const char *buf)
08e1fe76 452{
d62a17ae 453 const struct ip *ip_hdr = (const struct ip *)buf;
454 struct pim_interface *pim_ifp;
455 struct pim_ifchannel *ch;
456 struct pim_upstream *up;
457 struct prefix_sg star_g;
458 struct prefix_sg sg;
459 struct channel_oil *oil;
460
fec883d9
DS
461 pim_ifp = ifp->info;
462
d62a17ae 463 memset(&sg, 0, sizeof(struct prefix_sg));
464 sg.src = ip_hdr->ip_src;
465 sg.grp = ip_hdr->ip_dst;
466
467 ch = pim_ifchannel_find(ifp, &sg);
468 if (ch) {
469 if (PIM_DEBUG_MROUTE)
470 zlog_debug(
471 "WRVIFWHOLE (S,G)=%s found ifchannel on interface %s",
472 ch->sg_str, ifp->name);
473 return -1;
474 }
b7ddd2ec 475
d62a17ae 476 star_g = sg;
477 star_g.src.s_addr = INADDR_ANY;
b7ddd2ec 478#if 0
0490c22d
DS
479 ch = pim_ifchannel_find(ifp, &star_g);
480 if (ch)
481 {
482 if (PIM_DEBUG_MROUTE)
483 zlog_debug ("WRVIFWHOLE (*,G)=%s found ifchannel on interface %s",
484 pim_str_sg_dump (&star_g), ifp->name);
485 return -1;
486 }
5cd11e3c 487#endif
08e1fe76 488
9b29ea95 489 up = pim_upstream_find(pim_ifp->pim, &sg);
d62a17ae 490 if (up) {
491 struct pim_upstream *parent;
492 struct pim_nexthop source;
fec883d9 493 struct pim_rpf *rpf = RP(pim_ifp->pim, sg.grp);
d62a17ae 494 if (!rpf || !rpf->source_nexthop.interface)
495 return 0;
496
497 /*
498 * If we have received a WRVIFWHOLE and are at this
499 * point, we could be receiving the packet on the *,G
500 * tree, let's check and if so we can safely drop
501 * it.
502 */
9b29ea95 503 parent = pim_upstream_find(pim_ifp->pim, &star_g);
d62a17ae 504 if (parent && parent->rpf.source_nexthop.interface == ifp)
505 return 0;
506
507 pim_ifp = rpf->source_nexthop.interface->info;
508
509 memset(&source, 0, sizeof(source));
510 /*
511 * If we are the fhr that means we are getting a callback during
512 * the pimreg period, so I believe we can ignore this packet
513 */
514 if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) {
515 // No if channel, but upstream we are at the RP.
d9c9a9ee 516 if (pim_nexthop_lookup(pim_ifp->pim, &source,
ade155e1 517 up->upstream_register, 0)) {
d62a17ae 518 pim_register_stop_send(source.interface, &sg,
519 pim_ifp->primary_address,
520 up->upstream_register);
df766618
DS
521 up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
522 }
d62a17ae 523 if (!up->channel_oil)
524 up->channel_oil = pim_channel_oil_add(
611925dc
DS
525 pim_ifp->pim, &sg,
526 pim_ifp->mroute_vif_index);
9b29ea95 527 pim_upstream_inherited_olist(pim_ifp->pim, up);
d62a17ae 528 if (!up->channel_oil->installed)
529 pim_mroute_add(up->channel_oil,
530 __PRETTY_FUNCTION__);
d62a17ae 531 } else {
d9c9a9ee
DS
532 if (I_am_RP(pim_ifp->pim, up->sg.grp)) {
533 if (pim_nexthop_lookup(pim_ifp->pim, &source,
ade155e1
DS
534 up->upstream_register,
535 0))
d62a17ae 536 pim_register_stop_send(
537 source.interface, &sg,
538 pim_ifp->primary_address,
539 up->upstream_register);
540 up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
541 }
542 pim_upstream_keep_alive_timer_start(
19b807ca 543 up, pim_ifp->pim->keep_alive_time);
9b29ea95 544 pim_upstream_inherited_olist(pim_ifp->pim, up);
d62a17ae 545 pim_mroute_msg_wholepkt(fd, ifp, buf);
546 }
547 return 0;
548 }
8e38a2cf 549
d62a17ae 550 pim_ifp = ifp->info;
611925dc 551 oil = pim_channel_oil_add(pim_ifp->pim, &sg, pim_ifp->mroute_vif_index);
d62a17ae 552 if (!oil->installed)
553 pim_mroute_add(oil, __PRETTY_FUNCTION__);
554 if (pim_if_connected_to_source(ifp, sg.src)) {
2002dcdb
DS
555 up = pim_upstream_add(pim_ifp->pim, &sg, ifp,
556 PIM_UPSTREAM_FLAG_MASK_FHR,
0885a9f1 557 __PRETTY_FUNCTION__, NULL);
d62a17ae 558 if (!up) {
559 if (PIM_DEBUG_MROUTE)
560 zlog_debug(
561 "%s: WRONGVIF%s unable to create upstream on interface",
562 pim_str_sg_dump(&sg), ifp->name);
563 return -2;
564 }
565 PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags);
996c9314
LB
566 pim_upstream_keep_alive_timer_start(
567 up, pim_ifp->pim->keep_alive_time);
d62a17ae 568 up->channel_oil = oil;
569 up->channel_oil->cc.pktcnt++;
570 pim_register_join(up);
9b29ea95 571 pim_upstream_inherited_olist(pim_ifp->pim, up);
d62a17ae 572
573 // Send the packet to the RP
574 pim_mroute_msg_wholepkt(fd, ifp, buf);
575 }
08e1fe76 576
d62a17ae 577 return 0;
08e1fe76
DS
578}
579
405d6357 580static int pim_mroute_msg(struct pim_instance *pim, const char *buf,
90450a3d 581 int buf_size, ifindex_t ifindex)
e355e30f 582{
d62a17ae 583 struct interface *ifp;
584 struct pim_interface *pim_ifp;
585 const struct ip *ip_hdr;
586 const struct igmpmsg *msg;
587 char ip_src_str[INET_ADDRSTRLEN] = "";
588 char ip_dst_str[INET_ADDRSTRLEN] = "";
589 char src_str[INET_ADDRSTRLEN] = "<src?>";
590 char grp_str[INET_ADDRSTRLEN] = "<grp?>";
591 struct in_addr ifaddr;
592 struct igmp_sock *igmp;
593
594 ip_hdr = (const struct ip *)buf;
595
596 if (ip_hdr->ip_p == IPPROTO_IGMP) {
597
598 /* We have the IP packet but we do not know which interface this
599 * packet was
600 * received on. Find the interface that is on the same subnet as
601 * the source
602 * of the IP packet.
603 */
90450a3d 604 ifp = if_lookup_by_index(ifindex, pim->vrf_id);
d62a17ae 605
1ef8c24e 606 if (!ifp || !ifp->info)
d62a17ae 607 return 0;
90450a3d 608
d62a17ae 609 pim_ifp = ifp->info;
610 ifaddr = pim_find_primary_addr(ifp);
611 igmp = pim_igmp_sock_lookup_ifaddr(pim_ifp->igmp_socket_list,
612 ifaddr);
613
614 if (PIM_DEBUG_MROUTE) {
615 pim_inet4_dump("<src?>", ip_hdr->ip_src, ip_src_str,
616 sizeof(ip_src_str));
617 pim_inet4_dump("<dst?>", ip_hdr->ip_dst, ip_dst_str,
618 sizeof(ip_dst_str));
619
620 zlog_warn(
7c2bfc2a
DS
621 "%s(%s): igmp kernel upcall on %s(%p) for %s -> %s",
622 __PRETTY_FUNCTION__, pim->vrf->name, ifp->name,
623 igmp, ip_src_str, ip_dst_str);
d62a17ae 624 }
625 if (igmp)
626 pim_igmp_packet(igmp, (char *)buf, buf_size);
627
628 } else if (ip_hdr->ip_p) {
629 if (PIM_DEBUG_MROUTE_DETAIL) {
630 pim_inet4_dump("<src?>", ip_hdr->ip_src, src_str,
631 sizeof(src_str));
632 pim_inet4_dump("<grp?>", ip_hdr->ip_dst, grp_str,
633 sizeof(grp_str));
634 zlog_debug(
635 "%s: no kernel upcall proto=%d src: %s dst: %s msg_size=%d",
636 __PRETTY_FUNCTION__, ip_hdr->ip_p, src_str,
637 grp_str, buf_size);
638 }
639
640 } else {
641 msg = (const struct igmpmsg *)buf;
642
7cfc7bcf 643 ifp = pim_if_find_by_vif_index(pim, msg->im_vif);
d62a17ae 644
645 if (!ifp)
646 return 0;
647 if (PIM_DEBUG_MROUTE) {
648 pim_inet4_dump("<src?>", msg->im_src, src_str,
649 sizeof(src_str));
650 pim_inet4_dump("<grp?>", msg->im_dst, grp_str,
651 sizeof(grp_str));
652 zlog_warn(
653 "%s: pim kernel upcall %s type=%d ip_p=%d from fd=%d for (S,G)=(%s,%s) on %s vifi=%d size=%d",
654 __PRETTY_FUNCTION__,
655 igmpmsgtype2str[msg->im_msgtype],
405d6357
DS
656 msg->im_msgtype, ip_hdr->ip_p,
657 pim->mroute_socket, src_str, grp_str, ifp->name,
658 msg->im_vif, buf_size);
d62a17ae 659 }
660
661 switch (msg->im_msgtype) {
662 case IGMPMSG_WRONGVIF:
405d6357
DS
663 return pim_mroute_msg_wrongvif(pim->mroute_socket, ifp,
664 msg);
d62a17ae 665 break;
666 case IGMPMSG_NOCACHE:
405d6357
DS
667 return pim_mroute_msg_nocache(pim->mroute_socket, ifp,
668 msg);
d62a17ae 669 break;
670 case IGMPMSG_WHOLEPKT:
405d6357 671 return pim_mroute_msg_wholepkt(pim->mroute_socket, ifp,
d62a17ae 672 (const char *)msg);
673 break;
674 case IGMPMSG_WRVIFWHOLE:
405d6357
DS
675 return pim_mroute_msg_wrvifwhole(
676 pim->mroute_socket, ifp, (const char *)msg);
d62a17ae 677 break;
678 default:
679 break;
680 }
681 }
12e41d03 682
d62a17ae 683 return 0;
12e41d03
DL
684}
685
12e41d03
DL
686static int mroute_read(struct thread *t)
687{
8ea5d944 688 struct pim_instance *pim;
d62a17ae 689 static long long count;
690 char buf[10000];
691 int result = 0;
692 int cont = 1;
d62a17ae 693 int rd;
90450a3d 694 ifindex_t ifindex;
8ea5d944 695 pim = THREAD_ARG(t);
d62a17ae 696
697 while (cont) {
90450a3d
DS
698 rd = pim_socket_recvfromto(pim->mroute_socket, (uint8_t *)buf,
699 sizeof(buf), NULL, NULL, NULL, NULL,
700 &ifindex);
61e99c94 701 if (rd <= 0) {
d62a17ae 702 if (errno == EINTR)
703 continue;
704 if (errno == EWOULDBLOCK || errno == EAGAIN)
705 break;
706
707 if (PIM_DEBUG_MROUTE)
708 zlog_warn(
61e99c94 709 "%s: failure reading rd=%d: fd=%d: errno=%d: %s",
8ea5d944
DS
710 __PRETTY_FUNCTION__, rd,
711 pim->mroute_socket, errno,
d62a17ae 712 safe_strerror(errno));
713 goto done;
714 }
715
90450a3d 716 result = pim_mroute_msg(pim, buf, rd, ifindex);
d62a17ae 717
718 count++;
75373cca 719 if (count % router->packet_process == 0)
d62a17ae 720 cont = 0;
721 }
722/* Keep reading */
723done:
8ea5d944 724 mroute_read_on(pim);
12e41d03 725
d62a17ae 726 return result;
12e41d03
DL
727}
728
8ea5d944 729static void mroute_read_on(struct pim_instance *pim)
12e41d03 730{
36417fcc 731 thread_add_read(router->master, mroute_read, pim, pim->mroute_socket,
8ea5d944 732 &pim->thread);
12e41d03
DL
733}
734
8ea5d944 735static void mroute_read_off(struct pim_instance *pim)
12e41d03 736{
8ea5d944 737 THREAD_OFF(pim->thread);
12e41d03
DL
738}
739
6beed987 740int pim_mroute_socket_enable(struct pim_instance *pim)
12e41d03 741{
d62a17ae 742 int fd;
12e41d03 743
01b9e3fd 744 frr_elevate_privs(&pimd_privs) {
12e41d03 745
01b9e3fd 746 fd = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP);
12e41d03 747
01b9e3fd
DL
748 if (fd < 0) {
749 zlog_warn("Could not create mroute socket: errno=%d: %s",
750 errno,
751 safe_strerror(errno));
752 return -2;
753 }
e691f179 754
466e4e5b 755#ifdef SO_BINDTODEVICE
01b9e3fd 756 if (pim->vrf->vrf_id != VRF_DEFAULT
633fc9b1
DL
757 && setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
758 pim->vrf->name, strlen(pim->vrf->name))) {
01b9e3fd
DL
759 zlog_warn("Could not setsockopt SO_BINDTODEVICE: %s",
760 safe_strerror(errno));
761 close(fd);
762 return -3;
763 }
466e4e5b 764#endif
90450a3d 765
01b9e3fd 766 }
12e41d03 767
cdbfaec5
DS
768 pim->mroute_socket = fd;
769 if (pim_mroute_set(pim, 1)) {
d62a17ae 770 zlog_warn(
771 "Could not enable mroute on socket fd=%d: errno=%d: %s",
772 fd, errno, safe_strerror(errno));
773 close(fd);
cdbfaec5 774 pim->mroute_socket = -1;
d62a17ae 775 return -3;
776 }
12e41d03 777
6beed987 778 pim->mroute_socket_creation = pim_time_monotonic_sec();
b45cefcb 779
8ea5d944 780 mroute_read_on(pim);
12e41d03 781
d62a17ae 782 return 0;
12e41d03
DL
783}
784
6beed987 785int pim_mroute_socket_disable(struct pim_instance *pim)
12e41d03 786{
cdbfaec5 787 if (pim_mroute_set(pim, 0)) {
d62a17ae 788 zlog_warn(
789 "Could not disable mroute on socket fd=%d: errno=%d: %s",
405d6357 790 pim->mroute_socket, errno, safe_strerror(errno));
d62a17ae 791 return -2;
792 }
793
6beed987 794 if (close(pim->mroute_socket)) {
d62a17ae 795 zlog_warn("Failure closing mroute socket: fd=%d errno=%d: %s",
405d6357 796 pim->mroute_socket, errno, safe_strerror(errno));
d62a17ae 797 return -3;
798 }
799
8ea5d944 800 mroute_read_off(pim);
6beed987 801 pim->mroute_socket = -1;
d62a17ae 802
803 return 0;
12e41d03
DL
804}
805
806/*
807 For each network interface (e.g., physical or a virtual tunnel) that
808 would be used for multicast forwarding, a corresponding multicast
809 interface must be added to the kernel.
810 */
d62a17ae 811int pim_mroute_add_vif(struct interface *ifp, struct in_addr ifaddr,
812 unsigned char flags)
12e41d03 813{
d62a17ae 814 struct pim_interface *pim_ifp = ifp->info;
815 struct vifctl vc;
816 int err;
12e41d03 817
08f4f901 818 if (PIM_DEBUG_MROUTE)
d62fd596 819 zlog_debug("%s: Add Vif %d (%s[%s])", __PRETTY_FUNCTION__,
996c9314
LB
820 pim_ifp->mroute_vif_index, ifp->name,
821 pim_ifp->pim->vrf->name);
08f4f901 822
d62a17ae 823 memset(&vc, 0, sizeof(vc));
824 vc.vifc_vifi = pim_ifp->mroute_vif_index;
b3f2bf7c 825#ifdef VIFF_USE_IFINDEX
d62a17ae 826 vc.vifc_lcl_ifindex = ifp->ifindex;
b3f2bf7c 827#else
d62a17ae 828 if (ifaddr.s_addr == INADDR_ANY) {
829 zlog_warn(
830 "%s: unnumbered interfaces are not supported on this platform",
831 __PRETTY_FUNCTION__);
832 return -1;
833 }
834 memcpy(&vc.vifc_lcl_addr, &ifaddr, sizeof(vc.vifc_lcl_addr));
b3f2bf7c 835#endif
d62a17ae 836 vc.vifc_flags = flags;
837 vc.vifc_threshold = PIM_MROUTE_MIN_TTL;
838 vc.vifc_rate_limit = 0;
839
840#ifdef PIM_DVMRP_TUNNEL
841 if (vc.vifc_flags & VIFF_TUNNEL) {
842 memcpy(&vc.vifc_rmt_addr, &vif_remote_addr,
843 sizeof(vc.vifc_rmt_addr));
844 }
12e41d03
DL
845#endif
846
ea3d967b 847 err = setsockopt(pim_ifp->pim->mroute_socket, IPPROTO_IP, MRT_ADD_VIF,
d62a17ae 848 (void *)&vc, sizeof(vc));
849 if (err) {
850 char ifaddr_str[INET_ADDRSTRLEN];
12e41d03 851
d62a17ae 852 pim_inet4_dump("<ifaddr?>", ifaddr, ifaddr_str,
853 sizeof(ifaddr_str));
12e41d03 854
d62a17ae 855 zlog_warn(
08f4f901 856 "%s: failure: setsockopt(fd=%d,IPPROTO_IP,MRT_ADD_VIF,vif_index=%d,ifaddr=%s,flag=%d): errno=%d: %s",
996c9314
LB
857 __PRETTY_FUNCTION__, pim_ifp->pim->mroute_socket,
858 ifp->ifindex, ifaddr_str, flags, errno,
859 safe_strerror(errno));
d62a17ae 860 return -2;
861 }
12e41d03 862
d62a17ae 863 return 0;
12e41d03
DL
864}
865
ea3d967b 866int pim_mroute_del_vif(struct interface *ifp)
12e41d03 867{
ea3d967b 868 struct pim_interface *pim_ifp = ifp->info;
d62a17ae 869 struct vifctl vc;
870 int err;
871
ea3d967b 872 if (PIM_DEBUG_MROUTE)
996c9314
LB
873 zlog_debug("%s: Del Vif %d (%s[%s])", __PRETTY_FUNCTION__,
874 pim_ifp->mroute_vif_index, ifp->name,
875 pim_ifp->pim->vrf->name);
12e41d03 876
d62a17ae 877 memset(&vc, 0, sizeof(vc));
ea3d967b 878 vc.vifc_vifi = pim_ifp->mroute_vif_index;
d62a17ae 879
ea3d967b 880 err = setsockopt(pim_ifp->pim->mroute_socket, IPPROTO_IP, MRT_DEL_VIF,
d62a17ae 881 (void *)&vc, sizeof(vc));
882 if (err) {
883 zlog_warn(
884 "%s %s: failure: setsockopt(fd=%d,IPPROTO_IP,MRT_DEL_VIF,vif_index=%d): errno=%d: %s",
ea3d967b
DS
885 __FILE__, __PRETTY_FUNCTION__,
886 pim_ifp->pim->mroute_socket, pim_ifp->mroute_vif_index,
887 errno, safe_strerror(errno));
d62a17ae 888 return -2;
889 }
12e41d03 890
d62a17ae 891 return 0;
12e41d03
DL
892}
893
6a78764e 894int pim_mroute_add(struct channel_oil *c_oil, const char *name)
12e41d03 895{
9a0f71c9 896 struct pim_instance *pim = c_oil->pim;
d62a17ae 897 int err;
898 int orig = 0;
899 int orig_iif_vif = 0;
76e4825a
AK
900 struct pim_interface *pim_reg_ifp;
901 int orig_pimreg_ttl;
902 bool pimreg_ttl_reset = false;
37c3fd98
AK
903 struct pim_interface *vxlan_ifp;
904 int orig_term_ttl;
905 bool orig_term_ttl_reset = false;
d62a17ae 906
856e863f
DS
907 pim->mroute_add_last = pim_time_monotonic_sec();
908 ++pim->mroute_add_events;
d62a17ae 909
910 /* Do not install route if incoming interface is undefined. */
911 if (c_oil->oil.mfcc_parent >= MAXVIFS) {
912 if (PIM_DEBUG_MROUTE) {
913 char buf[1000];
914 zlog_debug(
915 "%s(%s) %s Attempting to add vifi that is invalid to mroute table",
916 __PRETTY_FUNCTION__, name,
917 pim_channel_oil_dump(c_oil, buf, sizeof(buf)));
918 }
919 return -2;
920 }
d3aded99 921
d62a17ae 922 /* The linux kernel *expects* the incoming
923 * vif to be part of the outgoing list
924 * in the case of a (*,G).
925 */
926 if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) {
927 orig = c_oil->oil.mfcc_ttls[c_oil->oil.mfcc_parent];
928 c_oil->oil.mfcc_ttls[c_oil->oil.mfcc_parent] = 1;
929 }
d3aded99 930
76e4825a
AK
931 if (c_oil->up) {
932 /* suppress pimreg in the OIL if the mroute is not supposed to
933 * trigger register encapsulated data
934 */
935 if (PIM_UPSTREAM_FLAG_TEST_NO_PIMREG_DATA(c_oil->up->flags)) {
936 pim_reg_ifp = pim->regiface->info;
937 orig_pimreg_ttl =
938 c_oil->oil.mfcc_ttls[pim_reg_ifp->mroute_vif_index];
939 c_oil->oil.mfcc_ttls[pim_reg_ifp->mroute_vif_index] = 0;
940 /* remember to flip it back after MFC programming */
941 pimreg_ttl_reset = true;
942 }
37c3fd98
AK
943
944 vxlan_ifp = pim_vxlan_get_term_ifp(pim);
945 /* 1. vxlan termination device must never be added to the
946 * origination mroute (and that can actually happen because
947 * of XG inheritance from the termination mroute) otherwise
948 * traffic will end up looping.
949 * 2. vxlan termination device should be removed from the non-DF
950 * to prevent duplicates to the overlay rxer
951 */
952 if (vxlan_ifp &&
953 (PIM_UPSTREAM_FLAG_TEST_SRC_VXLAN_ORIG(c_oil->up->flags) ||
954 PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(c_oil->up->flags))) {
955 orig_term_ttl_reset = true;
956 orig_term_ttl =
957 c_oil->oil.mfcc_ttls[vxlan_ifp->mroute_vif_index];
958 c_oil->oil.mfcc_ttls[vxlan_ifp->mroute_vif_index] = 0;
959 }
76e4825a
AK
960 }
961
d62a17ae 962 /*
963 * If we have an unresolved cache entry for the S,G
964 * it is owned by the pimreg for the incoming IIF
965 * So set pimreg as the IIF temporarily to cause
966 * the packets to be forwarded. Then set it
967 * to the correct IIF afterwords.
968 */
969 if (!c_oil->installed && c_oil->oil.mfcc_origin.s_addr != INADDR_ANY
970 && c_oil->oil.mfcc_parent != 0) {
971 orig_iif_vif = c_oil->oil.mfcc_parent;
972 c_oil->oil.mfcc_parent = 0;
973 }
856e863f 974 err = setsockopt(pim->mroute_socket, IPPROTO_IP, MRT_ADD_MFC,
d62a17ae 975 &c_oil->oil, sizeof(c_oil->oil));
976
977 if (!err && !c_oil->installed
978 && c_oil->oil.mfcc_origin.s_addr != INADDR_ANY
979 && orig_iif_vif != 0) {
980 c_oil->oil.mfcc_parent = orig_iif_vif;
856e863f 981 err = setsockopt(pim->mroute_socket, IPPROTO_IP, MRT_ADD_MFC,
d62a17ae 982 &c_oil->oil, sizeof(c_oil->oil));
983 }
0365f56b 984
d62a17ae 985 if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY)
986 c_oil->oil.mfcc_ttls[c_oil->oil.mfcc_parent] = orig;
d3aded99 987
76e4825a
AK
988 if (pimreg_ttl_reset)
989 c_oil->oil.mfcc_ttls[pim_reg_ifp->mroute_vif_index] =
990 orig_pimreg_ttl;
37c3fd98
AK
991
992 if (orig_term_ttl_reset)
993 c_oil->oil.mfcc_ttls[vxlan_ifp->mroute_vif_index] =
994 orig_term_ttl;
995
d62a17ae 996 if (err) {
997 zlog_warn(
998 "%s %s: failure: setsockopt(fd=%d,IPPROTO_IP,MRT_ADD_MFC): errno=%d: %s",
856e863f 999 __FILE__, __PRETTY_FUNCTION__, pim->mroute_socket,
d62a17ae 1000 errno, safe_strerror(errno));
1001 return -2;
1002 }
12e41d03 1003
d62a17ae 1004 if (PIM_DEBUG_MROUTE) {
1005 char buf[1000];
996c9314
LB
1006 zlog_debug("%s(%s), vrf %s Added Route: %s",
1007 __PRETTY_FUNCTION__, name, pim->vrf->name,
d62a17ae 1008 pim_channel_oil_dump(c_oil, buf, sizeof(buf)));
1009 }
6a78764e 1010
d62a17ae 1011 c_oil->installed = 1;
e7cd85bd
SP
1012 c_oil->mroute_creation = pim_time_monotonic_sec();
1013
d62a17ae 1014 return 0;
12e41d03
DL
1015}
1016
d62a17ae 1017int pim_mroute_del(struct channel_oil *c_oil, const char *name)
12e41d03 1018{
9a0f71c9 1019 struct pim_instance *pim = c_oil->pim;
d62a17ae 1020 int err;
1021
856e863f
DS
1022 pim->mroute_del_last = pim_time_monotonic_sec();
1023 ++pim->mroute_del_events;
d62a17ae 1024
1025 if (!c_oil->installed) {
1026 if (PIM_DEBUG_MROUTE) {
1027 char buf[1000];
1028 zlog_debug(
1029 "%s %s: vifi %d for route is %s not installed, do not need to send del req. ",
1030 __FILE__, __PRETTY_FUNCTION__,
1031 c_oil->oil.mfcc_parent,
1032 pim_channel_oil_dump(c_oil, buf, sizeof(buf)));
1033 }
1034 return -2;
1035 }
12e41d03 1036
856e863f 1037 err = setsockopt(pim->mroute_socket, IPPROTO_IP, MRT_DEL_MFC,
d62a17ae 1038 &c_oil->oil, sizeof(c_oil->oil));
1039 if (err) {
1040 if (PIM_DEBUG_MROUTE)
1041 zlog_warn(
1042 "%s %s: failure: setsockopt(fd=%d,IPPROTO_IP,MRT_DEL_MFC): errno=%d: %s",
1043 __FILE__, __PRETTY_FUNCTION__,
856e863f 1044 pim->mroute_socket, errno,
d62a17ae 1045 safe_strerror(errno));
1046 return -2;
1047 }
429a291b 1048
d62a17ae 1049 if (PIM_DEBUG_MROUTE) {
1050 char buf[1000];
996c9314
LB
1051 zlog_debug("%s(%s), vrf %s Deleted Route: %s",
1052 __PRETTY_FUNCTION__, name, pim->vrf->name,
d62fd596 1053 pim_channel_oil_dump(c_oil, buf, sizeof(buf)));
d62a17ae 1054 }
781a1745 1055
d62a17ae 1056 // Reset kernel installed flag
1057 c_oil->installed = 0;
58302dc7 1058
d62a17ae 1059 return 0;
12e41d03 1060}
3667e8a0 1061
d62a17ae 1062void pim_mroute_update_counters(struct channel_oil *c_oil)
3667e8a0 1063{
9a0f71c9 1064 struct pim_instance *pim = c_oil->pim;
d62a17ae 1065 struct sioc_sg_req sgreq;
1066
1067 c_oil->cc.oldpktcnt = c_oil->cc.pktcnt;
1068 c_oil->cc.oldbytecnt = c_oil->cc.bytecnt;
1069 c_oil->cc.oldwrong_if = c_oil->cc.wrong_if;
1070
1071 if (!c_oil->installed) {
19b807ca 1072 c_oil->cc.lastused = 100 * pim->keep_alive_time;
d62a17ae 1073 if (PIM_DEBUG_MROUTE) {
1074 struct prefix_sg sg;
1075
1076 sg.src = c_oil->oil.mfcc_origin;
1077 sg.grp = c_oil->oil.mfcc_mcastgrp;
1078 if (PIM_DEBUG_MROUTE)
1079 zlog_debug(
41714081 1080 "Channel%s is not installed no need to collect data from kernel",
d62a17ae 1081 pim_str_sg_dump(&sg));
1082 }
1083 return;
c7b1183f 1084 }
c7b1183f 1085
d62a17ae 1086 memset(&sgreq, 0, sizeof(sgreq));
1087 sgreq.src = c_oil->oil.mfcc_origin;
1088 sgreq.grp = c_oil->oil.mfcc_mcastgrp;
1089
1090 pim_zlookup_sg_statistics(c_oil);
856e863f 1091 if (ioctl(pim->mroute_socket, SIOCGETSGCNT, &sgreq)) {
d62a17ae 1092 if (PIM_DEBUG_MROUTE) {
1093 struct prefix_sg sg;
1094
1095 sg.src = c_oil->oil.mfcc_origin;
1096 sg.grp = c_oil->oil.mfcc_mcastgrp;
1097
1098 zlog_warn(
41714081 1099 "ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=%s: errno=%d: %s",
d62a17ae 1100 (unsigned long)SIOCGETSGCNT,
1101 pim_str_sg_dump(&sg), errno,
1102 safe_strerror(errno));
1103 }
1104 return;
c7b1183f 1105 }
3667e8a0 1106
d62a17ae 1107 c_oil->cc.pktcnt = sgreq.pktcnt;
1108 c_oil->cc.bytecnt = sgreq.bytecnt;
1109 c_oil->cc.wrong_if = sgreq.wrong_if;
3667e8a0 1110
d62a17ae 1111 return;
3667e8a0 1112}