summaryrefslogtreecommitdiff
path: root/pimd/pim_pim.c
AgeCommit message (Collapse)Author
2020-02-13*: Remove break after returnDonatas Abraitis
Just a deadcode. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-19pimd: Fix possible read beyond end of data receivedDonald Sharp
If a register packet is received that is less than the PIM_MSG_REGISTER_LEN in size we can have a possible situation where the data being checksummed is just random data from the buffer we read into. 2019/11/18 21:45:46 warnings: PIM: int pim_if_add_vif(struct interface *, _Bool, _Bool): could not get address for interface fuzziface ifindex=0 ==27636== Invalid read of size 4 ==27636== at 0x4E6EB0D: in_cksum (checksum.c:28) ==27636== by 0x4463CC: pim_pim_packet (pim_pim.c:194) ==27636== by 0x40E2B4: main (pim_main.c:117) ==27636== Address 0x771f818 is 0 bytes after a block of size 24 alloc'd ==27636== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==27636== by 0x40E261: main (pim_main.c:112) ==27636== Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-23pimd: Mark Default TOS Values for PIM & IGMP Outgoing packetsSatheesh Kumar K
This will facilitate the Hardware to prefer control packets over Normal Data packets while queuing, so that during congestion, the chance of dropping control packet will be minimised. Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-05-14pimd: PIM Bootstrap packet processingsaravanank
1. Packet validation as per RFC 5059 Sec 3.1.3 We won't supporting scope zone BSM as of now, they are dropped now. Order of the check slightly be changed in code for optimization. if ((DirectlyConnected(BSM.src_ip_address) == FALSE) OR (we have no Hello state for BSM.src_ip_address)) { drop the Bootstrap message silently } if (BSM.dst_ip_address == ALL-PIM-ROUTERS) { if (BSM.no_forward_bit == 0) { if (BSM.src_ip_address != RPF_neighbor(BSM.BSR_ip_address)) { drop the Bootstrap message silently } } else if ((any previous BSM for this scope has been accepted) OR (more than BS_Period has elapsed since startup)) { #only accept no-forward BSM if quick refresh on startup drop the Bootstrap message silently } } else if ((Unicast BSM support enabled) AND (BSM.dst_ip_address is one of my addresses)) { if ((any previous BSM for this scope has been accepted) OR (more than BS_Period has elapsed since startup)) { #the packet was unicast, but this wasn't #a quick refresh on startup drop the Bootstrap message silently } } else { drop the Bootstrap message silently } 2. Nexthop tracking registration for BSR 3. RPF check for BSR Message. Zebra Lookup based rpf check for new BSR NHT cache(pnc) based lookup for old BSR Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-05-14pimd: PIM Msg header includes N bit as defined by RFCsaravanank
This commit includes parsing of Nbit and contructing pim hdr with Nbit Adding Nbit to PIm hdr structure Adding Scope zone bit and Bidir bit to Encoded IPv4 Group Address Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-01-04pimd: Move packet_process variable to pim_routerDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04pimd: Create a `struct pim_router` and move thread master into itDonald Sharp
Create a `struct pim_router` and move the thread master into it. Future commits will further move global varaibles into the pim_router structure. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-13*: style for EC replacementsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13pimd: PIM_[ERR|WARN] -> EC_PIMQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-12pimd ripd ripngd: variable shadowing fixesF. Aragon
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-08-28pimd: Add some more useful data to debug outputDonald Sharp
End user was seeing this debug but we are not giving the user enough information to debug this on his own. Add a tiny bit of extra information that could point the user to solving the problem for themselves. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23zebra: if multiple connecteds, select loopback or vrf if presentDon Slice
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14pimd: Add pim_errors and define some pim specific errorsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-20bgpd isisd ldpd lib ospfd pimd: redundancy (infer)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-04-30pimd: Cleanup pim_if_is_loopbackDonald Sharp
The interface itself knows if it is a vrf device or not, so let's just use a check for that in the decision if a interface is a loopback or not. Additionally modify function to return a bool. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Fix crash when looking up incoming interfaceDonald Sharp
It is possible that the incoming interface lookup will fail because we are in transition from one vrf to another. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: When we are initializing a pim socket limit hellosDonald Sharp
When we are initializing a pim socket for vrf or loopback interfaces do not schedule a hello to go out at all. I'm currently leaving the check on is a vrf / loopback device on the actual send as that we have several paths to get there. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Ensure packet received on vrf interface is configured for pimDonald Sharp
In a vrf configuration, when we receive a pim packet we lookup the correct incoming interface. There exists a chance that the correct incoming interface has not been configured to use pim yet. gracefully bow out and do nothing with the packet. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Reschedule the correct interface for incoming packetsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Trust the recvfromto ifindex informationDonald Sharp
The vrf interface is receiving the pim packet instead of the slave interface that is bound. Lookup the ifindex ifp pointer from that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Don't send hello's out vrf interfaceDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Cleanup pim_pim use of pimgDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Remove pimg from pim_register.cDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Cleanup use of VRF_DEFAULT to pimg->vrf_idDonald Sharp
Use the appropriate vrf_id instead of always defaulting to VRF_DEFAULT Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-17pimd: Thread changes allow pim to crash a booDonald Sharp
When we add a thread pointer to thread_add_XXX functions when the specified function is called, thread.c is setting the thread pointer to NULL. This was causing pim to liberally pull it's zassert grenade pin's. Additionally clean up code to not set the NULL pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-09*: remove THREAD_ON macros, add nullity checkQuentin Young
The way thread.c is written, a caller who wishes to be able to cancel a thread or avoid scheduling it twice must keep a reference to the thread. Typically this is done with a long lived pointer whose value is checked for null in order to know if the thread is currently scheduled. The check-and-schedule idiom is so common that several wrapper macros in thread.h existed solely to provide it. This patch removes those macros and adds a new parameter to all thread_add_* functions which is a pointer to the struct thread * to store the result of a scheduling call. If the value passed is non-null, the thread will only be scheduled if the value is null. This helps with consistency. A Coccinelle spatch has been used to transform code of the form: if (t == NULL) t = thread_add_* (...) to the form thread_add_* (..., &t) The THREAD_ON macros have also been transformed to the underlying thread.c calls. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-05Merge branch 'master' into pim_5549Donald Sharp
2017-03-31pimd: Cleanup unused variable writeDonald Sharp
There exists a common pattern in pim where we were setting a variable to a value in the error case when we would no longer need it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-30pimd: Send v6 secondary addresses to neighbors in helloDonald Sharp
Send v6 secondary addresses to our neighbor in hello's. Additionally allow the disabling it via the cli introduced earlier. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15*: Remove non-vrf based ifindex lookupDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24pimd: Trust the compilerDonald Sharp
When we set a variable to NULL, there is no need to assert on it the following line. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24pimd: Remove unnecessary ip header length checks on receipt.Donald Sharp
The kernel will not hand us a malformed packet. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24pimd: Remove unnecessary check in packet process pathDonald Sharp
When we get a packet from the network for pim, we do not need to check to see that it is a pim packet, since that is what we've asked to receive. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24pimd: Assume buffer size passed in is of sufficient sizeDonald Sharp
For: pim_msg_build_header pim_msg_addr_encode_ipv4_ucast pim_msg_addr_encode_ipv4_group pim_msg_addr_encode_ipv4_source Assume that the buffer size passed in is of sufficient size already. This is assured already because buffer sizes are checked for minimum lengths for the entire packet ahead of time. So we are double checking. Additionally at scale we will be calling these functions a very very large number of times. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24pimd: Add 'struct pim_msg_header' packed data structure.Donald Sharp
Add the 'struct pim_msg_header' and convert all places that encoded/decoded the message header to use it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-14pimd: Allow IPDEFTTL to be used for omniosDonald Sharp
The omnios OS has no IPDEFTTL defined. Add the ability to handle it for this one case. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-14pimd: messages to neighbors should have TTL = 1Chirag Shah
Ticket:CM-12924 Reviewed By:shapd Testing Done: configure PIM neighbor, verify PIM hello packet dump for ttl to be 1. Set TTL to 1 for outgoing multicast control packets destine to ALL-PIM-ROUTERS as oppose to unicast mcast packets. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-02-14pimd: non-null register checksum incorrectChirag Shah
Ticket: CM-12041 Reviewed By: sharpd, CCR-5556 Testing Done: Tested on Local setup generating PIM Register (Data/Null) and processing both Tx/Rx with correct checksum. Provided quagga debian to submitter and checksum cases passed on submitter setup. 1. PIM Register msg checksum only accounts for 8 bytes (4 bytes for PIM header and next 4 byetes before data payload). In PIM header checksum calculation checked PIM packet type (in this case REGISTER type) then only pass 8 bytes as length rather than full packet length. 2. PIM Register Rx path also handled with 8 byte and full pim lenth checksum. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-02-03pimd: Refactor pim_sock_open to just need the ifp pointerDonald Sharp
In all cases pim_sock_open was called, we just passed in the pim_ifp->primary_address, which is accessible from the interface pointer. So just pass that in. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03pimd: Allow a interface in a vrf to be configured.Donald Sharp
This fixes the issue a crash when we have configured an interface inside of a vrf, and apply pim commands to it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17Merge remote-tracking branch 'origin/master' into pim_lib_work2Donald Sharp
2016-12-21pimd: Reset neighbor hold time when we receive packetDonald Sharp
When we receive a packet from a neighbor, reset the hold time as that we *know* that they are still alive. During heavy packet load, we were seeing cases where neighbors were being reset because we were timing out due to not processing the hello packet in time. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Add guard for pim_msg_send_frameDonald Sharp
In certain error conditions it is possible to attempt to send packets when the socket is not ready instead of dumping to the log a million error messages only note the issue if we have packet debugs on. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Lower Hello sent to be immediateDonald Sharp
There exists situations where an interface flaps and routing recovers and we attempt to install an upstream but since we have no neighbor out that interface still. Let's cause the hello to go out immediately for the 3.1 release to allow mrouting to recover in this situation. We will need to revisit this issue after we have proper nexthop tracking in place Ticket: CM-13185 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21pimd: Add knob to control # of packets read in at one timeDonald Sharp
Add 'ip pim packets <1-100>' command. Allows you to control the number of packets read in before giving control back to another part of the process. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Modify pim_sock_read to read 3 times before yieldingDonald Sharp
Modify pim_sock_read to read up to 3 packets before yielding the cpu to something else. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21pimd: Further refine debugs in pim_sock_read pathDonald Sharp
When we received a packet we were dumping packet information with debugs on 2 times for each packet where we had overlapping data being passed. Since debugs are expensive, reduce the count to 1. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>