From: Joe Perches Date: Mon, 30 Aug 2010 07:24:53 +0000 (-0700) Subject: treewide: Remove trailing whitespace X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d295e8e97acae13552a5b220d3fbcff8201064a2;p=openvswitch treewide: Remove trailing whitespace Signed-off-by: Joe Perches Acked-by: Simon Horman Signed-off-by: Jesse Gross --- diff --git a/datapath/actions.c b/datapath/actions.c index 53e05872..b75aecda 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -122,7 +122,7 @@ static struct sk_buff *modify_vlan_tci(struct datapath *dp, struct sk_buff *skb, if (unlikely(err)) { kfree_skb(skb); return ERR_PTR(err); - } + } /* GSO is not implemented for packets with an 802.1Q header, so * we have to do segmentation before we add that header. diff --git a/datapath/brcompat.c b/datapath/brcompat.c index 44b2c992..f68b698c 100644 --- a/datapath/brcompat.c +++ b/datapath/brcompat.c @@ -252,7 +252,7 @@ static int brc_get_port_list(struct net_device *dev, int __user *uindices, * (limited to a page for sanity) * offset -- number of records to skip */ -static int brc_get_fdb_entries(struct net_device *dev, void __user *userbuf, +static int brc_get_fdb_entries(struct net_device *dev, void __user *userbuf, unsigned long maxnum, unsigned long offset) { struct nlattr *attrs[BRC_GENL_A_MAX + 1]; @@ -370,7 +370,7 @@ static int brc_genl_query(struct sk_buff *skb, struct genl_info *info) void *data; ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!ans_skb) + if (!ans_skb) return -ENOMEM; data = genlmsg_put_reply(ans_skb, info, &brc_genl_family, @@ -530,15 +530,15 @@ static int __init brc_init(void) goto error; err = genl_register_ops(&brc_genl_family, &brc_genl_ops_query_dp); - if (err != 0) + if (err != 0) goto err_unregister; err = genl_register_ops(&brc_genl_family, &brc_genl_ops_dp_result); - if (err != 0) + if (err != 0) goto err_unregister; err = genl_register_ops(&brc_genl_family, &brc_genl_ops_set_proc); - if (err != 0) + if (err != 0) goto err_unregister; strcpy(brc_mc_group.name, "brcompat"); diff --git a/datapath/datapath.c b/datapath/datapath.c index a34049f9..4f15ea0c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -754,7 +754,7 @@ void compute_ip_summed(struct sk_buff *skb, bool xmit) skb->ip_summed); /* None seems the safest... */ OVS_CB(skb)->ip_summed = OVS_CSUM_NONE; - } + } #if defined(CONFIG_XEN) && defined(HAVE_PROTO_DATA_VALID) /* Xen has a special way of representing CHECKSUM_PARTIAL on older @@ -2283,7 +2283,7 @@ ssize_t openvswitch_read(struct file *f, char __user *buf, size_t nbytes, } success: copy_bytes = tot_copy_bytes = min_t(size_t, skb->len, nbytes); - + retval = 0; if (skb->ip_summed == CHECKSUM_PARTIAL) { if (copy_bytes == skb->len) { diff --git a/datapath/dp_notify.c b/datapath/dp_notify.c index e0bd14c5..b6bb90ec 100644 --- a/datapath/dp_notify.c +++ b/datapath/dp_notify.c @@ -14,8 +14,8 @@ #include "vport-internal_dev.h" #include "vport-netdev.h" -static int dp_device_event(struct notifier_block *unused, unsigned long event, - void *ptr) +static int dp_device_event(struct notifier_block *unused, unsigned long event, + void *ptr) { struct net_device *dev = ptr; struct vport *vport; diff --git a/datapath/dp_sysfs_dp.c b/datapath/dp_sysfs_dp.c index 74d0ed0b..9f0c0adb 100644 --- a/datapath/dp_sysfs_dp.c +++ b/datapath/dp_sysfs_dp.c @@ -75,7 +75,7 @@ static ssize_t store_bridge_parm(DEVICE_PARAMS, /* xxx We use a default value of 0 for all fields. If the caller is * xxx attempting to set the value to our default, just silently - * xxx ignore the request. + * xxx ignore the request. */ if (val != 0) { struct datapath *dp; @@ -84,7 +84,7 @@ static ssize_t store_bridge_parm(DEVICE_PARAMS, dp = sysfs_get_dp(to_net_dev(d)); if (dp) - printk("%s: xxx writing dp parms not supported yet!\n", + printk("%s: xxx writing dp parms not supported yet!\n", dp_name(dp)); else result = -ENODEV; diff --git a/datapath/dp_sysfs_if.c b/datapath/dp_sysfs_if.c index 3c842172..b40523aa 100644 --- a/datapath/dp_sysfs_if.c +++ b/datapath/dp_sysfs_if.c @@ -187,7 +187,7 @@ static ssize_t brport_store(struct kobject * kobj, if (!capable(CAP_NET_ADMIN)) return -EPERM; - printk("%s: xxx writing port parms not supported yet!\n", + printk("%s: xxx writing port parms not supported yet!\n", dp_name(p->dp)); return ret; diff --git a/datapath/flow.c b/datapath/flow.c index b80e0e29..dbfe5dd7 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -153,7 +153,7 @@ void flow_deferred_free(struct sw_flow *flow) /* RCU callback used by flow_deferred_free_acts. */ static void rcu_free_acts_callback(struct rcu_head *rcu) { - struct sw_flow_actions *sf_acts = container_of(rcu, + struct sw_flow_actions *sf_acts = container_of(rcu, struct sw_flow_actions, rcu); kfree(sf_acts); } @@ -346,7 +346,7 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key) key->nw_proto = ntohs(arp->ar_op); } - if (key->nw_proto == ARPOP_REQUEST + if (key->nw_proto == ARPOP_REQUEST || key->nw_proto == ARPOP_REPLY) { memcpy(&key->nw_src, arp->ar_sip, sizeof(key->nw_src)); memcpy(&key->nw_dst, arp->ar_tip, sizeof(key->nw_dst)); diff --git a/datapath/linux-2.6/compat-2.6/include/linux/dmi.h b/datapath/linux-2.6/compat-2.6/include/linux/dmi.h index 52916fec..01d4396f 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/dmi.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/dmi.h @@ -80,7 +80,7 @@ struct dmi_device { }; /* No CONFIG_DMI before 2.6.16 */ -#if defined(CONFIG_DMI) || defined(CONFIG_X86_32) +#if defined(CONFIG_DMI) || defined(CONFIG_X86_32) extern int dmi_check_system(struct dmi_system_id *list); extern char * dmi_get_system_info(int field); @@ -111,4 +111,4 @@ static inline int dmi_name_in_vendors(char *s) { return 0; } #endif /* linux kernel < 2.6.22 */ -#endif +#endif diff --git a/datapath/linux-2.6/compat-2.6/include/linux/mutex.h b/datapath/linux-2.6/compat-2.6/include/linux/mutex.h index 93dfa3b2..020a2809 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/mutex.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/mutex.h @@ -50,10 +50,10 @@ static inline void mutex_unlock(struct mutex *lock) { up(&lock->sema); } -#else +#else #include_next #endif /* linux version < 2.6.16 */ -#endif +#endif diff --git a/datapath/linux-2.6/compat-2.6/include/linux/netfilter_bridge.h b/datapath/linux-2.6/compat-2.6/include/linux/netfilter_bridge.h index 1c8183c8..c526537e 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/netfilter_bridge.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/netfilter_bridge.h @@ -21,4 +21,4 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) #endif /* linux version < 2.6.22 */ -#endif +#endif diff --git a/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h b/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h index 01a22d84..9cd7e1d5 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h @@ -101,7 +101,7 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) -/* Emulate Linux 2.6.17 and later behavior, in which kfree_skb silently ignores +/* Emulate Linux 2.6.17 and later behavior, in which kfree_skb silently ignores * null pointer arguments. */ #define kfree_skb(skb) kfree_skb_maybe_null(skb) static inline void kfree_skb_maybe_null(struct sk_buff *skb) diff --git a/datapath/linux-2.6/compat-2.6/include/net/genetlink.h b/datapath/linux-2.6/compat-2.6/include/net/genetlink.h index 57a47316..4f203662 100644 --- a/datapath/linux-2.6/compat-2.6/include/net/genetlink.h +++ b/datapath/linux-2.6/compat-2.6/include/net/genetlink.h @@ -11,7 +11,7 @@ #include /*---------------------------------------------------------------------------- - * In 2.6.23, registering of multicast groups was added. Our compatability + * In 2.6.23, registering of multicast groups was added. Our compatability * layer just supports registering a single group, since that's all we * need. */ @@ -59,7 +59,7 @@ static inline int genlmsg_total_size(int payload) #define genlmsg_multicast(s, p, g, f) \ genlmsg_multicast_flags((s), (p), (g), (f)) -static inline int genlmsg_multicast_flags(struct sk_buff *skb, u32 pid, +static inline int genlmsg_multicast_flags(struct sk_buff *skb, u32 pid, unsigned int group, gfp_t flags) { int err; diff --git a/datapath/linux-2.6/compat-2.6/time.c b/datapath/linux-2.6/compat-2.6/time.c index b07ee267..ad3ee944 100644 --- a/datapath/linux-2.6/compat-2.6/time.c +++ b/datapath/linux-2.6/compat-2.6/time.c @@ -4,7 +4,7 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) -/* "set_normalized_timespec" is defined but not exported in kernels +/* "set_normalized_timespec" is defined but not exported in kernels * before 2.6.26. */ /** @@ -21,7 +21,7 @@ * 0 <= tv_nsec < NSEC_PER_SEC * For negative values only the tv_sec field is negative ! */ -void set_normalized_timespec(struct timespec *ts, +void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec) { while (nsec >= NSEC_PER_SEC) { diff --git a/datapath/vport-capwap.c b/datapath/vport-capwap.c index 80fe3091..59fb0510 100644 --- a/datapath/vport-capwap.c +++ b/datapath/vport-capwap.c @@ -223,7 +223,7 @@ static int capwap_init(void) err = sock_create(AF_INET, SOCK_DGRAM, 0, &capwap_rcv_socket); if (err) goto error; - + sin.sin_family = AF_INET; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(CAPWAP_DST_PORT); diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h index 839c4846..5759f1e5 100644 --- a/include/openvswitch/datapath-protocol.h +++ b/include/openvswitch/datapath-protocol.h @@ -226,7 +226,7 @@ struct odp_flow_key { uint8_t dl_src[6]; /* Ethernet source address. */ uint8_t dl_dst[6]; /* Ethernet destination address. */ uint8_t nw_proto; /* IP protocol or lower 8 bits of - ARP opcode. */ + ARP opcode. */ uint8_t dl_vlan_pcp; /* Input VLAN priority. */ uint8_t nw_tos; /* IP ToS (DSCP field, 6 bits). */ uint8_t reserved[3]; /* Align to 32-bits...must be zeroed. */ diff --git a/lib/classifier.c b/lib/classifier.c index 4bd89421..378faf8e 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -353,8 +353,8 @@ classifier_find_rule_exactly(const struct classifier *cls, return NULL; } -/* Checks if the flow defined by 'target' with 'wildcards' at 'priority' - * overlaps with any other rule at the same priority in the classifier. +/* Checks if the flow defined by 'target' with 'wildcards' at 'priority' + * overlaps with any other rule at the same priority in the classifier. * Two rules are considered overlapping if a packet could match both. */ bool classifier_rule_overlaps(const struct classifier *cls, @@ -379,7 +379,7 @@ classifier_rule_overlaps(const struct classifier *cls, LIST_FOR_EACH (rule, struct cls_rule, node.list, &bucket->rules) { - if (rule->priority == priority + if (rule->priority == priority && rules_match_2wild(rule, &target_rule, 0)) { return true; } @@ -828,10 +828,10 @@ static bool rules_match_2wild(const struct cls_rule *wild1, const struct cls_rule *wild2, int field_idx) { - return rules_match(wild1, wild2, - wild1->wc.wildcards | wild2->wc.wildcards, + return rules_match(wild1, wild2, + wild1->wc.wildcards | wild2->wc.wildcards, wild1->wc.nw_src_mask & wild2->wc.nw_src_mask, - wild1->wc.nw_dst_mask & wild2->wc.nw_dst_mask, + wild1->wc.nw_dst_mask & wild2->wc.nw_dst_mask, field_idx); } diff --git a/lib/classifier.h b/lib/classifier.h index 35516022..f522f0e5 100644 --- a/lib/classifier.h +++ b/lib/classifier.h @@ -148,7 +148,7 @@ struct cls_rule *classifier_lookup_wild(const struct classifier *, const flow_t *); struct cls_rule *classifier_lookup_exact(const struct classifier *, const flow_t *); -bool classifier_rule_overlaps(const struct classifier *, const flow_t *, +bool classifier_rule_overlaps(const struct classifier *, const flow_t *, uint32_t wildcards, unsigned int priority); typedef void cls_cb_func(struct cls_rule *, void *aux); diff --git a/lib/command-line.c b/lib/command-line.c index 17344c36..23ed53fb 100644 --- a/lib/command-line.c +++ b/lib/command-line.c @@ -29,7 +29,7 @@ long_options_to_short_options(const struct option options[]) { char short_options[UCHAR_MAX * 3 + 1]; char *p = short_options; - + for (; options->name; options++) { const struct option *o = options; if (o->flag == NULL && o->val > 0 && o->val <= UCHAR_MAX) { @@ -43,7 +43,7 @@ long_options_to_short_options(const struct option options[]) } } *p = '\0'; - + return xstrdup(short_options); } diff --git a/lib/coverage.c b/lib/coverage.c index 6e65810e..8a9d0ea6 100644 --- a/lib/coverage.c +++ b/lib/coverage.c @@ -123,7 +123,7 @@ coverage_log_counter(enum vlog_level level, const struct coverage_counter *c) } /* Logs the coverage counters at the given vlog 'level'. If - * 'suppress_dups' is true, then duplicate events are not displayed. + * 'suppress_dups' is true, then duplicate events are not displayed. * Care should be taken in the value used for 'level'. Depending on the * configuration, syslog can write changes synchronously, which can * cause the coverage messages to take several seconds to write. */ diff --git a/lib/daemon.c b/lib/daemon.c index cb2f8c20..54865046 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -59,7 +59,7 @@ static bool monitor; /* Returns the file name that would be used for a pidfile if 'name' were * provided to set_pidfile(). The caller must free the returned string. */ char * -make_pidfile_name(const char *name) +make_pidfile_name(const char *name) { return (!name ? xasprintf("%s/%s.pid", ovs_rundir, program_name) diff --git a/lib/dhcp-client.c b/lib/dhcp-client.c index 961994a2..1cdd8585 100644 --- a/lib/dhcp-client.c +++ b/lib/dhcp-client.c @@ -851,7 +851,7 @@ state_transition(struct dhclient *cli, enum dhclient_state state) bool am_bound; if (cli->state != state) { - VLOG_DBG("%s: entering %s", cli_name, state_name(state)); + VLOG_DBG("%s: entering %s", cli_name, state_name(state)); cli->state = state; } cli->state_entered = time_now(); @@ -980,7 +980,7 @@ do_receive_msg(struct dhclient *cli, struct dhcp_msg *msg) if (!error) { if (VLOG_IS_DBG_ENABLED()) { VLOG_DBG_RL(&rl, "%s: received %s", cli_name, - dhcp_msg_to_string(msg, false, &cli->s)); + dhcp_msg_to_string(msg, false, &cli->s)); } else { VLOG_INFO_RL(&rl, "%s: received %s", cli_name, dhcp_type_name(msg->type)); @@ -1062,7 +1062,7 @@ do_send_msg(struct dhclient *cli, const struct dhcp_msg *msg) if (b.size <= ETH_TOTAL_MAX) { if (VLOG_IS_DBG_ENABLED()) { VLOG_DBG("%s: sending %s", - cli_name, dhcp_msg_to_string(msg, false, &cli->s)); + cli_name, dhcp_msg_to_string(msg, false, &cli->s)); } else { VLOG_INFO("%s: sending %s", cli_name, dhcp_type_name(msg->type)); } diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index ade658d8..08a72134 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -1082,7 +1082,7 @@ dp_netdev_wait(void) /* Modify the TCI field of 'packet'. If a VLAN tag is not present, one - * is added with the TCI field set to 'tci'. If a VLAN tag is present, + * is added with the TCI field set to 'tci'. If a VLAN tag is present, * then 'mask' bits are cleared before 'tci' is logically OR'd into the * TCI field. * diff --git a/lib/dpif.c b/lib/dpif.c index 40741a45..01e905d9 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -321,7 +321,7 @@ dpif_close(struct dpif *dpif) if (dpif) { struct registered_dpif_class *registered_class; - registered_class = shash_find_data(&dpif_classes, + registered_class = shash_find_data(&dpif_classes, dpif->dpif_class->type); assert(registered_class); assert(registered_class->refcount); diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c index 180a4301..5f8054a4 100644 --- a/lib/dynamic-string.c +++ b/lib/dynamic-string.c @@ -32,7 +32,7 @@ ds_init(struct ds *ds) } void -ds_clear(struct ds *ds) +ds_clear(struct ds *ds) { ds->length = 0; } @@ -162,7 +162,7 @@ ds_put_format_valist(struct ds *ds, const char *format, va_list args_) } void -ds_put_printable(struct ds *ds, const char *s, size_t n) +ds_put_printable(struct ds *ds, const char *s, size_t n) { ds_reserve(ds, ds->length + n); while (n-- > 0) { @@ -189,7 +189,7 @@ ds_put_strftime(struct ds *ds, const char *template, const struct tm *tm) ds->length += used; return; } - ds_reserve(ds, ds->length + (avail < 32 ? 64 : 2 * avail)); + ds_reserve(ds, ds->length + (avail < 32 ? 64 : 2 * avail)); } } diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c index d9442a3e..3f118f8a 100644 --- a/lib/fatal-signal.c +++ b/lib/fatal-signal.c @@ -249,7 +249,7 @@ fatal_signal_unlink_file_now(const char *file) static void unlink_files(void *aux OVS_UNUSED) { - do_unlink_files(); + do_unlink_files(); } static void diff --git a/lib/flow.c b/lib/flow.c index 1fab02fd..462df08c 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -53,7 +53,7 @@ pull_ip(struct ofpbuf *packet) } static struct tcp_header * -pull_tcp(struct ofpbuf *packet) +pull_tcp(struct ofpbuf *packet) { if (packet->size >= TCP_HEADER_LEN) { struct tcp_header *tcp = packet->data; @@ -66,13 +66,13 @@ pull_tcp(struct ofpbuf *packet) } static struct udp_header * -pull_udp(struct ofpbuf *packet) +pull_udp(struct ofpbuf *packet) { return ofpbuf_try_pull(packet, UDP_HEADER_LEN); } static struct icmp_header * -pull_icmp(struct ofpbuf *packet) +pull_icmp(struct ofpbuf *packet) { return ofpbuf_try_pull(packet, ICMP_HEADER_LEN); } @@ -213,7 +213,7 @@ flow_extract(struct ofpbuf *packet, uint32_t tun_id, uint16_t in_port, } else if (flow->dl_type == htons(ETH_TYPE_ARP)) { const struct arp_eth_header *arp = pull_arp(&b); if (arp && arp->ar_hrd == htons(1) - && arp->ar_pro == htons(ETH_TYPE_IP) + && arp->ar_pro == htons(ETH_TYPE_IP) && arp->ar_hln == ETH_ADDR_LEN && arp->ar_pln == 4) { /* We only match on the lower 8 bits of the opcode. */ @@ -221,7 +221,7 @@ flow_extract(struct ofpbuf *packet, uint32_t tun_id, uint16_t in_port, flow->nw_proto = ntohs(arp->ar_op); } - if ((flow->nw_proto == ARP_OP_REQUEST) + if ((flow->nw_proto == ARP_OP_REQUEST) || (flow->nw_proto == ARP_OP_REPLY)) { flow->nw_src = arp->ar_spa; flow->nw_dst = arp->ar_tpa; @@ -235,7 +235,7 @@ flow_extract(struct ofpbuf *packet, uint32_t tun_id, uint16_t in_port, * arguments must have been initialized through a call to flow_extract(). */ void -flow_extract_stats(const flow_t *flow, struct ofpbuf *packet, +flow_extract_stats(const flow_t *flow, struct ofpbuf *packet, struct odp_flow_stats *stats) { memset(stats, '\0', sizeof(*stats)); @@ -346,7 +346,7 @@ flow_format(struct ds *ds, const flow_t *flow) } void -flow_print(FILE *stream, const flow_t *flow) +flow_print(FILE *stream, const flow_t *flow) { char *s = flow_to_string(flow); fputs(s, stream); diff --git a/lib/flow.h b/lib/flow.h index 058404c8..603c4ace 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -34,7 +34,7 @@ struct ofpbuf; typedef struct odp_flow_key flow_t; int flow_extract(struct ofpbuf *, uint32_t tun_id, uint16_t in_port, flow_t *); -void flow_extract_stats(const flow_t *flow, struct ofpbuf *packet, +void flow_extract_stats(const flow_t *flow, struct ofpbuf *packet, struct odp_flow_stats *stats); void flow_to_match(const flow_t *, uint32_t wildcards, bool tun_id_cookie, struct ofp_match *); diff --git a/lib/learning-switch.c b/lib/learning-switch.c index 88a8618c..e189f1e4 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -63,7 +63,7 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300); static void queue_tx(struct lswitch *, struct rconn *, struct ofpbuf *); static void send_features_request(struct lswitch *, struct rconn *); -static void send_default_flows(struct lswitch *sw, struct rconn *rconn, +static void send_default_flows(struct lswitch *sw, struct rconn *rconn, FILE *default_flows); typedef void packet_handler_func(struct lswitch *, struct rconn *, void *); @@ -249,7 +249,7 @@ send_features_request(struct lswitch *sw, struct rconn *rconn) } static void -send_default_flows(struct lswitch *sw, struct rconn *rconn, +send_default_flows(struct lswitch *sw, struct rconn *rconn, FILE *default_flows) { char line[1024]; @@ -260,20 +260,20 @@ send_default_flows(struct lswitch *sw, struct rconn *rconn, uint16_t priority, idle_timeout, hard_timeout; uint64_t cookie; struct ofp_match match; - + char *comment; - + /* Delete comments. */ comment = strchr(line, '#'); - if (comment) { + if (comment) { *comment = '\0'; } - + /* Drop empty lines. */ if (line[strspn(line, " \t\n")] == '\0') { continue; - } - + } + /* Parse and send. str_to_flow() will expand and reallocate the data * in 'buffer', so we can't keep pointers to across the str_to_flow() * call. */ diff --git a/lib/learning-switch.h b/lib/learning-switch.h index e66001ac..96707b84 100644 --- a/lib/learning-switch.h +++ b/lib/learning-switch.h @@ -25,7 +25,7 @@ struct ofpbuf; struct rconn; struct lswitch *lswitch_create(struct rconn *, bool learn_macs, - bool exact_flows, int max_idle, + bool exact_flows, int max_idle, bool action_normal, FILE *default_flows); void lswitch_set_queue(struct lswitch *sw, uint32_t queue); void lswitch_run(struct lswitch *); diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index f7d9cd3b..e6036bfc 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -1008,7 +1008,7 @@ netdev_linux_update_is_pseudo(struct netdev_dev_linux *netdev_dev) if (!(netdev_dev->cache_valid & VALID_IS_PSEUDO)) { const char *name = netdev_dev_get_name(&netdev_dev->netdev_dev); const char *type = netdev_dev_get_type(&netdev_dev->netdev_dev); - + netdev_dev->is_tap = !strcmp(type, "tap"); netdev_dev->is_internal = false; if (!netdev_dev->is_tap) { @@ -1872,7 +1872,7 @@ netdev_linux_get_next_hop(const struct in_addr *host, struct in_addr *next_hop, iface, &dest, &gateway, &flags, &refcnt, &use, &metric, &mask, &mtu, &window, &irtt) != 11) { - VLOG_WARN_RL(&rl, "%s: could not parse line %d: %s", + VLOG_WARN_RL(&rl, "%s: could not parse line %d: %s", fn, ln, line); continue; } @@ -1882,7 +1882,7 @@ netdev_linux_get_next_hop(const struct in_addr *host, struct in_addr *next_hop, } /* The output of 'dest', 'mask', and 'gateway' were given in - * network byte order, so we don't need need any endian + * network byte order, so we don't need need any endian * conversions here. */ if ((dest & mask) == (host->s_addr & mask)) { if (!gateway) { diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index 619ba8be..c0ed4ef6 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -40,7 +40,7 @@ struct arg { * implementations. */ struct netdev_dev { char *name; /* Name of network device. */ - const struct netdev_class *netdev_class; /* Functions to control + const struct netdev_class *netdev_class; /* Functions to control this device. */ int ref_cnt; /* Times this devices was opened. */ struct shash_node *node; /* Pointer to element in global map. */ diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 96834115..0153ac78 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -31,7 +31,7 @@ VLOG_DEFINE_THIS_MODULE(netdev_vport) struct netdev_vport_notifier { struct netdev_notifier notifier; struct list list_node; - struct shash_node *shash_node; + struct shash_node *shash_node; }; static struct shash netdev_vport_notifiers = diff --git a/lib/netdev.c b/lib/netdev.c index 371bc205..24c2a88f 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -208,7 +208,7 @@ compare_device_args(const struct netdev_dev *dev, const struct shash *args) new_args = shash_sort(args); for (i = 0; i < dev->n_args; i++) { - if (strcmp(dev->args[i].key, new_args[i]->name) || + if (strcmp(dev->args[i].key, new_args[i]->name) || strcmp(dev->args[i].value, new_args[i]->data)) { result = false; goto finish; @@ -327,7 +327,7 @@ netdev_open(struct netdev_options *options, struct netdev **netdevp) return EINVAL; } - error = netdev_dev->netdev_class->open(netdev_dev, options->ethertype, + error = netdev_dev->netdev_class->open(netdev_dev, options->ethertype, netdevp); if (!error) { @@ -729,7 +729,7 @@ netdev_get_in4(const struct netdev *netdev, int error; error = (netdev_get_dev(netdev)->netdev_class->get_in4 - ? netdev_get_dev(netdev)->netdev_class->get_in4(netdev, + ? netdev_get_dev(netdev)->netdev_class->get_in4(netdev, &address, &netmask) : EOPNOTSUPP); if (address_) { @@ -804,7 +804,7 @@ netdev_get_in6(const struct netdev *netdev, struct in6_addr *in6) int error; error = (netdev_get_dev(netdev)->netdev_class->get_in6 - ? netdev_get_dev(netdev)->netdev_class->get_in6(netdev, + ? netdev_get_dev(netdev)->netdev_class->get_in6(netdev, in6 ? in6 : &dummy) : EOPNOTSUPP); if (error && in6) { @@ -825,7 +825,7 @@ do_update_flags(struct netdev *netdev, enum netdev_flags off, enum netdev_flags old_flags; int error; - error = netdev_get_dev(netdev)->netdev_class->update_flags(netdev, + error = netdev_get_dev(netdev)->netdev_class->update_flags(netdev, off & ~on, on, &old_flags); if (error) { VLOG_WARN_RL(&rl, "failed to %s flags for network device %s: %s", @@ -900,7 +900,7 @@ netdev_arp_lookup(const struct netdev *netdev, uint32_t ip, uint8_t mac[ETH_ADDR_LEN]) { int error = (netdev_get_dev(netdev)->netdev_class->arp_lookup - ? netdev_get_dev(netdev)->netdev_class->arp_lookup(netdev, + ? netdev_get_dev(netdev)->netdev_class->arp_lookup(netdev, ip, mac) : EOPNOTSUPP); if (error) { @@ -915,7 +915,7 @@ int netdev_get_carrier(const struct netdev *netdev, bool *carrier) { int error = (netdev_get_dev(netdev)->netdev_class->get_carrier - ? netdev_get_dev(netdev)->netdev_class->get_carrier(netdev, + ? netdev_get_dev(netdev)->netdev_class->get_carrier(netdev, carrier) : EOPNOTSUPP); if (error) { @@ -961,7 +961,7 @@ netdev_set_policing(struct netdev *netdev, uint32_t kbits_rate, uint32_t kbits_burst) { return (netdev_get_dev(netdev)->netdev_class->set_policing - ? netdev_get_dev(netdev)->netdev_class->set_policing(netdev, + ? netdev_get_dev(netdev)->netdev_class->set_policing(netdev, kbits_rate, kbits_burst) : EOPNOTSUPP); } @@ -1254,7 +1254,7 @@ int netdev_get_vlan_vid(const struct netdev *netdev, int *vlan_vid) { int error = (netdev_get_dev(netdev)->netdev_class->get_vlan_vid - ? netdev_get_dev(netdev)->netdev_class->get_vlan_vid(netdev, + ? netdev_get_dev(netdev)->netdev_class->get_vlan_vid(netdev, vlan_vid) : ENOENT); if (error) { @@ -1419,7 +1419,7 @@ netdev_uninit(struct netdev *netdev, bool close) } -/* Returns the class type of 'netdev'. +/* Returns the class type of 'netdev'. * * The caller must not free the returned value. */ const char * diff --git a/lib/netlink.c b/lib/netlink.c index 2f7bc0a1..4e83747c 100644 --- a/lib/netlink.c +++ b/lib/netlink.c @@ -57,7 +57,7 @@ struct nl_sock }; /* Next nlmsghdr sequence number. - * + * * This implementation uses sequence numbers that are unique process-wide, to * avoid a hypothetical race: send request, close socket, open new socket that * reuses the old socket's PID value, send request on new socket, receive reply @@ -185,7 +185,7 @@ error: /* Destroys netlink socket 'sock'. */ void -nl_sock_destroy(struct nl_sock *sock) +nl_sock_destroy(struct nl_sock *sock) { if (sock) { close(sock->fd); @@ -202,7 +202,7 @@ nl_sock_destroy(struct nl_sock *sock) * 'wait' is true, then the send will wait until buffer space is ready; * otherwise, returns EAGAIN if the 'sock' send buffer is full. */ int -nl_sock_send(struct nl_sock *sock, const struct ofpbuf *msg, bool wait) +nl_sock_send(struct nl_sock *sock, const struct ofpbuf *msg, bool wait) { struct nlmsghdr *nlmsg = nl_msg_nlmsghdr(msg); int error; @@ -230,7 +230,7 @@ nl_sock_send(struct nl_sock *sock, const struct ofpbuf *msg, bool wait) * returns EAGAIN if the 'sock' send buffer is full. */ int nl_sock_sendv(struct nl_sock *sock, const struct iovec iov[], size_t n_iov, - bool wait) + bool wait) { struct msghdr msg; int error; @@ -262,7 +262,7 @@ nl_sock_sendv(struct nl_sock *sock, const struct iovec iov[], size_t n_iov, * If 'wait' is true, nl_sock_recv waits for a message to be ready; otherwise, * returns EAGAIN if the 'sock' receive buffer is empty. */ int -nl_sock_recv(struct nl_sock *sock, struct ofpbuf **bufp, bool wait) +nl_sock_recv(struct nl_sock *sock, struct ofpbuf **bufp, bool wait) { uint8_t tmp; ssize_t bufsize = 2048; @@ -286,13 +286,13 @@ nl_sock_recv(struct nl_sock *sock, struct ofpbuf **bufp, bool wait) try_again: /* Attempt to read the message. We don't know the size of the data * yet, so we take a guess at 2048. If we're wrong, we keep trying - * and doubling the buffer size each time. + * and doubling the buffer size each time. */ nlmsghdr = ofpbuf_put_uninit(buf, bufsize); iov.iov_base = nlmsghdr; iov.iov_len = bufsize; do { - nbytes = recvmsg(sock->fd, &msg, (wait ? 0 : MSG_DONTWAIT) | MSG_PEEK); + nbytes = recvmsg(sock->fd, &msg, (wait ? 0 : MSG_DONTWAIT) | MSG_PEEK); } while (nbytes < 0 && errno == EINTR); if (nbytes < 0) { ofpbuf_delete(buf); @@ -356,11 +356,11 @@ try_again: * * Bare Netlink is an unreliable transport protocol. This function layers * reliable delivery and reply semantics on top of bare Netlink. - * + * * In Netlink, sending a request to the kernel is reliable enough, because the * kernel will tell us if the message cannot be queued (and we will in that * case put it on the transmit queue and wait until it can be delivered). - * + * * Receiving the reply is the real problem: if the socket buffer is full when * the kernel tries to send the reply, the reply will be dropped. However, the * kernel sets a flag that a reply has been dropped. The next call to recv @@ -382,7 +382,7 @@ try_again: */ int nl_sock_transact(struct nl_sock *sock, - const struct ofpbuf *request, struct ofpbuf **replyp) + const struct ofpbuf *request, struct ofpbuf **replyp) { uint32_t seq = nl_msg_nlmsghdr(request)->nlmsg_seq; struct nlmsghdr *nlmsghdr; @@ -396,7 +396,7 @@ nl_sock_transact(struct nl_sock *sock, /* Ensure that we get a reply even if this message doesn't ordinarily call * for one. */ nl_msg_nlmsghdr(request)->nlmsg_flags |= NLM_F_ACK; - + send: retval = nl_sock_send(sock, request, true); if (retval) { @@ -596,7 +596,7 @@ nl_sock_wait(const struct nl_sock *sock, short int events) * * 'msg' must be at least as large as a nlmsghdr. */ struct nlmsghdr * -nl_msg_nlmsghdr(const struct ofpbuf *msg) +nl_msg_nlmsghdr(const struct ofpbuf *msg) { return ofpbuf_at_assert(msg, 0, NLMSG_HDRLEN); } @@ -606,7 +606,7 @@ nl_msg_nlmsghdr(const struct ofpbuf *msg) * Returns a null pointer if 'msg' is not large enough to contain an nlmsghdr * and a genlmsghdr. */ struct genlmsghdr * -nl_msg_genlmsghdr(const struct ofpbuf *msg) +nl_msg_genlmsghdr(const struct ofpbuf *msg) { return ofpbuf_at(msg, NLMSG_HDRLEN, GENL_HDRLEN); } @@ -617,7 +617,7 @@ nl_msg_genlmsghdr(const struct ofpbuf *msg) * * 'msg' must be at least as large as a nlmsghdr. */ bool -nl_msg_nlmsgerr(const struct ofpbuf *msg, int *errorp) +nl_msg_nlmsgerr(const struct ofpbuf *msg, int *errorp) { if (nl_msg_nlmsghdr(msg)->nlmsg_type == NLMSG_ERROR) { struct nlmsgerr *err = ofpbuf_at(msg, NLMSG_HDRLEN, sizeof *err); @@ -640,7 +640,7 @@ nl_msg_nlmsgerr(const struct ofpbuf *msg, int *errorp) /* Ensures that 'b' has room for at least 'size' bytes plus netlink padding at * its tail end, reallocating and copying its data if necessary. */ void -nl_msg_reserve(struct ofpbuf *msg, size_t size) +nl_msg_reserve(struct ofpbuf *msg, size_t size) { ofpbuf_prealloc_tailroom(msg, NLMSG_ALIGN(size)); } @@ -665,7 +665,7 @@ nl_msg_reserve(struct ofpbuf *msg, size_t size) * message. */ void nl_msg_put_nlmsghdr(struct ofpbuf *msg, - size_t expected_payload, uint32_t type, uint32_t flags) + size_t expected_payload, uint32_t type, uint32_t flags) { struct nlmsghdr *nlmsghdr; @@ -719,7 +719,7 @@ nl_msg_put_genlmsghdr(struct ofpbuf *msg, size_t expected_payload, * the tail end of 'msg'. Data in 'msg' is reallocated and copied if * necessary. */ void -nl_msg_put(struct ofpbuf *msg, const void *data, size_t size) +nl_msg_put(struct ofpbuf *msg, const void *data, size_t size) { memcpy(nl_msg_put_uninit(msg, size), data, size); } @@ -728,12 +728,12 @@ nl_msg_put(struct ofpbuf *msg, const void *data, size_t size) * end of 'msg', reallocating and copying its data if necessary. Returns a * pointer to the first byte of the new data, which is left uninitialized. */ void * -nl_msg_put_uninit(struct ofpbuf *msg, size_t size) +nl_msg_put_uninit(struct ofpbuf *msg, size_t size) { size_t pad = NLMSG_ALIGN(size) - size; char *p = ofpbuf_put_uninit(msg, size + pad); if (pad) { - memset(p + size, 0, pad); + memset(p + size, 0, pad); } return p; } @@ -743,7 +743,7 @@ nl_msg_put_uninit(struct ofpbuf *msg, size_t size) * 'msg', reallocating and copying its data if necessary. Returns a pointer to * the first byte of data in the attribute, which is left uninitialized. */ void * -nl_msg_put_unspec_uninit(struct ofpbuf *msg, uint16_t type, size_t size) +nl_msg_put_unspec_uninit(struct ofpbuf *msg, uint16_t type, size_t size) { size_t total_size = NLA_HDRLEN + size; struct nlattr* nla = nl_msg_put_uninit(msg, total_size); @@ -759,7 +759,7 @@ nl_msg_put_unspec_uninit(struct ofpbuf *msg, uint16_t type, size_t size) * attribute, which is left uninitialized. */ void nl_msg_put_unspec(struct ofpbuf *msg, uint16_t type, - const void *data, size_t size) + const void *data, size_t size) { memcpy(nl_msg_put_unspec_uninit(msg, type, size), data, size); } @@ -768,7 +768,7 @@ nl_msg_put_unspec(struct ofpbuf *msg, uint16_t type, * (Some Netlink protocols use the presence or absence of an attribute as a * Boolean flag.) */ void -nl_msg_put_flag(struct ofpbuf *msg, uint16_t type) +nl_msg_put_flag(struct ofpbuf *msg, uint16_t type) { nl_msg_put_unspec(msg, type, NULL, 0); } @@ -776,7 +776,7 @@ nl_msg_put_flag(struct ofpbuf *msg, uint16_t type) /* Appends a Netlink attribute of the given 'type' and the given 8-bit 'value' * to 'msg'. */ void -nl_msg_put_u8(struct ofpbuf *msg, uint16_t type, uint8_t value) +nl_msg_put_u8(struct ofpbuf *msg, uint16_t type, uint8_t value) { nl_msg_put_unspec(msg, type, &value, sizeof value); } @@ -875,7 +875,7 @@ nl_msg_next(struct ofpbuf *buffer, struct ofpbuf *msg) /* Returns the first byte in the payload of attribute 'nla'. */ const void * -nl_attr_get(const struct nlattr *nla) +nl_attr_get(const struct nlattr *nla) { assert(nla->nla_len >= NLA_HDRLEN); return nla + 1; @@ -883,7 +883,7 @@ nl_attr_get(const struct nlattr *nla) /* Returns the number of bytes in the payload of attribute 'nla'. */ size_t -nl_attr_get_size(const struct nlattr *nla) +nl_attr_get_size(const struct nlattr *nla) { assert(nla->nla_len >= NLA_HDRLEN); return nla->nla_len - NLA_HDRLEN; @@ -892,7 +892,7 @@ nl_attr_get_size(const struct nlattr *nla) /* Asserts that 'nla''s payload is at least 'size' bytes long, and returns the * first byte of the payload. */ const void * -nl_attr_get_unspec(const struct nlattr *nla, size_t size) +nl_attr_get_unspec(const struct nlattr *nla, size_t size) { assert(nla->nla_len >= NLA_HDRLEN + size); return nla + 1; @@ -901,7 +901,7 @@ nl_attr_get_unspec(const struct nlattr *nla, size_t size) /* Returns true if 'nla' is nonnull. (Some Netlink protocols use the presence * or absence of an attribute as a Boolean flag.) */ bool -nl_attr_get_flag(const struct nlattr *nla) +nl_attr_get_flag(const struct nlattr *nla) { return nla != NULL; } @@ -913,7 +913,7 @@ nl_attr_get_flag(const struct nlattr *nla) * * Asserts that 'nla''s payload is at least 1 byte long. */ uint8_t -nl_attr_get_u8(const struct nlattr *nla) +nl_attr_get_u8(const struct nlattr *nla) { return NL_ATTR_GET_AS(nla, uint8_t); } @@ -922,7 +922,7 @@ nl_attr_get_u8(const struct nlattr *nla) * * Asserts that 'nla''s payload is at least 2 bytes long. */ uint16_t -nl_attr_get_u16(const struct nlattr *nla) +nl_attr_get_u16(const struct nlattr *nla) { return NL_ATTR_GET_AS(nla, uint16_t); } @@ -931,7 +931,7 @@ nl_attr_get_u16(const struct nlattr *nla) * * Asserts that 'nla''s payload is at least 4 bytes long. */ uint32_t -nl_attr_get_u32(const struct nlattr *nla) +nl_attr_get_u32(const struct nlattr *nla) { return NL_ATTR_GET_AS(nla, uint32_t); } @@ -940,7 +940,7 @@ nl_attr_get_u32(const struct nlattr *nla) * * Asserts that 'nla''s payload is at least 8 bytes long. */ uint64_t -nl_attr_get_u64(const struct nlattr *nla) +nl_attr_get_u64(const struct nlattr *nla) { return NL_ATTR_GET_AS(nla, uint64_t); } @@ -949,7 +949,7 @@ nl_attr_get_u64(const struct nlattr *nla) * * Asserts that 'nla''s payload contains a null-terminated string. */ const char * -nl_attr_get_string(const struct nlattr *nla) +nl_attr_get_string(const struct nlattr *nla) { assert(nla->nla_len > NLA_HDRLEN); assert(memchr(nl_attr_get(nla), '\0', nla->nla_len - NLA_HDRLEN) != NULL); @@ -1093,11 +1093,11 @@ nl_parse_nested(const struct nlattr *nla, const struct nl_policy policy[], /* Miscellaneous. */ -static const struct nl_policy family_policy[CTRL_ATTR_MAX + 1] = { +static const struct nl_policy family_policy[CTRL_ATTR_MAX + 1] = { [CTRL_ATTR_FAMILY_ID] = {.type = NL_A_U16}, }; -static int do_lookup_genl_family(const char *name) +static int do_lookup_genl_family(const char *name) { struct nl_sock *sock; struct ofpbuf request, *reply; @@ -1141,7 +1141,7 @@ static int do_lookup_genl_family(const char *name) * may use '*number' as the family number. On failure, returns a positive * errno value and '*number' caches the errno value. */ int -nl_lookup_genl_family(const char *name, int *number) +nl_lookup_genl_family(const char *name, int *number) { if (*number == 0) { *number = do_lookup_genl_family(name); @@ -1205,7 +1205,7 @@ nlmsghdr_to_string(const struct nlmsghdr *h, struct ds *ds) unsigned int bits; const char *name; }; - static const struct nlmsg_flag flags[] = { + static const struct nlmsg_flag flags[] = { { NLM_F_REQUEST, "REQUEST" }, { NLM_F_MULTI, "MULTI" }, { NLM_F_ACK, "ACK" }, diff --git a/lib/ofp-parse.h b/lib/ofp-parse.h index ea28e7ba..aa0489c0 100644 --- a/lib/ofp-parse.h +++ b/lib/ofp-parse.h @@ -4,16 +4,16 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ - + */ + /* OpenFlow protocol string to flow parser. */ #ifndef OFP_PARSE_H @@ -24,10 +24,10 @@ struct ofp_match; struct ofpbuf; -void parse_ofp_str(char *string, struct ofp_match *match, - struct ofpbuf *actions, uint8_t *table_idx, - uint16_t *out_port, uint16_t *priority, - uint16_t *idle_timeout, uint16_t *hard_timeout, +void parse_ofp_str(char *string, struct ofp_match *match, + struct ofpbuf *actions, uint8_t *table_idx, + uint16_t *out_port, uint16_t *priority, + uint16_t *idle_timeout, uint16_t *hard_timeout, uint64_t *cookie); #endif /* ofp-parse.h */ diff --git a/lib/ofp-print.c b/lib/ofp-print.c index c7130607..87048781 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -93,7 +93,7 @@ ofp_packet_to_string(const void *data, size_t len, size_t total_len OVS_UNUSED) if (WEXITSTATUS(status)) ovs_error(0, "tcpdump exited with status %d", WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { - ovs_error(0, "tcpdump exited with signal %d", WTERMSIG(status)); + ovs_error(0, "tcpdump exited with signal %d", WTERMSIG(status)); } return ds_cstr(&ds); } @@ -141,13 +141,13 @@ ofp_packet_in(struct ds *string, const void *oh, size_t len, int verbosity) } if (verbosity > 1) { char *packet = ofp_packet_to_string(op->data, data_len, - ntohs(op->total_len)); + ntohs(op->total_len)); ds_put_cstr(string, packet); free(packet); } } -static void ofp_print_port_name(struct ds *string, uint16_t port) +static void ofp_print_port_name(struct ds *string, uint16_t port) { const char *name; switch (port) { @@ -207,8 +207,8 @@ ofp_print_nx_action(struct ds *string, const struct nx_action_header *nah) } static int -ofp_print_action(struct ds *string, const struct ofp_action_header *ah, - size_t actions_len) +ofp_print_action(struct ds *string, const struct ofp_action_header *ah, + size_t actions_len) { uint16_t type; size_t len; @@ -279,7 +279,7 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah, } if ((len % 8) != 0) { - ds_put_format(string, + ds_put_format(string, "***action %"PRIu16" length not a multiple of 8***\n", type); return -1; @@ -288,16 +288,16 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah, if (type < ARRAY_SIZE(of_actions)) { const struct openflow_action *act = &of_actions[type]; if ((len < act->min_size) || (len > act->max_size)) { - ds_put_format(string, + ds_put_format(string, "***action %"PRIu16" wrong length: %zu***\n", type, len); return -1; } } - + switch (type) { case OFPAT_OUTPUT: { struct ofp_action_output *oa = (struct ofp_action_output *)ah; - uint16_t port = ntohs(oa->port); + uint16_t port = ntohs(oa->port); if (port < OFPP_MAX) { ds_put_format(string, "output:%"PRIu16, port); } else { @@ -345,14 +345,14 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah, case OFPAT_SET_DL_SRC: { struct ofp_action_dl_addr *da = (struct ofp_action_dl_addr *)ah; - ds_put_format(string, "mod_dl_src:"ETH_ADDR_FMT, + ds_put_format(string, "mod_dl_src:"ETH_ADDR_FMT, ETH_ADDR_ARGS(da->dl_addr)); break; } case OFPAT_SET_DL_DST: { struct ofp_action_dl_addr *da = (struct ofp_action_dl_addr *)ah; - ds_put_format(string, "mod_dl_dst:"ETH_ADDR_FMT, + ds_put_format(string, "mod_dl_dst:"ETH_ADDR_FMT, ETH_ADDR_ARGS(da->dl_addr)); break; } @@ -388,7 +388,7 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah, } case OFPAT_VENDOR: { - struct ofp_action_vendor_header *avh + struct ofp_action_vendor_header *avh = (struct ofp_action_vendor_header *)ah; if (len < sizeof *avh) { ds_put_format(string, "***ofpat_vendor truncated***\n"); @@ -410,9 +410,9 @@ ofp_print_action(struct ds *string, const struct ofp_action_header *ah, return len; } -void +void ofp_print_actions(struct ds *string, const struct ofp_action_header *action, - size_t actions_len) + size_t actions_len) { uint8_t *p = (uint8_t *)action; int len = 0; @@ -425,7 +425,7 @@ ofp_print_actions(struct ds *string, const struct ofp_action_header *action, if (len) { ds_put_cstr(string, ","); } - len = ofp_print_action(string, (struct ofp_action_header *)p, + len = ofp_print_action(string, (struct ofp_action_header *)p, actions_len); if (len < 0) { return; @@ -438,7 +438,7 @@ ofp_print_actions(struct ds *string, const struct ofp_action_header *action, /* Pretty-print the OFPT_PACKET_OUT packet of 'len' bytes at 'oh' to 'string' * at the given 'verbosity' level. */ static void ofp_packet_out(struct ds *string, const void *oh, size_t len, - int verbosity) + int verbosity) { const struct ofp_packet_out *opo = oh; size_t actions_len = ntohs(opo->actions_len); @@ -574,7 +574,7 @@ ofp_print_switch_features(struct ds *string, const void *oh, size_t len, int n_ports; int i; - ds_put_format(string, " ver:0x%x, dpid:%016"PRIx64"\n", + ds_put_format(string, " ver:0x%x, dpid:%016"PRIx64"\n", osf->header.version, ntohll(osf->datapath_id)); ds_put_format(string, "n_tables:%d, n_buffers:%d\n", osf->n_tables, ntohl(osf->n_buffers)); @@ -586,7 +586,7 @@ ofp_print_switch_features(struct ds *string, const void *oh, size_t len, } n_ports = (len - sizeof *osf) / sizeof *osf->ports; - port_list = xmemdup(osf->ports, len - sizeof *osf); + port_list = xmemdup(osf->ports, len - sizeof *osf); qsort(port_list, n_ports, sizeof *port_list, compare_ports); for (i = 0; i < n_ports; i++) { ofp_print_phy_port(string, &port_list[i]); @@ -612,11 +612,11 @@ ofp_print_switch_config(struct ds *string, const void *oh, } static void print_wild(struct ds *string, const char *leader, int is_wild, - int verbosity, const char *format, ...) + int verbosity, const char *format, ...) __attribute__((format(printf, 5, 6))); static void print_wild(struct ds *string, const char *leader, int is_wild, - int verbosity, const char *format, ...) + int verbosity, const char *format, ...) { if (is_wild && verbosity < 2) { return; @@ -742,7 +742,7 @@ ofp_match_to_string(const struct ofp_match *om, int verbosity) /* Pretty-print the OFPT_FLOW_MOD packet of 'len' bytes at 'oh' to 'string' * at the given 'verbosity' level. */ static void -ofp_print_flow_mod(struct ds *string, const void *oh, size_t len, +ofp_print_flow_mod(struct ds *string, const void *oh, size_t len, int verbosity) { const struct ofp_flow_mod *ofm = oh; @@ -768,7 +768,7 @@ ofp_print_flow_mod(struct ds *string, const void *oh, size_t len, ds_put_format(string, " cmd:%d ", ntohs(ofm->command)); } ds_put_format(string, "cookie:0x%"PRIx64" idle:%d hard:%d pri:%d " - "buf:%#x flags:%"PRIx16" ", ntohll(ofm->cookie), + "buf:%#x flags:%"PRIx16" ", ntohll(ofm->cookie), ntohs(ofm->idle_timeout), ntohs(ofm->hard_timeout), ofm->match.wildcards ? ntohs(ofm->priority) : (uint16_t)-1, ntohl(ofm->buffer_id), ntohs(ofm->flags)); @@ -780,7 +780,7 @@ ofp_print_flow_mod(struct ds *string, const void *oh, size_t len, /* Pretty-print the OFPT_FLOW_REMOVED packet of 'len' bytes at 'oh' to 'string' * at the given 'verbosity' level. */ static void -ofp_print_flow_removed(struct ds *string, const void *oh, +ofp_print_flow_removed(struct ds *string, const void *oh, size_t len OVS_UNUSED, int verbosity) { const struct ofp_flow_removed *ofr = oh; @@ -801,13 +801,13 @@ ofp_print_flow_removed(struct ds *string, const void *oh, ds_put_format(string, "**%"PRIu8"**", ofr->reason); break; } - ds_put_format(string, + ds_put_format(string, " cookie0x%"PRIx64" pri%"PRIu16" secs%"PRIu32" nsecs%"PRIu32 - " idle%"PRIu16" pkts%"PRIu64" bytes%"PRIu64"\n", + " idle%"PRIu16" pkts%"PRIu64" bytes%"PRIu64"\n", ntohll(ofr->cookie), ofr->match.wildcards ? ntohs(ofr->priority) : (uint16_t)-1, ntohl(ofr->duration_sec), ntohl(ofr->duration_nsec), - ntohs(ofr->idle_timeout), ntohll(ofr->packet_count), + ntohs(ofr->idle_timeout), ntohll(ofr->packet_count), ntohll(ofr->byte_count)); } @@ -818,7 +818,7 @@ ofp_print_port_mod(struct ds *string, const void *oh, size_t len OVS_UNUSED, const struct ofp_port_mod *opm = oh; ds_put_format(string, "port: %d: addr:"ETH_ADDR_FMT", config: %#x, mask:%#x\n", - ntohs(opm->port_no), ETH_ADDR_ARGS(opm->hw_addr), + ntohs(opm->port_no), ETH_ADDR_ARGS(opm->hw_addr), ntohl(opm->config), ntohl(opm->mask)); ds_put_format(string, " advertise: "); if (opm->advertise) { @@ -904,7 +904,7 @@ lookup_error_code(int type, int code) /* Pretty-print the OFPT_ERROR packet of 'len' bytes at 'oh' to 'string' * at the given 'verbosity' level. */ static void -ofp_print_error_msg(struct ds *string, const void *oh, size_t len, +ofp_print_error_msg(struct ds *string, const void *oh, size_t len, int verbosity OVS_UNUSED) { const struct ofp_error_msg *oem = oh; @@ -958,7 +958,7 @@ ofp_desc_stats_reply(struct ds *string, const void *body, { const struct ofp_desc_stats *ods = body; - ds_put_format(string, "Manufacturer: %.*s\n", + ds_put_format(string, "Manufacturer: %.*s\n", (int) sizeof ods->mfr_desc, ods->mfr_desc); ds_put_format(string, "Hardware: %.*s\n", (int) sizeof ods->hw_desc, ods->hw_desc); @@ -1025,12 +1025,12 @@ ofp_flow_stats_reply(struct ds *string, const void *body_, size_t len, } ds_put_format(string, " cookie=0x%"PRIx64", ", ntohll(fs->cookie)); - ds_put_format(string, "duration_sec=%"PRIu32"s, ", + ds_put_format(string, "duration_sec=%"PRIu32"s, ", ntohl(fs->duration_sec)); - ds_put_format(string, "duration_nsec=%"PRIu32"ns, ", + ds_put_format(string, "duration_nsec=%"PRIu32"ns, ", ntohl(fs->duration_nsec)); ds_put_format(string, "table_id=%"PRIu8", ", fs->table_id); - ds_put_format(string, "priority=%"PRIu16", ", + ds_put_format(string, "priority=%"PRIu16", ", fs->match.wildcards ? ntohs(fs->priority) : (uint16_t)-1); ds_put_format(string, "n_packets=%"PRIu64", ", ntohll(fs->packet_count)); @@ -1077,7 +1077,7 @@ ofp_aggregate_stats_reply(struct ds *string, const void *body_, ds_put_format(string, " flow_count=%"PRIu32, ntohl(asr->flow_count)); } -static void print_port_stat(struct ds *string, const char *leader, +static void print_port_stat(struct ds *string, const char *leader, uint64_t stat, int more) { ds_put_cstr(string, leader); @@ -1154,7 +1154,7 @@ ofp_table_stats_reply(struct ds *string, const void *body, size_t len, ds_put_format(string, "max=%6"PRIu32", ", ntohl(ts->max_entries)); ds_put_format(string, "active=%"PRIu32"\n", ntohl(ts->active_count)); ds_put_cstr(string, " "); - ds_put_format(string, "lookup=%"PRIu64", ", + ds_put_format(string, "lookup=%"PRIu64", ", ntohll(ts->lookup_count)); ds_put_format(string, "matched=%"PRIu64"\n", ntohll(ts->matched_count)); @@ -1225,8 +1225,8 @@ print_stats(struct ds *string, int type, const void *body, size_t body_len, { OFPST_PORT, "port", - { sizeof(struct ofp_port_stats_request), - sizeof(struct ofp_port_stats_request), + { sizeof(struct ofp_port_stats_request), + sizeof(struct ofp_port_stats_request), ofp_port_stats_request }, { 0, SIZE_MAX, ofp_port_stats_reply }, }, @@ -1315,7 +1315,7 @@ ofp_echo(struct ds *string, const void *oh, size_t len, int verbosity) ds_put_format(string, " %zu bytes of payload\n", len - sizeof *hdr); if (verbosity > 1) { - ds_put_hex_dump(string, hdr, len - sizeof *hdr, 0, true); + ds_put_hex_dump(string, hdr, len - sizeof *hdr, 0, true); } } @@ -1498,7 +1498,7 @@ ofp_to_string(const void *oh_, size_t len, int verbosity) } else if (!pkt->printer) { if (len > sizeof *oh) { ds_put_format(&string, " length=%"PRIu16" (decoder not implemented)\n", - ntohs(oh->length)); + ntohs(oh->length)); } } else { pkt->printer(&string, oh, len, verbosity); @@ -1540,7 +1540,7 @@ ofp_message_type_to_string(uint8_t type) } static void -print_and_free(FILE *stream, char *string) +print_and_free(FILE *stream, char *string) { fputs(string, stream); free(string); diff --git a/lib/ofp-util.c b/lib/ofp-util.c index fd54a03e..89f36895 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -125,10 +125,10 @@ put_openflow_xid(size_t openflow_len, uint8_t type, uint32_t xid, /* Updates the 'length' field of the OpenFlow message in 'buffer' to * 'buffer->size'. */ void -update_openflow_length(struct ofpbuf *buffer) +update_openflow_length(struct ofpbuf *buffer) { struct ofp_header *oh = ofpbuf_at_assert(buffer, 0, sizeof *oh); - oh->length = htons(buffer->size); + oh->length = htons(buffer->size); } struct ofpbuf * @@ -303,7 +303,7 @@ make_echo_reply(const struct ofp_header *rq) } static int -check_message_type(uint8_t got_type, uint8_t want_type) +check_message_type(uint8_t got_type, uint8_t want_type) { if (got_type != want_type) { char *want_type_name = ofp_message_type_to_string(want_type); diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c index e9ad400c..5693eefd 100644 --- a/lib/ofpbuf.c +++ b/lib/ofpbuf.c @@ -50,7 +50,7 @@ ofpbuf_init(struct ofpbuf *b, size_t size) /* Frees memory that 'b' points to. */ void -ofpbuf_uninit(struct ofpbuf *b) +ofpbuf_uninit(struct ofpbuf *b) { if (b) { free(b->base); @@ -91,7 +91,7 @@ ofpbuf_clone_data(const void *data, size_t size) /* Frees memory that 'b' points to, as well as 'b' itself. */ void -ofpbuf_delete(struct ofpbuf *b) +ofpbuf_delete(struct ofpbuf *b) { if (b) { ofpbuf_uninit(b); @@ -153,7 +153,7 @@ ofpbuf_resize_tailroom__(struct ofpbuf *b, size_t new_tailroom) * reallocating and copying its data if necessary. Its headroom, if any, is * preserved. */ void -ofpbuf_prealloc_tailroom(struct ofpbuf *b, size_t size) +ofpbuf_prealloc_tailroom(struct ofpbuf *b, size_t size) { if (size > ofpbuf_tailroom(b)) { ofpbuf_resize_tailroom__(b, MAX(size, 64)); @@ -161,7 +161,7 @@ ofpbuf_prealloc_tailroom(struct ofpbuf *b, size_t size) } void -ofpbuf_prealloc_headroom(struct ofpbuf *b, size_t size) +ofpbuf_prealloc_headroom(struct ofpbuf *b, size_t size) { assert(size <= ofpbuf_headroom(b)); } @@ -180,7 +180,7 @@ ofpbuf_trim(struct ofpbuf *b) * copying its data if necessary. Returns a pointer to the first byte of the * new data, which is left uninitialized. */ void * -ofpbuf_put_uninit(struct ofpbuf *b, size_t size) +ofpbuf_put_uninit(struct ofpbuf *b, size_t size) { void *p; ofpbuf_prealloc_tailroom(b, size); @@ -204,7 +204,7 @@ ofpbuf_put_zeros(struct ofpbuf *b, size_t size) * is reallocated and copied if necessary. Returns a pointer to the first * byte of the data's location in the ofpbuf. */ void * -ofpbuf_put(struct ofpbuf *b, const void *p, size_t size) +ofpbuf_put(struct ofpbuf *b, const void *p, size_t size) { void *dst = ofpbuf_put_uninit(b, size); memcpy(dst, p, size); @@ -214,7 +214,7 @@ ofpbuf_put(struct ofpbuf *b, const void *p, size_t size) /* Reserves 'size' bytes of headroom so that they can be later allocated with * ofpbuf_push_uninit() without reallocating the ofpbuf. */ void -ofpbuf_reserve(struct ofpbuf *b, size_t size) +ofpbuf_reserve(struct ofpbuf *b, size_t size) { assert(!b->size); ofpbuf_prealloc_tailroom(b, size); @@ -222,7 +222,7 @@ ofpbuf_reserve(struct ofpbuf *b, size_t size) } void * -ofpbuf_push_uninit(struct ofpbuf *b, size_t size) +ofpbuf_push_uninit(struct ofpbuf *b, size_t size) { ofpbuf_prealloc_headroom(b, size); b->data = (char*)b->data - size; @@ -242,7 +242,7 @@ ofpbuf_push_zeros(struct ofpbuf *b, size_t size) } void * -ofpbuf_push(struct ofpbuf *b, const void *p, size_t size) +ofpbuf_push(struct ofpbuf *b, const void *p, size_t size) { void *dst = ofpbuf_push_uninit(b, size); memcpy(dst, p, size); @@ -252,7 +252,7 @@ ofpbuf_push(struct ofpbuf *b, const void *p, size_t size) /* If 'b' contains at least 'offset + size' bytes of data, returns a pointer to * byte 'offset'. Otherwise, returns a null pointer. */ void * -ofpbuf_at(const struct ofpbuf *b, size_t offset, size_t size) +ofpbuf_at(const struct ofpbuf *b, size_t offset, size_t size) { return offset + size <= b->size ? (char *) b->data + offset : NULL; } @@ -260,7 +260,7 @@ ofpbuf_at(const struct ofpbuf *b, size_t offset, size_t size) /* Returns a pointer to byte 'offset' in 'b', which must contain at least * 'offset + size' bytes of data. */ void * -ofpbuf_at_assert(const struct ofpbuf *b, size_t offset, size_t size) +ofpbuf_at_assert(const struct ofpbuf *b, size_t offset, size_t size) { assert(offset + size <= b->size); return ((char *) b->data) + offset; @@ -268,7 +268,7 @@ ofpbuf_at_assert(const struct ofpbuf *b, size_t offset, size_t size) /* Returns the byte following the last byte of data in use in 'b'. */ void * -ofpbuf_tail(const struct ofpbuf *b) +ofpbuf_tail(const struct ofpbuf *b) { return (char *) b->data + b->size; } @@ -276,14 +276,14 @@ ofpbuf_tail(const struct ofpbuf *b) /* Returns the byte following the last byte allocated for use (but not * necessarily in use) by 'b'. */ void * -ofpbuf_end(const struct ofpbuf *b) +ofpbuf_end(const struct ofpbuf *b) { return (char *) b->base + b->allocated; } /* Clears any data from 'b'. */ void -ofpbuf_clear(struct ofpbuf *b) +ofpbuf_clear(struct ofpbuf *b) { b->data = b->base; b->size = 0; @@ -292,7 +292,7 @@ ofpbuf_clear(struct ofpbuf *b) /* Removes 'size' bytes from the head end of 'b', which must contain at least * 'size' bytes of data. Returns the first byte of data removed. */ void * -ofpbuf_pull(struct ofpbuf *b, size_t size) +ofpbuf_pull(struct ofpbuf *b, size_t size) { void *data = b->data; assert(b->size >= size); @@ -305,7 +305,7 @@ ofpbuf_pull(struct ofpbuf *b, size_t size) * head end of 'b' and returns the first byte removed. Otherwise, returns a * null pointer without modifying 'b'. */ void * -ofpbuf_try_pull(struct ofpbuf *b, size_t size) +ofpbuf_try_pull(struct ofpbuf *b, size_t size) { return b->size >= size ? ofpbuf_pull(b, size) : NULL; } diff --git a/lib/packets.h b/lib/packets.h index d8bd3853..fb044071 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -45,19 +45,19 @@ static inline bool eth_addr_is_multicast(const uint8_t ea[6]) { return ea[0] & 1; } -static inline bool eth_addr_is_local(const uint8_t ea[6]) +static inline bool eth_addr_is_local(const uint8_t ea[6]) { /* Local if it is either a locally administered address or a Nicira random * address. */ return !!(ea[0] & 2) || (ea[0] == 0x00 && ea[1] == 0x23 && ea[2] == 0x20 && !!(ea[3] & 0x80)); } -static inline bool eth_addr_is_zero(const uint8_t ea[6]) +static inline bool eth_addr_is_zero(const uint8_t ea[6]) { return !(ea[0] | ea[1] | ea[2] | ea[3] | ea[4] | ea[5]); } static inline bool eth_addr_equals(const uint8_t a[ETH_ADDR_LEN], - const uint8_t b[ETH_ADDR_LEN]) + const uint8_t b[ETH_ADDR_LEN]) { return !memcmp(a, b, ETH_ADDR_LEN); } diff --git a/lib/rconn.c b/lib/rconn.c index d254356d..06f36264 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -710,7 +710,7 @@ rconn_failure_duration(const struct rconn *rconn) /* Returns the IP address of the peer, or 0 if the peer's IP address is not * known. */ uint32_t -rconn_get_remote_ip(const struct rconn *rconn) +rconn_get_remote_ip(const struct rconn *rconn) { return rconn->remote_ip; } @@ -718,16 +718,16 @@ rconn_get_remote_ip(const struct rconn *rconn) /* Returns the transport port of the peer, or 0 if the peer's port is not * known. */ uint16_t -rconn_get_remote_port(const struct rconn *rconn) +rconn_get_remote_port(const struct rconn *rconn) { return rconn->remote_port; } /* Returns the IP address used to connect to the peer, or 0 if the - * connection is not an IP-based protocol or if its IP address is not + * connection is not an IP-based protocol or if its IP address is not * known. */ uint32_t -rconn_get_local_ip(const struct rconn *rconn) +rconn_get_local_ip(const struct rconn *rconn) { return rconn->local_ip; } @@ -735,7 +735,7 @@ rconn_get_local_ip(const struct rconn *rconn) /* Returns the transport port used to connect to the peer, or 0 if the * connection does not contain a port or if the port is not known. */ uint16_t -rconn_get_local_port(const struct rconn *rconn) +rconn_get_local_port(const struct rconn *rconn) { return rconn->vconn ? vconn_get_local_port(rconn->vconn) : 0; } @@ -1059,7 +1059,7 @@ state_transition(struct rconn *rc, enum state state) } static void -question_connectivity(struct rconn *rc) +question_connectivity(struct rconn *rc) { time_t now = time_now(); if (now - rc->last_questioned > 60) { @@ -1097,7 +1097,7 @@ copy_to_monitor(struct rconn *rc, const struct ofpbuf *b) } static bool -is_connected_state(enum state state) +is_connected_state(enum state state) { return (state & (S_ACTIVE | S_IDLE)) != 0; } diff --git a/lib/sflow.h b/lib/sflow.h index 397ae2da..e3c5f496 100644 --- a/lib/sflow.h +++ b/lib/sflow.h @@ -64,7 +64,7 @@ typedef struct _SFLSampled_header { /* decoded ethernet header */ typedef struct _SFLSampled_ethernet { - u_int32_t eth_len; /* The length of the MAC packet excluding + u_int32_t eth_len; /* The length of the MAC packet excluding lower layer encapsulations */ u_int8_t src_mac[8]; /* 6 bytes + 2 pad */ u_int8_t dst_mac[8]; @@ -123,7 +123,7 @@ enum SFLExtended_as_path_segment_type { SFLEXTENDED_AS_SET = 1, /* Unordered set of ASs */ SFLEXTENDED_AS_SEQUENCE = 2 /* Ordered sequence of ASs */ }; - + typedef struct _SFLExtended_as_path_segment { u_int32_t type; /* enum SFLExtended_as_path_segment_type */ u_int32_t length; /* number of AS numbers in set/sequence */ @@ -184,7 +184,7 @@ typedef struct _SFLLabelStack { } SFLLabelStack; typedef struct _SFLExtended_mpls { - SFLAddress nextHop; /* Address of the next hop */ + SFLAddress nextHop; /* Address of the next hop */ SFLLabelStack in_stack; SFLLabelStack out_stack; } SFLExtended_mpls; @@ -192,7 +192,7 @@ typedef struct _SFLExtended_mpls { /* Extended NAT data Packet header records report addresses as seen at the sFlowDataSource. The extended_nat structure reports on translated source and/or destination - addesses for this packet. If an address was not translated it should + addesses for this packet. If an address was not translated it should be equal to that reported for the header. */ typedef struct _SFLExtended_nat { @@ -231,29 +231,29 @@ typedef struct _SFLExtended_mpls_LDP_FEC { u_int32_t mplsFecAddrPrefixLength; } SFLExtended_mpls_LDP_FEC; -/* Extended VLAN tunnel information - Record outer VLAN encapsulations that have - been stripped. extended_vlantunnel information - should only be reported if all the following conditions are satisfied: - 1. The packet has nested vlan tags, AND - 2. The reporting device is VLAN aware, AND - 3. One or more VLAN tags have been stripped, either - because they represent proprietary encapsulations, or - because switch hardware automatically strips the outer VLAN - encapsulation. - Reporting extended_vlantunnel information is not a substitute for - reporting extended_switch information. extended_switch data must - always be reported to describe the ingress/egress VLAN information - for the packet. The extended_vlantunnel information only applies to - nested VLAN tags, and then only when one or more tags has been - stripped. */ +/* Extended VLAN tunnel information + Record outer VLAN encapsulations that have + been stripped. extended_vlantunnel information + should only be reported if all the following conditions are satisfied: + 1. The packet has nested vlan tags, AND + 2. The reporting device is VLAN aware, AND + 3. One or more VLAN tags have been stripped, either + because they represent proprietary encapsulations, or + because switch hardware automatically strips the outer VLAN + encapsulation. + Reporting extended_vlantunnel information is not a substitute for + reporting extended_switch information. extended_switch data must + always be reported to describe the ingress/egress VLAN information + for the packet. The extended_vlantunnel information only applies to + nested VLAN tags, and then only when one or more tags has been + stripped. */ typedef SFLLabelStack SFLVlanStack; -typedef struct _SFLExtended_vlan_tunnel { - SFLVlanStack stack; /* List of stripped 802.1Q TPID/TCI layers. Each - TPID,TCI pair is represented as a single 32 bit - integer. Layers listed from outermost to - innermost. */ +typedef struct _SFLExtended_vlan_tunnel { + SFLVlanStack stack; /* List of stripped 802.1Q TPID/TCI layers. Each + TPID,TCI pair is represented as a single 32 bit + integer. Layers listed from outermost to + innermost. */ } SFLExtended_vlan_tunnel; enum SFLFlow_type_tag { @@ -308,7 +308,7 @@ enum SFL_sample_tag { SFLFLOW_SAMPLE_EXPANDED = 3, /* enterprise = 0 : format = 3 */ SFLCOUNTERS_SAMPLE_EXPANDED = 4 /* enterprise = 0 : format = 4 */ }; - + /* Format of a single flow sample */ typedef struct _SFLFlow_sample { diff --git a/lib/sflow_agent.c b/lib/sflow_agent.c index 4b25c25a..ba8d2bf9 100644 --- a/lib/sflow_agent.c +++ b/lib/sflow_agent.c @@ -37,7 +37,7 @@ void sfl_agent_init(SFLAgent *agent, agent->errorFn = errorFn; agent->sendFn = sendFn; -#ifdef SFLOW_DO_SOCKET +#ifdef SFLOW_DO_SOCKET if(sendFn == NULL) { /* open the socket - really need one for v4 and another for v6? */ if((agent->receiverSocket4 = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) @@ -186,14 +186,14 @@ SFLSampler *sfl_agent_addSampler(SFLAgent *agent, SFLDataSource_instance *pdsi) if(cmp < 0) break; /* insert here */ } /* either we found the insert point, or reached the end of the list...*/ - + { SFLSampler *newsm = (SFLSampler *)sflAlloc(agent, sizeof(SFLSampler)); sfl_sampler_init(newsm, agent, pdsi); if(prev) prev->nxt = newsm; else agent->samplers = newsm; newsm->nxt = sm; - + /* see if we should go in the ifIndex jumpTable */ if(SFL_DS_CLASS(newsm->dsi) == 0) { SFLSampler *test = sfl_agent_getSamplerByIfIndex(agent, SFL_DS_INDEX(newsm->dsi)); @@ -431,7 +431,7 @@ void sfl_agent_resetReceiver(SFLAgent *agent, SFLReceiver *receiver) for(; sm != NULL; sm = sm->nxt) if(sfl_sampler_get_sFlowFsReceiver(sm) == rcvIdx) sfl_sampler_set_sFlowFsReceiver(sm, 0); - + for(; pl != NULL; pl = pl->nxt) if(sfl_poller_get_sFlowCpReceiver(pl) == rcvIdx) sfl_poller_set_sFlowCpReceiver(pl, 0); @@ -439,7 +439,7 @@ void sfl_agent_resetReceiver(SFLAgent *agent, SFLReceiver *receiver) } } } - + /*_________________---------------------------__________________ _________________ sfl_agent_error __________________ -----------------___________________________------------------ diff --git a/lib/sflow_api.h b/lib/sflow_api.h index be8d9977..119cccff 100644 --- a/lib/sflow_api.h +++ b/lib/sflow_api.h @@ -25,7 +25,7 @@ #endif #include "sflow.h" - + /* define SFLOW_SOFTWARE_SAMPLING to 1 if you need to use the sfl_sampler_takeSample routine and give it every packet */ /* #define SFLOW_SOFTWARE_SAMPLING */ @@ -42,7 +42,7 @@ __________________________________ | cls| index | instance | ---------------------------------- - + but now is opened up to a 12-byte struct to ensure that ds_index has a full 32-bit field, and to make accessing the components simpler. The macros have diff --git a/lib/sflow_poller.c b/lib/sflow_poller.c index e7dc2b12..092aad10 100644 --- a/lib/sflow_poller.c +++ b/lib/sflow_poller.c @@ -23,10 +23,10 @@ void sfl_poller_init(SFLPoller *poller, /* clear everything */ memset(poller, 0, sizeof(*poller)); - + /* restore the linked list ptr */ poller->nxt = nxtPtr; - + /* now copy in the parameters */ poller->agent = agent; poller->dsi = dsi; /* structure copy */ diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c index 7fccab30..0e34959d 100644 --- a/lib/sflow_receiver.c +++ b/lib/sflow_receiver.c @@ -101,7 +101,7 @@ time_t sfl_receiver_get_sFlowRcvrTimeout(SFLReceiver *receiver) { } void sfl_receiver_set_sFlowRcvrTimeout(SFLReceiver *receiver, time_t sFlowRcvrTimeout) { receiver->sFlowRcvrTimeout =sFlowRcvrTimeout; -} +} u_int32_t sfl_receiver_get_sFlowRcvrMaximumDatagramSize(SFLReceiver *receiver) { return receiver->sFlowRcvrMaximumDatagramSize; } @@ -150,7 +150,7 @@ void sfl_receiver_tick(SFLReceiver *receiver, time_t now) _________________ receiver write utilities __________________ -----------------_____________________________------------------ */ - + inline static void put32(SFLReceiver *receiver, u_int32_t val) { *receiver->sampleCollector.datap++ = val; @@ -265,9 +265,9 @@ inline static void putGateway(SFLReceiver *receiver, SFLExtended_gateway *gw) inline static u_int32_t gatewayEncodingLength(SFLExtended_gateway *gw) { u_int32_t elemSiz = addressEncodingLength(&gw->nexthop); u_int32_t seg = 0; - elemSiz += 16; // as, src_as, src_peer_as, dst_as_path_segments + elemSiz += 16; // as, src_as, src_peer_as, dst_as_path_segments for(; seg < gw->dst_as_path_segments; seg++) { - elemSiz += 8; // type, length + elemSiz += 8; // type, length elemSiz += 4 * gw->dst_as_path[seg].length; // set/seq bytes } elemSiz += 4; // communities_length @@ -490,7 +490,7 @@ int sfl_receiver_writeFlowSample(SFLReceiver *receiver, SFL_FLOW_SAMPLE_TYPE *fs // it over the limit, then we should send it now before going on. if((receiver->sampleCollector.pktlen + packedSize) >= receiver->sFlowRcvrMaximumDatagramSize) sendSample(receiver); - + receiver->sampleCollector.numSamples++; #ifdef SFL_USE_32BIT_INDEX @@ -528,10 +528,10 @@ int sfl_receiver_writeFlowSample(SFLReceiver *receiver, SFL_FLOW_SAMPLE_TYPE *fs { SFLFlow_sample_element *elem = fs->elements; for(; elem != NULL; elem = elem->nxt) { - + putNet32(receiver, elem->tag); putNet32(receiver, elem->length); // length cached in computeFlowSampleSize() - + switch(elem->tag) { case SFLFLOW_HEADER: putNet32(receiver, elem->flowType.header.header_protocol); @@ -648,7 +648,7 @@ int sfl_receiver_writeCountersSample(SFLReceiver *receiver, SFL_COUNTERS_SAMPLE_ // if the sample pkt is full enough so that this sample might put // it over the limit, then we should send it now. if((packedSize = computeCountersSampleSize(receiver, cs)) == -1) return -1; - + // check in case this one sample alone is too big for the datagram // in fact - if it is even half as big then we should ditch it. Very // important to avoid overruning the packet buffer. @@ -656,12 +656,12 @@ int sfl_receiver_writeCountersSample(SFLReceiver *receiver, SFL_COUNTERS_SAMPLE_ sflError(receiver, "counters sample too big for datagram"); return -1; } - + if((receiver->sampleCollector.pktlen + packedSize) >= receiver->sFlowRcvrMaximumDatagramSize) sendSample(receiver); - + receiver->sampleCollector.numSamples++; - + #ifdef SFL_USE_32BIT_INDEX putNet32(receiver, SFLCOUNTERS_SAMPLE_EXPANDED); #else @@ -679,14 +679,14 @@ int sfl_receiver_writeCountersSample(SFLReceiver *receiver, SFL_COUNTERS_SAMPLE_ #endif putNet32(receiver, cs->num_elements); - + { SFLCounters_sample_element *elem = cs->elements; for(; elem != NULL; elem = elem->nxt) { - + putNet32(receiver, elem->tag); putNet32(receiver, elem->length); // length cached in computeCountersSampleSize() - + switch(elem->tag) { case SFLCOUNTERS_GENERIC: putGenericCounters(receiver, &(elem->counterBlock.generic)); @@ -758,7 +758,7 @@ u_int32_t sfl_receiver_samplePacketsSent(SFLReceiver *receiver) */ static void sendSample(SFLReceiver *receiver) -{ +{ /* construct and send out the sample, then reset for the next one... */ /* first fill in the header with the latest values */ /* version, agent_address and sub_agent_id were pre-set. */ @@ -770,7 +770,7 @@ static void sendSample(SFLReceiver *receiver) if(receiver->agent->sendFn) (*receiver->agent->sendFn)(receiver->agent->magic, receiver->agent, receiver, - (u_char *)receiver->sampleCollector.data, + (u_char *)receiver->sampleCollector.data, receiver->sampleCollector.pktlen); else { #ifdef SFLOW_DO_SOCKET diff --git a/lib/sflow_sampler.c b/lib/sflow_sampler.c index c2b4556c..280d54df 100644 --- a/lib/sflow_sampler.c +++ b/lib/sflow_sampler.c @@ -20,18 +20,18 @@ void sfl_sampler_init(SFLSampler *sampler, SFLAgent *agent, SFLDataSource_instan and to Andy Kitchingman for pointing out that it applies to the hash_nxt ptr too) */ SFLSampler *nxtPtr = sampler->nxt; SFLSampler *hashPtr = sampler->hash_nxt; - + /* clear everything */ memset(sampler, 0, sizeof(*sampler)); - + /* restore the linked list and hash-table ptr */ sampler->nxt = nxtPtr; sampler->hash_nxt = hashPtr; - + /* now copy in the parameters */ sampler->agent = agent; sampler->dsi = dsi; - + /* set defaults */ sampler->sFlowFsMaximumHeaderSize = SFL_DEFAULT_HEADER_SIZE; sampler->sFlowFsPacketSamplingRate = SFL_DEFAULT_SAMPLING_RATE; @@ -157,7 +157,7 @@ inline static u_int32_t nextRandomSkip(u_int32_t mean) { if(mean == 0 || mean == 1) return 1; return ((random() % ((2 * mean) - 1)) + 1); -} +} /*_________________---------------------------__________________ _________________ sfl_sampler_takeSample __________________ diff --git a/lib/socket-util.c b/lib/socket-util.c index 21d6b16d..961e00b4 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -98,7 +98,7 @@ get_max_fds(void) * address, into a numeric IP address in '*addr'. Returns 0 if successful, * otherwise a positive errno value. */ int -lookup_ip(const char *host_name, struct in_addr *addr) +lookup_ip(const char *host_name, struct in_addr *addr) { if (!inet_aton(host_name, addr)) { struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); @@ -111,7 +111,7 @@ lookup_ip(const char *host_name, struct in_addr *addr) /* Returns the error condition associated with socket 'fd' and resets the * socket's error status. */ int -get_socket_error(int fd) +get_socket_error(int fd) { int error; socklen_t len = sizeof(error); @@ -124,7 +124,7 @@ get_socket_error(int fd) } int -check_connection_completion(int fd) +check_connection_completion(int fd) { struct pollfd pfd; int retval; diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c index a6335879..70b15f0d 100644 --- a/lib/stream-ssl.c +++ b/lib/stream-ssl.c @@ -1045,7 +1045,7 @@ tmp_dh_callback(SSL *ssl OVS_UNUSED, int is_export OVS_UNUSED, int keylength) /* Returns true if SSL is at least partially configured. */ bool -stream_ssl_is_configured(void) +stream_ssl_is_configured(void) { return private_key.file_name || certificate.file_name || ca_cert.file_name; } diff --git a/lib/stream-ssl.h b/lib/stream-ssl.h index ba6e422e..6bea577d 100644 --- a/lib/stream-ssl.h +++ b/lib/stream-ssl.h @@ -33,8 +33,8 @@ void stream_ssl_set_peer_ca_cert_file(const char *file_name); /* Define the long options for SSL support. * - * Note that the definition includes a final comma, and therefore a comma - * must not be supplied when using the definition. This is done so that + * Note that the definition includes a final comma, and therefore a comma + * must not be supplied when using the definition. This is done so that * compilation succeeds whether or not HAVE_OPENSSL is defined. */ #define STREAM_SSL_LONG_OPTIONS \ {"private-key", required_argument, 0, 'p'}, \ @@ -54,7 +54,7 @@ void stream_ssl_set_peer_ca_cert_file(const char *file_name); stream_ssl_set_ca_cert_file(optarg, false); \ break; #else /* !HAVE_OPENSSL */ -static inline bool stream_ssl_is_configured(void) +static inline bool stream_ssl_is_configured(void) { return false; } diff --git a/lib/svec.c b/lib/svec.c index 79c83555..4a576d47 100644 --- a/lib/svec.c +++ b/lib/svec.c @@ -49,7 +49,7 @@ svec_destroy(struct svec *svec) } void -svec_clear(struct svec *svec) +svec_clear(struct svec *svec) { size_t i; diff --git a/lib/svec.h b/lib/svec.h index d9bb8a79..7fdc6b51 100644 --- a/lib/svec.h +++ b/lib/svec.h @@ -19,7 +19,7 @@ #include #include - + #ifdef __cplusplus extern "C" { #endif @@ -71,7 +71,7 @@ void svec_pop_back(struct svec *); ? (NAME) = (SVEC)->names[INDEX], 1 \ : 0); \ (INDEX)++) - + #ifdef __cplusplus } #endif diff --git a/lib/timeval.c b/lib/timeval.c index b95d1f42..cca6fe6a 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -441,9 +441,9 @@ log_poll_interval(long long int last_wakeup, const struct rusage *last_rusage) rusage.ru_nivcsw - last_rusage->ru_nivcsw); } - /* Care should be taken in the value chosen for logging. Depending - * on the configuration, syslog can write changes synchronously, - * which can cause the coverage messages to take longer to log + /* Care should be taken in the value chosen for logging. Depending + * on the configuration, syslog can write changes synchronously, + * which can cause the coverage messages to take longer to log * than the processing delay that triggered it. */ coverage_log(VLL_INFO, true); } diff --git a/lib/unixctl.h b/lib/unixctl.h index 89199bb6..2ab9a685 100644 --- a/lib/unixctl.h +++ b/lib/unixctl.h @@ -16,7 +16,7 @@ #ifndef UNIXCTL_H #define UNIXCTL_H 1 - + #ifdef __cplusplus extern "C" { #endif @@ -45,7 +45,7 @@ void unixctl_command_register(const char *name, unixctl_cb_func *cb, void *aux); void unixctl_command_reply(struct unixctl_conn *, int code, const char *body); - + #ifdef __cplusplus } #endif diff --git a/lib/util.c b/lib/util.c index 01ebc9c6..e8f3adb7 100644 --- a/lib/util.c +++ b/lib/util.c @@ -30,13 +30,13 @@ VLOG_DEFINE_THIS_MODULE(util) const char *program_name; void -out_of_memory(void) +out_of_memory(void) { ovs_fatal(0, "virtual memory exhausted"); } void * -xcalloc(size_t count, size_t size) +xcalloc(size_t count, size_t size) { void *p = count && size ? calloc(count, size) : malloc(1); COVERAGE_INC(util_xalloc); @@ -53,7 +53,7 @@ xzalloc(size_t size) } void * -xmalloc(size_t size) +xmalloc(size_t size) { void *p = malloc(size ? size : 1); COVERAGE_INC(util_xalloc); @@ -64,7 +64,7 @@ xmalloc(size_t size) } void * -xrealloc(void *p, size_t size) +xrealloc(void *p, size_t size) { p = realloc(p, size ? size : 1); COVERAGE_INC(util_xalloc); @@ -92,7 +92,7 @@ xmemdup0(const char *p_, size_t length) } char * -xstrdup(const char *s) +xstrdup(const char *s) { return xmemdup0(s, strlen(s)); } @@ -192,7 +192,7 @@ void set_program_name(const char *argv0) /* Print the version information for the program. */ void -ovs_print_version(char *date, char *time, +ovs_print_version(char *date, char *time, uint8_t min_ofp, uint8_t max_ofp) { printf("%s (Open vSwitch) "VERSION BUILDNR"\n", program_name); @@ -448,7 +448,7 @@ abs_file_name(const char *dir, const char *file_name) /* Pass a value to this function if it is marked with - * __attribute__((warn_unused_result)) and you genuinely want to ignore - * its return value. (Note that every scalar type can be implicitly + * __attribute__((warn_unused_result)) and you genuinely want to ignore + * its return value. (Note that every scalar type can be implicitly * converted to bool.) */ void ignore(bool x OVS_UNUSED) { } diff --git a/lib/util.h b/lib/util.h index 0e9353db..9eca8ec9 100644 --- a/lib/util.h +++ b/lib/util.h @@ -88,7 +88,7 @@ extern "C" { void set_program_name(const char *); -void ovs_print_version(char *date, char *time, +void ovs_print_version(char *date, char *time, uint8_t min_ofp, uint8_t max_ofp); #define OVS_PRINT_VERSION(min_ofp, max_ofp) \ ovs_print_version(__DATE__, __TIME__, (min_ofp), (max_ofp)) diff --git a/lib/vconn.c b/lib/vconn.c index 8694305b..ec0ac4e1 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -127,7 +127,7 @@ vconn_usage(bool active, bool passive, bool bootstrap OVS_UNUSED) /* Really this should be implemented via callbacks into the vconn * providers, but that seems too heavy-weight to bother with at the * moment. */ - + printf("\n"); if (active) { printf("Active OpenFlow connection methods:\n"); @@ -318,38 +318,38 @@ vconn_get_name(const struct vconn *vconn) /* Returns the IP address of the peer, or 0 if the peer is not connected over * an IP-based protocol or if its IP address is not yet known. */ uint32_t -vconn_get_remote_ip(const struct vconn *vconn) +vconn_get_remote_ip(const struct vconn *vconn) { return vconn->remote_ip; } -/* Returns the transport port of the peer, or 0 if the connection does not +/* Returns the transport port of the peer, or 0 if the connection does not * contain a port or if the port is not yet known. */ uint16_t -vconn_get_remote_port(const struct vconn *vconn) +vconn_get_remote_port(const struct vconn *vconn) { return vconn->remote_port; } -/* Returns the IP address used to connect to the peer, or 0 if the - * connection is not an IP-based protocol or if its IP address is not +/* Returns the IP address used to connect to the peer, or 0 if the + * connection is not an IP-based protocol or if its IP address is not * yet known. */ uint32_t -vconn_get_local_ip(const struct vconn *vconn) +vconn_get_local_ip(const struct vconn *vconn) { return vconn->local_ip; } -/* Returns the transport port used to connect to the peer, or 0 if the +/* Returns the transport port used to connect to the peer, or 0 if the * connection does not contain a port or if the port is not yet known. */ uint16_t -vconn_get_local_port(const struct vconn *vconn) +vconn_get_local_port(const struct vconn *vconn) { return vconn->local_port; } static void -vcs_connecting(struct vconn *vconn) +vcs_connecting(struct vconn *vconn) { int retval = (vconn->class->connect)(vconn); assert(retval != EINPROGRESS); @@ -913,13 +913,13 @@ vconn_set_remote_port(struct vconn *vconn, uint16_t port) vconn->remote_port = port; } -void +void vconn_set_local_ip(struct vconn *vconn, uint32_t ip) { vconn->local_ip = ip; } -void +void vconn_set_local_port(struct vconn *vconn, uint16_t port) { vconn->local_port = port; diff --git a/lib/vlog.c b/lib/vlog.c index cb0567e2..173f2176 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -98,7 +98,7 @@ static void format_log_message(const struct vlog_module *, enum vlog_level, /* Searches the 'n_names' in 'names'. Returns the index of a match for * 'target', or 'n_names' if no name matches. */ static size_t -search_name_array(const char *target, const char **names, size_t n_names) +search_name_array(const char *target, const char **names, size_t n_names) { size_t i; @@ -122,14 +122,14 @@ vlog_get_level_name(enum vlog_level level) /* Returns the logging level with the given 'name', or VLL_N_LEVELS if 'name' * is not the name of a logging level. */ enum vlog_level -vlog_get_level_val(const char *name) +vlog_get_level_val(const char *name) { return search_name_array(name, level_names, ARRAY_SIZE(level_names)); } /* Returns the name for logging facility 'facility'. */ const char * -vlog_get_facility_name(enum vlog_facility facility) +vlog_get_facility_name(enum vlog_facility facility) { assert(facility < VLF_N_FACILITIES); return facilities[facility].name; @@ -138,7 +138,7 @@ vlog_get_facility_name(enum vlog_facility facility) /* Returns the logging facility named 'name', or VLF_N_FACILITIES if 'name' is * not the name of a logging facility. */ enum vlog_facility -vlog_get_facility_val(const char *name) +vlog_get_facility_val(const char *name) { size_t i; @@ -174,7 +174,7 @@ vlog_module_from_name(const char *name) /* Returns the current logging level for the given 'module' and 'facility'. */ enum vlog_level -vlog_get_level(const struct vlog_module *module, enum vlog_facility facility) +vlog_get_level(const struct vlog_module *module, enum vlog_facility facility) { assert(facility < VLF_N_FACILITIES); return module->levels[facility]; @@ -221,7 +221,7 @@ set_facility_level(enum vlog_facility facility, struct vlog_module *module, * across all modules or facilities, respectively. */ void vlog_set_levels(struct vlog_module *module, enum vlog_facility facility, - enum vlog_level level) + enum vlog_level level) { assert(facility < VLF_N_FACILITIES || facility == VLF_ANY_FACILITY); if (facility == VLF_ANY_FACILITY) { @@ -234,7 +234,7 @@ vlog_set_levels(struct vlog_module *module, enum vlog_facility facility, } static void -do_set_pattern(enum vlog_facility facility, const char *pattern) +do_set_pattern(enum vlog_facility facility, const char *pattern) { struct facility *f = &facilities[facility]; if (!f->default_pattern) { @@ -441,7 +441,7 @@ vlog_unixctl_reopen(struct unixctl_conn *conn, /* Initializes the logging subsystem and registers its unixctl server * commands. */ void -vlog_init(void) +vlog_init(void) { time_t now; @@ -470,7 +470,7 @@ vlog_init(void) /* Closes the logging subsystem. */ void -vlog_exit(void) +vlog_exit(void) { if (vlog_inited) { closelog(); @@ -734,7 +734,7 @@ vlog_rate_limit(const struct vlog_module *module, enum vlog_level level, } void -vlog_usage(void) +vlog_usage(void) { printf("\nLogging options:\n" " -v, --verbose=MODULE[:FACILITY[:LEVEL]] set logging levels\n" diff --git a/lib/vlog.h b/lib/vlog.h index 7a55dea9..03f17ea5 100644 --- a/lib/vlog.h +++ b/lib/vlog.h @@ -22,7 +22,7 @@ #include #include #include "util.h" - + #ifdef __cplusplus extern "C" { #endif diff --git a/ofproto/discovery.c b/ofproto/discovery.c index 008ad62c..d7189fc6 100644 --- a/ofproto/discovery.c +++ b/ofproto/discovery.c @@ -60,7 +60,7 @@ discovery_status_cb(struct status_reply *sr, void *d_) if (d->dhcp) { status_reply_put(sr, "state=%s", dhclient_get_state(d->dhcp)); status_reply_put(sr, "state-elapsed=%u", - dhclient_get_state_elapsed(d->dhcp)); + dhclient_get_state_elapsed(d->dhcp)); if (dhclient_is_bound(d->dhcp)) { uint32_t ip = dhclient_get_ip(d->dhcp); uint32_t netmask = dhclient_get_netmask(d->dhcp); @@ -218,7 +218,7 @@ void discovery_question_connectivity(struct discovery *d) { if (d->dhcp) { - dhclient_force_renew(d->dhcp, 15); + dhclient_force_renew(d->dhcp, 15); } } @@ -261,7 +261,7 @@ void discovery_wait(struct discovery *d) { if (d->dhcp) { - dhclient_wait(d->dhcp); + dhclient_wait(d->dhcp); } } diff --git a/ofproto/in-band.c b/ofproto/in-band.c index 44bcd720..01ec1328 100644 --- a/ofproto/in-band.c +++ b/ofproto/in-band.c @@ -40,7 +40,7 @@ VLOG_DEFINE_THIS_MODULE(in_band) /* In-band control allows a single network to be used for OpenFlow - * traffic and other data traffic. Refer to ovs-vswitchd.conf(5) and + * traffic and other data traffic. Refer to ovs-vswitchd.conf(5) and * secchan(8) for a description of configuring in-band control. * * This comment is an attempt to describe how in-band control works at a @@ -73,7 +73,7 @@ VLOG_DEFINE_THIS_MODULE(in_band) * In-band also sets up the following rules for each unique next-hop MAC * address for the remotes' IPs (the "next hop" is either the remote * itself, if it is on a local subnet, or the gateway to reach the remote): - * + * * (d) ARP replies to the next hop's MAC address. * (e) ARP requests from the next hop's MAC address. * @@ -91,7 +91,7 @@ VLOG_DEFINE_THIS_MODULE(in_band) * The goal of these rules is to be as narrow as possible to allow a * switch to join a network and be able to communicate with the * remotes. As mentioned earlier, these rules have higher priority - * than the controller's rules, so if they are too broad, they may + * than the controller's rules, so if they are too broad, they may * prevent the controller from implementing its policy. As such, * in-band actively monitors some aspects of flow and packet processing * so that the rules can be made more precise. @@ -101,40 +101,40 @@ VLOG_DEFINE_THIS_MODULE(in_band) * match entries, so in-band control is able to be very precise about * the flows it prevents. Flows that miss in the datapath are sent to * userspace to be processed, so preventing these flows from being - * cached in the "fast path" does not affect correctness. The only type - * of flow that is currently prevented is one that would prevent DHCP - * replies from being seen by the local port. For example, a rule that - * forwarded all DHCP traffic to the controller would not be allowed, + * cached in the "fast path" does not affect correctness. The only type + * of flow that is currently prevented is one that would prevent DHCP + * replies from being seen by the local port. For example, a rule that + * forwarded all DHCP traffic to the controller would not be allowed, * but one that forwarded to all ports (including the local port) would. * * As mentioned earlier, packets that miss in the datapath are sent to * the userspace for processing. The userspace has its own flow table, - * the "classifier", so in-band checks whether any special processing - * is needed before the classifier is consulted. If a packet is a DHCP - * response to a request from the local port, the packet is forwarded to - * the local port, regardless of the flow table. Note that this requires - * L7 processing of DHCP replies to determine whether the 'chaddr' field + * the "classifier", so in-band checks whether any special processing + * is needed before the classifier is consulted. If a packet is a DHCP + * response to a request from the local port, the packet is forwarded to + * the local port, regardless of the flow table. Note that this requires + * L7 processing of DHCP replies to determine whether the 'chaddr' field * matches the MAC address of the local port. * * It is interesting to note that for an L3-based in-band control - * mechanism, the majority of rules are devoted to ARP traffic. At first - * glance, some of these rules appear redundant. However, each serves an - * important role. First, in order to determine the MAC address of the - * remote side (controller or gateway) for other ARP rules, we must allow - * ARP traffic for our local port with rules (b) and (c). If we are - * between a switch and its connection to the remote, we have to - * allow the other switch's ARP traffic to through. This is done with + * mechanism, the majority of rules are devoted to ARP traffic. At first + * glance, some of these rules appear redundant. However, each serves an + * important role. First, in order to determine the MAC address of the + * remote side (controller or gateway) for other ARP rules, we must allow + * ARP traffic for our local port with rules (b) and (c). If we are + * between a switch and its connection to the remote, we have to + * allow the other switch's ARP traffic to through. This is done with * rules (d) and (e), since we do not know the addresses of the other - * switches a priori, but do know the remote's or gateway's. Finally, - * if the remote is running in a local guest VM that is not reached - * through the local port, the switch that is connected to the VM must - * allow ARP traffic based on the remote's IP address, since it will - * not know the MAC address of the local port that is sending the traffic + * switches a priori, but do know the remote's or gateway's. Finally, + * if the remote is running in a local guest VM that is not reached + * through the local port, the switch that is connected to the VM must + * allow ARP traffic based on the remote's IP address, since it will + * not know the MAC address of the local port that is sending the traffic * or the MAC address of the remote in the guest VM. * * With a few notable exceptions below, in-band should work in most * network setups. The following are considered "supported' in the - * current implementation: + * current implementation: * * - Locally Connected. The switch and remote are on the same * subnet. This uses rules (a), (b), (c), (h), and (i). @@ -157,7 +157,7 @@ VLOG_DEFINE_THIS_MODULE(in_band) * "Between Switch and Remote" configuration described earlier. * * - Remote on Local VM. The remote is a guest VM on the - * system running in-band control. This uses rules (a), (b), (c), + * system running in-band control. This uses rules (a), (b), (c), * (h), and (i). * * - Remote on Local VM with Different Networks. The remote @@ -168,17 +168,17 @@ VLOG_DEFINE_THIS_MODULE(in_band) * IP address has not been configured for that port on the switch. * As such, the switch will use eth0 to connect to the remote, * and eth1's rules about the local port will not work. In the - * example, the switch attached to eth0 would use rules (a), (b), - * (c), (h), and (i) on eth0. The switch attached to eth1 would use + * example, the switch attached to eth0 would use rules (a), (b), + * (c), (h), and (i) on eth0. The switch attached to eth1 would use * rules (f), (g), (h), and (i). * * The following are explicitly *not* supported by in-band control: * - * - Specify Remote by Name. Currently, the remote must be + * - Specify Remote by Name. Currently, the remote must be * identified by IP address. A naive approach would be to permit * all DNS traffic. Unfortunately, this would prevent the * controller from defining any policy over DNS. Since switches - * that are located behind us need to connect to the remote, + * that are located behind us need to connect to the remote, * in-band cannot simply add a rule that allows DNS traffic from * the local port. The "correct" way to support this is to parse * DNS requests to allow all traffic related to a request for the @@ -187,15 +187,15 @@ VLOG_DEFINE_THIS_MODULE(in_band) * the time-being. * * - Differing Remotes for Switches. All switches must know - * the L3 addresses for all the remotes that other switches + * the L3 addresses for all the remotes that other switches * may use, since rules need to be set up to allow traffic related * to those remotes through. See rules (f), (g), (h), and (i). * - * - Differing Routes for Switches. In order for the switch to - * allow other switches to connect to a remote through a + * - Differing Routes for Switches. In order for the switch to + * allow other switches to connect to a remote through a * gateway, it allows the gateway's traffic through with rules (d) * and (e). If the routes to the remote differ for the two - * switches, we will not know the MAC address of the alternate + * switches, we will not know the MAC address of the alternate * gateway. */ @@ -394,9 +394,9 @@ in_band_status_cb(struct status_reply *sr, void *in_band_) } /* Returns true if 'packet' should be sent to the local port regardless - * of the flow table. */ + * of the flow table. */ bool -in_band_msg_in_hook(struct in_band *in_band, const flow_t *flow, +in_band_msg_in_hook(struct in_band *in_band, const flow_t *flow, const struct ofpbuf *packet) { if (!in_band) { @@ -428,7 +428,7 @@ in_band_msg_in_hook(struct in_band *in_band, const flow_t *flow, return false; } -/* Returns true if the rule that would match 'flow' with 'actions' is +/* Returns true if the rule that would match 'flow' with 'actions' is * allowed to be set up in the datapath. */ bool in_band_rule_check(struct in_band *in_band, const flow_t *flow, @@ -442,15 +442,15 @@ in_band_rule_check(struct in_band *in_band, const flow_t *flow, * by the local port. */ if (flow->dl_type == htons(ETH_TYPE_IP) && flow->nw_proto == IP_TYPE_UDP - && flow->tp_src == htons(DHCP_SERVER_PORT) + && flow->tp_src == htons(DHCP_SERVER_PORT) && flow->tp_dst == htons(DHCP_CLIENT_PORT)) { int i; for (i=0; in_actions; i++) { - if (actions->actions[i].output.type == ODPAT_OUTPUT + if (actions->actions[i].output.type == ODPAT_OUTPUT && actions->actions[i].output.port == ODPP_LOCAL) { return true; - } + } } return false; } diff --git a/ofproto/in-band.h b/ofproto/in-band.h index 5122e4c0..12f57147 100644 --- a/ofproto/in-band.h +++ b/ofproto/in-band.h @@ -37,7 +37,7 @@ void in_band_set_remotes(struct in_band *, void in_band_run(struct in_band *); void in_band_wait(struct in_band *); -bool in_band_msg_in_hook(struct in_band *, const flow_t *, +bool in_band_msg_in_hook(struct in_band *, const flow_t *, const struct ofpbuf *packet); bool in_band_rule_check(struct in_band *, const flow_t *, const struct odp_actions *); diff --git a/ofproto/netflow.c b/ofproto/netflow.c index 3d913af2..50ab80a6 100644 --- a/ofproto/netflow.c +++ b/ofproto/netflow.c @@ -94,8 +94,8 @@ struct netflow { uint8_t engine_id; /* Value of engine_id to use. */ long long int boot_time; /* Time when netflow_create() was called. */ struct collectors *collectors; /* NetFlow collectors. */ - bool add_id_to_iface; /* Put the 7 least signficiant bits of - * 'engine_id' into the most signficant + bool add_id_to_iface; /* Put the 7 least signficiant bits of + * 'engine_id' into the most signficant * bits of the interface fields. */ uint32_t netflow_cnt; /* Flow sequence number for NetFlow. */ struct ofpbuf packet; /* NetFlow packet being accumulated. */ diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 4b9ceebb..adc52827 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -85,7 +85,7 @@ static int xlate_actions(const union ofp_action *in, size_t n_in, struct rule { struct cls_rule cr; - uint64_t flow_cookie; /* Controller-issued identifier. + uint64_t flow_cookie; /* Controller-issued identifier. (Kept in network-byte order.) */ uint16_t idle_timeout; /* In seconds from time of last use. */ uint16_t hard_timeout; /* In seconds from time of creation. */ @@ -1291,7 +1291,7 @@ ofproto_add_flow(struct ofproto *p, { struct rule *rule; rule = rule_create(p, NULL, actions, n_actions, - idle_timeout >= 0 ? idle_timeout : 5 /* XXX */, + idle_timeout >= 0 ? idle_timeout : 5 /* XXX */, 0, 0, false); cls_rule_from_flow(flow, wildcards, priority, &rule->cr); rule_insert(p, rule, NULL, 0); @@ -3076,14 +3076,14 @@ handle_table_stats_request(struct ofproto *p, struct ofconn *ofconn, } static void -append_port_stat(struct ofport *port, uint16_t port_no, struct ofconn *ofconn, +append_port_stat(struct ofport *port, uint16_t port_no, struct ofconn *ofconn, struct ofpbuf **msgp) { struct netdev_stats stats; struct ofp_port_stats *ops; - /* Intentionally ignore return value, since errors will set - * 'stats' to all-1s, which is correct for OpenFlow, and + /* Intentionally ignore return value, since errors will set + * 'stats' to all-1s, which is correct for OpenFlow, and * netdev_get_stats() will log errors. */ netdev_get_stats(port->netdev, &stats); @@ -3122,7 +3122,7 @@ handle_port_stats_request(struct ofproto *p, struct ofconn *ofconn, msg = start_stats_reply(osr, sizeof *ops * 16); if (psr->port_no != htons(OFPP_NONE)) { - port = port_array_get(&p->ports, + port = port_array_get(&p->ports, ofp_port_to_odp_port(ntohs(psr->port_no))); if (port) { append_port_stat(port, ntohs(psr->port_no), ofconn, &msg); @@ -3307,7 +3307,7 @@ flow_stats_ds_cb(struct cls_rule *rule_, void *cbdata_) ds_put_cstr(results, "\n"); } -/* Adds a pretty-printed description of all flows to 'results', including +/* Adds a pretty-printed description of all flows to 'results', including * those marked hidden by secchan (e.g., by in-band control). */ void ofproto_get_all_flows(struct ofproto *p, struct ds *results) diff --git a/ofproto/status.c b/ofproto/status.c index 644e3a45..0df9ce3d 100644 --- a/ofproto/status.c +++ b/ofproto/status.c @@ -101,10 +101,10 @@ rconn_status_cb(struct status_reply *sr, void *rconn_) status_reply_put(sr, "name=%s", rconn_get_target(rconn)); if (remote_ip) { status_reply_put(sr, "remote-ip="IP_FMT, IP_ARGS(&remote_ip)); - status_reply_put(sr, "remote-port=%d", + status_reply_put(sr, "remote-port=%d", ntohs(rconn_get_remote_port(rconn))); status_reply_put(sr, "local-ip="IP_FMT, IP_ARGS(&local_ip)); - status_reply_put(sr, "local-port=%d", + status_reply_put(sr, "local-port=%d", ntohs(rconn_get_local_port(rconn))); } status_reply_put(sr, "state=%s", rconn_get_state(rconn)); diff --git a/tests/test-list.c b/tests/test-list.c index 0aa0f8b2..0efdbfce 100644 --- a/tests/test-list.c +++ b/tests/test-list.c @@ -34,10 +34,10 @@ struct element { * elements in order into 'list'. */ static void make_list(struct list *list, struct element elements[], - int values[], size_t n) + int values[], size_t n) { size_t i; - + list_init(list); for (i = 0; i < n; i++) { elements[i].value = i; @@ -49,11 +49,11 @@ make_list(struct list *list, struct element elements[], /* Verifies that 'list' contains exactly the 'n' values in 'values', in the * specified order. */ static void -check_list(struct list *list, const int values[], size_t n) +check_list(struct list *list, const int values[], size_t n) { struct element *e; size_t i; - + i = 0; LIST_FOR_EACH (e, struct element, node, list) { assert(i < n); @@ -79,10 +79,10 @@ check_list(struct list *list, const int values[], size_t n) #if 0 /* Prints the values in 'list', plus 'name' as a title. */ static void -print_list(const char *name, struct list *list) +print_list(const char *name, struct list *list) { struct element *e; - + printf("%s:", name); LIST_FOR_EACH (e, struct element, node, list) { printf(" %d", e->value); @@ -93,7 +93,7 @@ print_list(const char *name, struct list *list) /* Tests basic list construction. */ static void -test_list_construction(void) +test_list_construction(void) { enum { MAX_ELEMS = 100 }; size_t n; @@ -102,7 +102,7 @@ test_list_construction(void) struct element elements[MAX_ELEMS]; int values[MAX_ELEMS]; struct list list; - + make_list(&list, elements, values, n); check_list(&list, values, n); } @@ -111,7 +111,7 @@ test_list_construction(void) /* Tests that LIST_FOR_EACH_SAFE properly allows for deletion of the current * element of a list. */ static void -test_list_for_each_safe(void) +test_list_for_each_safe(void) { enum { MAX_ELEMS = 10 }; size_t n; @@ -125,7 +125,7 @@ test_list_for_each_safe(void) struct element *e, *next; size_t values_idx, n_remaining; int i; - + make_list(&list, elements, values, n); i = 0; @@ -158,14 +158,14 @@ test_list_for_each_safe(void) } static void -run_test(void (*function)(void)) +run_test(void (*function)(void)) { function(); printf("."); } int -main(void) +main(void) { run_test(test_list_construction); run_test(test_list_for_each_safe); diff --git a/tests/test-type-props.c b/tests/test-type-props.c index 3fb186e9..0a1d3fd3 100644 --- a/tests/test-type-props.c +++ b/tests/test-type-props.c @@ -33,7 +33,7 @@ MUST_SUCCEED(TYPE_MINIMUM(type) == minimum); int -main (void) +main (void) { TEST_TYPE(char, CHAR_MIN, CHAR_MAX, (CHAR_MIN < 0)); diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c index 3288e6f3..b18959ad 100644 --- a/utilities/ovs-controller.c +++ b/utilities/ovs-controller.c @@ -71,7 +71,7 @@ static bool mute = false; /* -q, --queue: OpenFlow queue to use, or the default queue if UINT32_MAX. */ static uint32_t queue_id = UINT32_MAX; -/* --with-flows: File with flows to send to switch, or null to not load +/* --with-flows: File with flows to send to switch, or null to not load * any default flows. */ static FILE *flow_file = NULL; diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index b13cf96b..dc6d5e31 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -399,7 +399,7 @@ str_to_port_no(const char *vconn_name, const char *str) int n_ports; int port_idx; unsigned int port_no; - + /* Check if the argument is a port index. Otherwise, treat it as * the port name. */ @@ -595,7 +595,7 @@ static void do_del_flows(int argc, char *argv[]) /* Parse and send. */ ofm = make_openflow(sizeof *ofm, OFPT_FLOW_MOD, &buffer); - parse_ofp_str(argc > 2 ? argv[2] : "", &ofm->match, NULL, NULL, + parse_ofp_str(argc > 2 ? argv[2] : "", &ofm->match, NULL, NULL, &out_port, &priority, NULL, NULL, NULL); if (strict) { ofm->command = htons(OFPFC_DELETE_STRICT); @@ -710,7 +710,7 @@ do_mod_port(int argc OVS_UNUSED, char *argv[]) int n_ports; int port_idx; int port_no; - + /* Check if the argument is a port index. Otherwise, treat it as * the port name. */ @@ -719,7 +719,7 @@ do_mod_port(int argc OVS_UNUSED, char *argv[]) port_no = -1; } - /* Send a "Features Request" to get the information we need in order + /* Send a "Features Request" to get the information we need in order * to modify the port. */ make_openflow(sizeof(struct ofp_header), OFPT_FEATURES_REQUEST, &request); open_vconn(argv[1], &vconn); @@ -736,7 +736,7 @@ do_mod_port(int argc OVS_UNUSED, char *argv[]) } } else { /* Check argument as an interface name */ - if (!strncmp((char *)osf->ports[port_idx].name, argv[2], + if (!strncmp((char *)osf->ports[port_idx].name, argv[2], sizeof osf->ports[0].name)) { break; } @@ -758,14 +758,14 @@ do_mod_port(int argc OVS_UNUSED, char *argv[]) if (!strncasecmp(argv[3], MOD_PORT_CMD_UP, sizeof MOD_PORT_CMD_UP)) { opm->mask |= htonl(OFPPC_PORT_DOWN); - } else if (!strncasecmp(argv[3], MOD_PORT_CMD_DOWN, + } else if (!strncasecmp(argv[3], MOD_PORT_CMD_DOWN, sizeof MOD_PORT_CMD_DOWN)) { opm->mask |= htonl(OFPPC_PORT_DOWN); opm->config |= htonl(OFPPC_PORT_DOWN); - } else if (!strncasecmp(argv[3], MOD_PORT_CMD_FLOOD, + } else if (!strncasecmp(argv[3], MOD_PORT_CMD_FLOOD, sizeof MOD_PORT_CMD_FLOOD)) { opm->mask |= htonl(OFPPC_NO_FLOOD); - } else if (!strncasecmp(argv[3], MOD_PORT_CMD_NOFLOOD, + } else if (!strncasecmp(argv[3], MOD_PORT_CMD_NOFLOOD, sizeof MOD_PORT_CMD_NOFLOOD)) { opm->mask |= htonl(OFPPC_NO_FLOOD); opm->config |= htonl(OFPPC_NO_FLOOD); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 952049e4..598b0016 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -244,7 +244,7 @@ static void mirror_reconfigure(struct bridge *); static void mirror_reconfigure_one(struct mirror *, struct ovsrec_mirror *); static bool vlan_is_mirrored(const struct mirror *, int vlan); -static struct iface *iface_create(struct port *port, +static struct iface *iface_create(struct port *port, const struct ovsrec_interface *if_cfg); static void iface_destroy(struct iface *); static struct iface *iface_lookup(const struct bridge *, const char *name); @@ -752,7 +752,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) opts.collectors.n = nf_cfg->n_targets; opts.collectors.names = nf_cfg->targets; if (ofproto_set_netflow(br->ofproto, &opts)) { - VLOG_ERR("bridge %s: problem setting netflow collectors", + VLOG_ERR("bridge %s: problem setting netflow collectors", br->name); } } else { @@ -1350,7 +1350,7 @@ bridge_unixctl_dump_flows(struct unixctl_conn *conn, { struct bridge *br; struct ds results; - + br = bridge_lookup(args); if (!br) { unixctl_command_reply(conn, 501, "Unknown bridge"); @@ -2361,7 +2361,7 @@ is_admissible(struct bridge *br, const flow_t *flow, bool have_packet, static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); VLOG_WARN_RL(&rl, "bridge %s: received packet on unknown " - "interface %"PRIu16, br->name, flow->in_port); + "interface %"PRIu16, br->name, flow->in_port); } *in_portp = NULL; @@ -3570,15 +3570,15 @@ port_update_bond_compat(struct port *port) /* We need to make the same determination as the Linux bonding * code to determine whether a slave should be consider "up". - * The Linux function bond_miimon_inspect() supports four + * The Linux function bond_miimon_inspect() supports four * BOND_LINK_* states: - * + * * - BOND_LINK_UP: carrier detected, updelay has passed. * - BOND_LINK_FAIL: carrier lost, downdelay in progress. * - BOND_LINK_DOWN: carrier lost, downdelay has passed. * - BOND_LINK_BACK: carrier detected, updelay in progress. * - * The function bond_info_show_slave() only considers BOND_LINK_UP + * The function bond_info_show_slave() only considers BOND_LINK_UP * to be "up" and anything else to be "down". */ slave->up = iface->enabled && iface->delay_expires == LLONG_MAX; diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c index 0b5ebb96..39c11013 100644 --- a/vswitchd/ovs-brcompatd.c +++ b/vswitchd/ovs-brcompatd.c @@ -75,7 +75,7 @@ static void usage(void) NO_RETURN; static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 60); -/* Maximum number of milliseconds to wait before pruning port entries that +/* Maximum number of milliseconds to wait before pruning port entries that * no longer exist. If set to zero, ports are never pruned. */ static int prune_timeout = 5000; @@ -224,7 +224,7 @@ execute_appctl_command(const char *unixctl_command, char **output) } static void -do_get_bridge_parts(const struct ovsrec_bridge *br, struct svec *parts, +do_get_bridge_parts(const struct ovsrec_bridge *br, struct svec *parts, int vlan, bool break_down_bonds) { struct svec ports; @@ -261,7 +261,7 @@ do_get_bridge_parts(const struct ovsrec_bridge *br, struct svec *parts, * reported. If 'vlan' > 0, only interfaces with implicit VLAN 'vlan' are * reported. */ static void -get_bridge_ifaces(const struct ovsrec_bridge *br, struct svec *ifaces, +get_bridge_ifaces(const struct ovsrec_bridge *br, struct svec *ifaces, int vlan) { do_get_bridge_parts(br, ifaces, vlan, true); @@ -274,7 +274,7 @@ get_bridge_ifaces(const struct ovsrec_bridge *br, struct svec *ifaces, * only trunk ports or ports with implicit VLAN 0 are reported. If 'vlan' > 0, * only port with implicit VLAN 'vlan' are reported. */ static void -get_bridge_ports(const struct ovsrec_bridge *br, struct svec *ports, +get_bridge_ports(const struct ovsrec_bridge *br, struct svec *ports, int vlan) { do_get_bridge_parts(br, ports, vlan, false); @@ -299,7 +299,7 @@ ovs_insert_bridge(const struct ovsrec_open_vswitch *ovs, struct ovsrec_bridge *bridge) { struct ovsrec_bridge **bridges; - size_t i; + size_t i; bridges = xmalloc(sizeof *ovs->bridges * (ovs->n_bridges + 1)); for (i = 0; i < ovs->n_bridges; i++) { @@ -308,7 +308,7 @@ ovs_insert_bridge(const struct ovsrec_open_vswitch *ovs, bridges[ovs->n_bridges] = bridge; ovsrec_open_vswitch_set_bridges(ovs, bridges, ovs->n_bridges + 1); free(bridges); -} +} static struct json * where_uuid_equals(const struct uuid *uuid) @@ -437,18 +437,18 @@ add_bridge(struct ovsdb_idl *idl, const struct ovsrec_open_vswitch *ovs, port = ovsrec_port_insert(txn_from_openvswitch(ovs)); ovsrec_port_set_name(port, br_name); ovsrec_port_set_interfaces(port, &iface, 1); - + br = ovsrec_bridge_insert(txn_from_openvswitch(ovs)); ovsrec_bridge_set_name(br, br_name); ovsrec_bridge_set_ports(br, &port, 1); - + ovs_insert_bridge(ovs, br); return commit_txn(txn, true); } static void -add_port(const struct ovsrec_open_vswitch *ovs, +add_port(const struct ovsrec_open_vswitch *ovs, const struct ovsrec_bridge *br, const char *port_name) { struct ovsrec_interface *iface; @@ -692,7 +692,7 @@ send_simple_reply(uint32_t seq, int error) static int handle_bridge_cmd(struct ovsdb_idl *idl, - const struct ovsrec_open_vswitch *ovs, + const struct ovsrec_open_vswitch *ovs, struct ofpbuf *buffer, bool add) { const char *br_name; @@ -859,7 +859,7 @@ handle_fdb_query_cmd(const struct ovsrec_open_vswitch *ovs, } /* Figure out vswitchd bridge and VLAN. */ - error = linux_bridge_to_ovs_bridge(ovs, linux_name, + error = linux_bridge_to_ovs_bridge(ovs, linux_name, &ovs_bridge, &br_vlan); if (error) { send_simple_reply(seq, error); @@ -1057,7 +1057,7 @@ handle_get_ports_cmd(const struct ovsrec_open_vswitch *ovs, return error; } - error = linux_bridge_to_ovs_bridge(ovs, linux_name, + error = linux_bridge_to_ovs_bridge(ovs, linux_name, &ovs_bridge, &br_vlan); if (error) { send_simple_reply(seq, error); @@ -1172,7 +1172,7 @@ rtnl_recv_update(struct ovsdb_idl *idl, } else if (error == ENOBUFS) { VLOG_WARN_RL(&rl, "network monitor socket overflowed"); } else if (error) { - VLOG_WARN_RL(&rl, "error on network monitor socket: %s", + VLOG_WARN_RL(&rl, "error on network monitor socket: %s", strerror(error)); } else { struct nlattr *attrs[ARRAY_SIZE(rtnlgrp_link_policy)]; @@ -1185,8 +1185,8 @@ rtnl_recv_update(struct ovsdb_idl *idl, VLOG_WARN_RL(&rl, "received bad rtnl message (no ifinfomsg)"); ofpbuf_delete(buf); return; - } - + } + if (!nl_policy_parse(buf, NLMSG_HDRLEN + sizeof(struct ifinfomsg), rtnlgrp_link_policy, attrs, ARRAY_SIZE(rtnlgrp_link_policy))) { @@ -1216,7 +1216,7 @@ rtnl_recv_update(struct ovsdb_idl *idl, br = find_bridge(ovs, br_name); if (!br) { - VLOG_WARN("no bridge named %s from which to remove %s", + VLOG_WARN("no bridge named %s from which to remove %s", br_name, port_name); ofpbuf_delete(buf); return; @@ -1343,8 +1343,8 @@ main(int argc, char *argv[]) netdev_run(); /* If 'prune_timeout' is non-zero, we actively prune from the - * configuration of port entries that are no longer valid. We - * use two methods: + * configuration of port entries that are no longer valid. We + * use two methods: * * 1) The kernel explicitly notifies us of removed ports * through the RTNL messages.