Do not request IPV6 routing info 60/72260/2
authorLuc Provoost <luc.provoost@intel.com>
Tue, 23 Mar 2021 12:22:53 +0000 (13:22 +0100)
committerLuc Provoost <luc.provoost@intel.com>
Thu, 25 Mar 2021 14:44:11 +0000 (15:44 +0100)
PROX is not yet dealing with IPV6 routing info (only IPV4). Hence we got
a segmentation fault when receiving such information. In a previous
commit, we are checking for IPV4 routing info and we do not continue
processing of any other routing information. With this fix, we ask the
Linux OS NOT to provide IPV6 routing info.
The checks when receiving routing information have changed so that we only
treat IPV4 and nothing else.

Change-Id: I428a036c31014377c8de08da17e51740be0e1de5
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
VNFs/DPPD-PROX/handle_master.c

index 606b76f..8f80ed8 100644 (file)
@@ -969,7 +969,7 @@ void init_ctrl_plane(struct task_base *tbase)
        struct sockaddr_nl sockaddr2;
        memset(&sockaddr2, 0, sizeof(struct sockaddr_nl));
        sockaddr2.nl_family = AF_NETLINK;
-       sockaddr2.nl_groups = RTMGRP_IPV6_ROUTE | RTMGRP_IPV4_ROUTE | RTMGRP_NOTIFY;
+       sockaddr2.nl_groups = RTMGRP_IPV4_ROUTE | RTMGRP_NOTIFY;
        rc = bind(fd, (struct sockaddr *)&sockaddr2, sizeof(struct sockaddr_nl));
        PROX_PANIC(rc < 0, "Failed to bind to RTMGRP_NEIGH netlink group\n");
        task->route_fds.fd = fd;
@@ -1012,12 +1012,12 @@ static void handle_route_event(struct task_base *tbase)
 
        struct rtmsg *rtmsg = (struct rtmsg *)NLMSG_DATA(nl_hdr);
        int rtm_family = rtmsg->rtm_family;
-       if ((rtm_family == AF_INET) && (rtmsg->rtm_table != RT_TABLE_MAIN) &&(rtmsg->rtm_table != RT_TABLE_LOCAL))
-               return;
-       if (rtm_family == AF_INET6) {
-               plog_warn("Unhandled IPV6 routing message\n");
+       if (rtm_family != AF_INET) {
+               plog_warn("Unhandled non IPV4 routing message\n");
                return;
        }
+       if ((rtmsg->rtm_table != RT_TABLE_MAIN) && (rtmsg->rtm_table != RT_TABLE_LOCAL))
+               return;
        int dst_len = rtmsg->rtm_dst_len;
 
        struct rtattr *rta = (struct rtattr *)RTM_RTA(rtmsg);