On Wed, Feb 22, 2012 at 02:23:38PM -0800, Ethan Jackson wrote: > Looks good to me.
Thanks, I pushed it. > I wonder if it makes sense or is possible to generalize this and use > it to print vlog debug messages in rtnetlink-link. We don't have a > precedent for logging in that file so maybe it isn't worth it. Not > sure how useful it would be. It probably makes sense. I'm not going to rush to do it. If you want to put it on that to-do list of yours feel free :-) > On Tue, Feb 14, 2012 at 13:12, Ben Pfaff <b...@nicira.com> wrote: > > This was useful for observing IFF_RUNNING change as I removed and inserted > > cables. > > > > (nlmon is a test utility that doesn't get installed.) > > > > Signed-off-by: Ben Pfaff <b...@nicira.com> > > --- > > utilities/nlmon.c | 34 +++++++++++++++++++++++++++++++++- > > 1 files changed, 33 insertions(+), 1 deletions(-) > > > > diff --git a/utilities/nlmon.c b/utilities/nlmon.c > > index b6396d5..1b2f1e2 100644 > > --- a/utilities/nlmon.c > > +++ b/utilities/nlmon.c > > @@ -1,5 +1,5 @@ > > /* > > - * Copyright (c) 2009, 2010, 2011 Nicira Networks. > > + * Copyright (c) 2009, 2010, 2011, 2012 Nicira Networks. > > * > > * Licensed under the Apache License, Version 2.0 (the "License"); > > * you may not use this file except in compliance with the License. > > @@ -66,9 +66,34 @@ main(int argc OVS_UNUSED, char *argv[]) > > } else if (error) { > > ovs_fatal(error, "error on network monitor socket"); > > } else { > > + struct iff_flag { > > + unsigned int flag; > > + const char *name; > > + }; > > + > > + static const struct iff_flag flags[] = { > > + { IFF_UP, "UP", }, > > + { IFF_BROADCAST, "BROADCAST", }, > > + { IFF_DEBUG, "DEBUG", }, > > + { IFF_LOOPBACK, "LOOPBACK", }, > > + { IFF_POINTOPOINT, "POINTOPOINT", }, > > + { IFF_NOTRAILERS, "NOTRAILERS", }, > > + { IFF_RUNNING, "RUNNING", }, > > + { IFF_NOARP, "NOARP", }, > > + { IFF_PROMISC, "PROMISC", }, > > + { IFF_ALLMULTI, "ALLMULTI", }, > > + { IFF_MASTER, "MASTER", }, > > + { IFF_SLAVE, "SLAVE", }, > > + { IFF_MULTICAST, "MULTICAST", }, > > + { IFF_PORTSEL, "PORTSEL", }, > > + { IFF_AUTOMEDIA, "AUTOMEDIA", }, > > + { IFF_DYNAMIC, "DYNAMIC", }, > > + }; > > + > > struct nlattr *attrs[ARRAY_SIZE(rtnlgrp_link_policy)]; > > struct nlmsghdr *nlh; > > struct ifinfomsg *iim; > > + int i; > > > > nlh = ofpbuf_at(buf, 0, NLMSG_HDRLEN); > > iim = ofpbuf_at(buf, NLMSG_HDRLEN, sizeof *iim); > > @@ -92,6 +117,13 @@ main(int argc OVS_UNUSED, char *argv[]) > > : nlh->nlmsg_type == RTM_GETLINK ? "RTM_GETLINK" > > : nlh->nlmsg_type == RTM_SETLINK ? "RTM_SETLINK" > > : "other")); > > + printf("\tflags:"); > > + for (i = 0; i < ARRAY_SIZE(flags); i++) { > > + if (iim->ifi_flags & flags[i].flag) { > > + printf(" %s", flags[i].name); > > + } > > + } > > + printf("\n"); > > if (attrs[IFLA_MASTER]) { > > uint32_t idx = nl_attr_get_u32(attrs[IFLA_MASTER]); > > char ifname[IFNAMSIZ]; > > -- > > 1.7.2.5 > > > > _______________________________________________ > > dev mailing list > > dev@openvswitch.org > > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev