diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/cnic.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 45584442a35c..0defe61d5bf3 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -2860,8 +2860,8 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr) | |||
2860 | { | 2860 | { |
2861 | struct cnic_dev *dev = csk->dev; | 2861 | struct cnic_dev *dev = csk->dev; |
2862 | struct cnic_local *cp = dev->cnic_priv; | 2862 | struct cnic_local *cp = dev->cnic_priv; |
2863 | int is_v6, err, rc = -ENETUNREACH; | 2863 | int is_v6, rc = 0; |
2864 | struct dst_entry *dst; | 2864 | struct dst_entry *dst = NULL; |
2865 | struct net_device *realdev; | 2865 | struct net_device *realdev; |
2866 | u32 local_port; | 2866 | u32 local_port; |
2867 | 2867 | ||
@@ -2877,39 +2877,31 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr) | |||
2877 | clear_bit(SK_F_IPV6, &csk->flags); | 2877 | clear_bit(SK_F_IPV6, &csk->flags); |
2878 | 2878 | ||
2879 | if (is_v6) { | 2879 | if (is_v6) { |
2880 | #if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE)) | ||
2881 | set_bit(SK_F_IPV6, &csk->flags); | 2880 | set_bit(SK_F_IPV6, &csk->flags); |
2882 | err = cnic_get_v6_route(&saddr->remote.v6, &dst); | 2881 | cnic_get_v6_route(&saddr->remote.v6, &dst); |
2883 | if (err) | ||
2884 | return err; | ||
2885 | |||
2886 | if (!dst || dst->error || !dst->dev) | ||
2887 | goto err_out; | ||
2888 | 2882 | ||
2889 | memcpy(&csk->dst_ip[0], &saddr->remote.v6.sin6_addr, | 2883 | memcpy(&csk->dst_ip[0], &saddr->remote.v6.sin6_addr, |
2890 | sizeof(struct in6_addr)); | 2884 | sizeof(struct in6_addr)); |
2891 | csk->dst_port = saddr->remote.v6.sin6_port; | 2885 | csk->dst_port = saddr->remote.v6.sin6_port; |
2892 | local_port = saddr->local.v6.sin6_port; | 2886 | local_port = saddr->local.v6.sin6_port; |
2893 | #else | ||
2894 | return rc; | ||
2895 | #endif | ||
2896 | 2887 | ||
2897 | } else { | 2888 | } else { |
2898 | err = cnic_get_v4_route(&saddr->remote.v4, &dst); | 2889 | cnic_get_v4_route(&saddr->remote.v4, &dst); |
2899 | if (err) | ||
2900 | return err; | ||
2901 | |||
2902 | if (!dst || dst->error || !dst->dev) | ||
2903 | goto err_out; | ||
2904 | 2890 | ||
2905 | csk->dst_ip[0] = saddr->remote.v4.sin_addr.s_addr; | 2891 | csk->dst_ip[0] = saddr->remote.v4.sin_addr.s_addr; |
2906 | csk->dst_port = saddr->remote.v4.sin_port; | 2892 | csk->dst_port = saddr->remote.v4.sin_port; |
2907 | local_port = saddr->local.v4.sin_port; | 2893 | local_port = saddr->local.v4.sin_port; |
2908 | } | 2894 | } |
2909 | 2895 | ||
2910 | csk->vlan_id = cnic_get_vlan(dst->dev, &realdev); | 2896 | csk->vlan_id = 0; |
2911 | if (realdev != dev->netdev) | 2897 | csk->mtu = dev->netdev->mtu; |
2912 | goto err_out; | 2898 | if (dst && dst->dev) { |
2899 | u16 vlan = cnic_get_vlan(dst->dev, &realdev); | ||
2900 | if (realdev == dev->netdev) { | ||
2901 | csk->vlan_id = vlan; | ||
2902 | csk->mtu = dst_mtu(dst); | ||
2903 | } | ||
2904 | } | ||
2913 | 2905 | ||
2914 | if (local_port >= CNIC_LOCAL_PORT_MIN && | 2906 | if (local_port >= CNIC_LOCAL_PORT_MIN && |
2915 | local_port < CNIC_LOCAL_PORT_MAX) { | 2907 | local_port < CNIC_LOCAL_PORT_MAX) { |
@@ -2927,9 +2919,6 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr) | |||
2927 | } | 2919 | } |
2928 | csk->src_port = local_port; | 2920 | csk->src_port = local_port; |
2929 | 2921 | ||
2930 | csk->mtu = dst_mtu(dst); | ||
2931 | rc = 0; | ||
2932 | |||
2933 | err_out: | 2922 | err_out: |
2934 | dst_release(dst); | 2923 | dst_release(dst); |
2935 | return rc; | 2924 | return rc; |