On 01/22/2015 07:14 AM, Chris Leech wrote:
> Send getlink requests when running into a pre-existing VLAN, to kick the code
> in the newlink handler to keep moving forward.
>
> This is an ugly hack. Part of the problem is the filtering of reported
> interfaces so fipvlan forgets about existing vlans. Part of it is that
> create_and_start_vlan wants to ignore vlans already in the interface list as
> something it's already dealt with, when in auto mode without filtering they
> might have been in the initial getlink dump.
> ---
> fipvlan.c | 7 ++++++-
> include/rtnetlink.h | 1 +
> lib/rtnetlink.c | 2 +-
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fipvlan.c b/fipvlan.c
> index ccba914..e8d3769 100644
> --- a/fipvlan.c
> +++ b/fipvlan.c
> @@ -630,12 +630,17 @@ create_vlan(struct fcf *fcf, bool vn2vn)
> if (vlan) {
> FIP_LOG_DBG("VLAN %s.%d already exists as %s\n",
> real_dev->ifname, fcf->vlan, vlan->ifname);
> + rtnl_send_getlink(pfd[0].fd, 0, vlan->ifname);
> return 0;
> }
> snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
> real_dev->ifname, fcf->vlan, config.suffix);
> rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
> - if (rc < 0) {
> + if (rc == -EEXIST) {
> + printf("VLAN device %s already exists\n", vlan_name);
> + rtnl_send_getlink(pfd[0].fd, 0, vlan_name);
> + return 0;
> + } else if (rc < 0) {
> printf("Failed to create VLAN device %s\n\t%s\n",
> vlan_name, strerror(-rc));
> return rc;
> diff --git a/include/rtnetlink.h b/include/rtnetlink.h
> index b4fd1c8..447a546 100644
> --- a/include/rtnetlink.h
> +++ b/include/rtnetlink.h
> @@ -23,6 +23,7 @@
> int rtnl_socket(void);
> typedef int rtnl_handler(struct nlmsghdr *nh, void *arg);
> int rtnl_recv(int s, rtnl_handler *fn, void *arg);
> +ssize_t rtnl_send_getlink(int s, int ifindex, char *name);
> ssize_t send_getlink_dump(int s);
> int rtnl_set_iff_up(int ifindex, char *ifname);
> int rtnl_set_iff_down(int ifindex, char *ifname);
> diff --git a/lib/rtnetlink.c b/lib/rtnetlink.c
> index 08552bf..b464b18 100644
> --- a/lib/rtnetlink.c
> +++ b/lib/rtnetlink.c
> @@ -337,7 +337,7 @@ out:
> return rc;
> }
>
> -static ssize_t rtnl_send_getlink(int s, int ifindex, char *name)
> +ssize_t rtnl_send_getlink(int s, int ifindex, char *name)
> {
> struct {
> struct nlmsghdr nh;
>
:-)
Told you so.
As you've deleted the handler in the last patch you have to
retrigger netlink to actually get an event.
Please do not do this.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
[email protected] +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
_______________________________________________
fcoe-devel mailing list
[email protected]
http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel