How to set priority in a bridge...kernel version 3.5.0
Hello,
I have tried to create bridge using sk = nl_socket_alloc(); if ((err = nl_connect(sk, NETLINK_ROUTE)) < 0) { nl_perror(err, "Unable to connect socket"); return err; }
link1 = rtnl_link_alloc();
if ((err = rtnl_link_set_type(link1, "bridge")) < 0) { nl_perror(err, "Unable to set link info type"); return err; } rtnl_link_set_name(link1, "br0"); //rtnl_link_set_link(link, master_index);
if ((err = rtnl_link_add(sk, link1, NLM_F_CREATE)) < 0) { nl_perror(err, "Unable to add link"); return err; } rtnl_link_put(link1);
nl_close(sk);
It works fine but when I access the link from link_cache and trying to set BRIDGE PRIORITY or check rtnl_link_is_bridge(link)...It does not work.
if ((err = rtnl_link_alloc_cache(sk, AF_UNSPEC, &link_cache)) < 0) { nl_perror(err, "Unable to allocate cache"); return err; }
link1=rtnl_link_get_by_name(link_cache, "br0");
int k = rtnl_link_is_bridge(link1);
printf("\nsuccess %d\n",k );
k = rtnl_link_bridge_set_priority(link1,300);
printf("\nsuccess %d\n",k );
It shows Assertion '0' failed and no changes in bridge configuration...it could not able to detect AF_BRIDGE...
my kernel version is 3.5.0-23-generic ....
please help me out..
Thanks