On 4/9/19 10:31 PM, Govindarajulu Varadarajan wrote:
> However this worked
> 
> @@ -1096,7 +1096,7 @@ static int fib_check_nh(struct fib_config *cfg,
> struct fib_nh *nh,
>         u32 table = cfg->fc_table;
>         int err;
> 
> -       if (nh->fib_nh_gw_family == AF_INET)
> +       if (nh->fib_nh_gw4)
>                 err = fib_check_nh_v4_gw(net, nh, table, cfg->fc_scope, 
> extack);
>         else if (nh->fib_nh_gw_family == AF_INET6)
>                 err = fib_check_nh_v6_gw(net, nh, table, extack);
> 

since fib_nh_gw4 is a union that cannot be used without checking the
family first. You need this part as well (previous hunk was for mpath
routes):

diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 310060e67790..d4b63f94f7be 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -755,8 +755,9 @@ static int rtm_to_fib_config(struct net *net, struct
sk_buff *skb,
                        break;
                case RTA_GATEWAY:
                        has_gw = true;
-                       cfg->fc_gw_family = AF_INET;
                        cfg->fc_gw4 = nla_get_be32(attr);
+                       if (cfg->fc_gw4)
+                               cfg->fc_gw_family = AF_INET;
                        break;
                case RTA_VIA:
                        has_via = true;

Reply via email to