Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions zebra/rtadv.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,10 @@ static int rtadv_make_socket(ns_id_t ns_id)
struct icmp6_filter filter;
int error;

/* Limit receive buffer size to avoid unbounded growth under abnormal load */
/* 20MB provides enough headroom for RS/RA bursts while capping memory usage */
#define RTADV_RCVBUF_SIZE (20 * 1024 * 1024)

frr_with_privs(&zserv_privs) {

sock = ns_socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6, ns_id);
Expand All @@ -1004,6 +1008,9 @@ static int rtadv_make_socket(ns_id_t ns_id)
return -1;
}

/* Limit RTADV socket receive buffer */
setsockopt_so_recvbuf(sock, RTADV_RCVBUF_SIZE);

ret = setsockopt_ipv6_pktinfo(sock, 1);
if (ret < 0) {
zlog_warn("RTADV failure to set Packet Information");
Expand Down
Loading