|
|
049c96 |
From ef78dba44078e9e3f4d995bd04faecacc7dd045e Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Jakub Sitnicki <jkbs@redhat.com>
|
|
|
049c96 |
Date: Wed, 27 Jul 2016 15:56:17 +0200
|
|
|
049c96 |
Subject: [PATCH] ip link: Fix crash on older kernels when show VF dev
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1340914
|
|
|
049c96 |
Upstream Status: iproute2.git commit 8c29ae7
|
|
|
049c96 |
|
|
|
049c96 |
commit 8c29ae7cc2494e251520584e83698c1a9f1912e5
|
|
|
049c96 |
Author: Vadim Kochan <vadim4j@gmail.com>
|
|
|
049c96 |
Date: Fri Jan 9 21:24:31 2015 +0200
|
|
|
049c96 |
|
|
|
049c96 |
ip link: Fix crash on older kernels when show VF dev
|
|
|
049c96 |
|
|
|
049c96 |
The issue was caused that ifla_vf_rate does not exist on
|
|
|
049c96 |
older kernels and should be checked if it exists as nested attr.
|
|
|
049c96 |
|
|
|
049c96 |
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
|
|
|
049c96 |
Reported-by: William Dauchy <william@gandi.net>
|
|
|
049c96 |
Tested-by: William Dauchy <william@gandi.net>
|
|
|
049c96 |
---
|
|
|
049c96 |
ip/ipaddress.c | 18 +++++++++++-------
|
|
|
049c96 |
1 file changed, 11 insertions(+), 7 deletions(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
|
|
|
049c96 |
index 11ff34d..45e747b 100644
|
|
|
049c96 |
--- a/ip/ipaddress.c
|
|
|
049c96 |
+++ b/ip/ipaddress.c
|
|
|
049c96 |
@@ -290,11 +290,10 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
|
|
|
049c96 |
{
|
|
|
049c96 |
struct ifla_vf_mac *vf_mac;
|
|
|
049c96 |
struct ifla_vf_vlan *vf_vlan;
|
|
|
049c96 |
- struct ifla_vf_rate *vf_rate;
|
|
|
049c96 |
struct ifla_vf_tx_rate *vf_tx_rate;
|
|
|
049c96 |
struct ifla_vf_spoofchk *vf_spoofchk;
|
|
|
049c96 |
struct ifla_vf_link_state *vf_linkstate;
|
|
|
049c96 |
- struct rtattr *vf[IFLA_VF_MAX+1];
|
|
|
049c96 |
+ struct rtattr *vf[IFLA_VF_MAX + 1] = {};
|
|
|
049c96 |
struct rtattr *tmp;
|
|
|
049c96 |
SPRINT_BUF(b1);
|
|
|
049c96 |
|
|
|
049c96 |
@@ -308,7 +307,6 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
|
|
|
049c96 |
vf_mac = RTA_DATA(vf[IFLA_VF_MAC]);
|
|
|
049c96 |
vf_vlan = RTA_DATA(vf[IFLA_VF_VLAN]);
|
|
|
049c96 |
vf_tx_rate = RTA_DATA(vf[IFLA_VF_TX_RATE]);
|
|
|
049c96 |
- vf_rate = RTA_DATA(vf[IFLA_VF_RATE]);
|
|
|
049c96 |
|
|
|
049c96 |
/* Check if the spoof checking vf info type is supported by
|
|
|
049c96 |
* this kernel.
|
|
|
049c96 |
@@ -344,10 +342,16 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
|
|
|
049c96 |
fprintf(fp, ", qos %d", vf_vlan->qos);
|
|
|
049c96 |
if (vf_tx_rate->rate)
|
|
|
049c96 |
fprintf(fp, ", tx rate %d (Mbps)", vf_tx_rate->rate);
|
|
|
049c96 |
- if (vf_rate->max_tx_rate)
|
|
|
049c96 |
- fprintf(fp, ", max_tx_rate %dMbps", vf_rate->max_tx_rate);
|
|
|
049c96 |
- if (vf_rate->min_tx_rate)
|
|
|
049c96 |
- fprintf(fp, ", min_tx_rate %dMbps", vf_rate->min_tx_rate);
|
|
|
049c96 |
+
|
|
|
049c96 |
+ if (vf[IFLA_VF_RATE]) {
|
|
|
049c96 |
+ struct ifla_vf_rate *vf_rate = RTA_DATA(vf[IFLA_VF_RATE]);
|
|
|
049c96 |
+
|
|
|
049c96 |
+ if (vf_rate->max_tx_rate)
|
|
|
049c96 |
+ fprintf(fp, ", max_tx_rate %dMbps", vf_rate->max_tx_rate);
|
|
|
049c96 |
+ if (vf_rate->min_tx_rate)
|
|
|
049c96 |
+ fprintf(fp, ", min_tx_rate %dMbps", vf_rate->min_tx_rate);
|
|
|
049c96 |
+ }
|
|
|
049c96 |
+
|
|
|
049c96 |
if (vf_spoofchk && vf_spoofchk->setting != -1) {
|
|
|
049c96 |
if (vf_spoofchk->setting)
|
|
|
049c96 |
fprintf(fp, ", spoof checking on");
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|