Skip to content

Commit 01b4623

Browse files
authored
Merge pull request #463 from cjdoucette/getlink_fix
cps: fix bugs in RTM_GETLINK response
2 parents 951750e + 6a92946 commit 01b4623

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cps/kni.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040

4141
#define KNI_MODULE_NAME ("rte_kni")
4242

43+
/* Defined in the kernel headers, but not included in net/if.h. */
44+
#define IFF_LOWER_UP (1<<16)
45+
4346
/*
4447
* According to init_module(2) and delete_module(2), there
4548
* are no declarations for these functions in header files.
@@ -233,7 +236,7 @@ modify_link(struct mnl_socket *nl, struct rte_kni *kni,
233236
ifm->ifi_change = IFF_UP;
234237
ifm->ifi_flags = flags;
235238

236-
mnl_attr_put_str(nlh, IFLA_IFNAME, kni_name);
239+
mnl_attr_put_strz(nlh, IFLA_IFNAME, kni_name);
237240

238241
/*
239242
* The KNI library registers callbacks for MTU changes and
@@ -1225,10 +1228,10 @@ rd_fill_getlink_reply(const struct cps_config *cps_conf,
12251228
ifim->ifi_family = AF_UNSPEC;
12261229
ifim->ifi_type = ARPHRD_ETHER;
12271230
ifim->ifi_index = kni_index;
1228-
ifim->ifi_flags = 0;
1231+
ifim->ifi_flags = IFF_UP|IFF_LOWER_UP;
12291232
ifim->ifi_change = 0xFFFFFFFF;
12301233

1231-
mnl_attr_put_str(reply, IFLA_IFNAME, kni_name);
1234+
mnl_attr_put_strz(reply, IFLA_IFNAME, kni_name);
12321235
mnl_attr_put_u32(reply, IFLA_MTU, kni_mtu);
12331236
}
12341237

0 commit comments

Comments
 (0)