- ovs-test:
- Added support for spawning ovs-test server from the client.
- Now ovs-test is able to automatically create test bridges and ports.
-
+ - "ovs-dpctl dump-flows" now prints observed TCP flags in TCP flows.
v1.6.0 - xx xxx xxxx
} else {
ds_put_format(s, "never");
}
- /* XXX tcp_flags? */
+ if (stats->tcp_flags) {
+ ds_put_cstr(s, ", flags:");
+ packet_format_tcp_flags(s, stats->tcp_flags);
+ }
}
/* Deletes all flows from 'dpif'. Returns 0 if successful, otherwise a
return 0;
}
}
+
+/* Appends a string representation of the TCP flags value 'tcp_flags'
+ * (e.g. obtained via packet_get_tcp_flags() or TCP_FLAGS) to 's', in the
+ * format used by tcpdump. */
+void
+packet_format_tcp_flags(struct ds *s, uint8_t tcp_flags)
+{
+ if (!tcp_flags) {
+ ds_put_cstr(s, "none");
+ return;
+ }
+
+ if (tcp_flags & TCP_SYN) {
+ ds_put_char(s, 'S');
+ }
+ if (tcp_flags & TCP_FIN) {
+ ds_put_char(s, 'F');
+ }
+ if (tcp_flags & TCP_PSH) {
+ ds_put_char(s, 'P');
+ }
+ if (tcp_flags & TCP_RST) {
+ ds_put_char(s, 'R');
+ }
+ if (tcp_flags & TCP_URG) {
+ ds_put_char(s, 'U');
+ }
+ if (tcp_flags & TCP_ACK) {
+ ds_put_char(s, '.');
+ }
+ if (tcp_flags & 0x40) {
+ ds_put_cstr(s, "[40]");
+ }
+ if (tcp_flags & 0x80) {
+ ds_put_cstr(s, "[80]");
+ }
+}
void packet_set_udp_port(struct ofpbuf *, ovs_be16 src, ovs_be16 dst);
uint8_t packet_get_tcp_flags(const struct ofpbuf *, const struct flow *);
+void packet_format_tcp_flags(struct ds *, uint8_t);
#endif /* packets.h */
#include "command-line.h"
#include "daemon.h"
+#include "dynamic-string.h"
#include "netflow.h"
#include "ofpbuf.h"
#include "packets.h"
printf(", TCP %"PRIu16" > %"PRIu16,
ntohs(rec->src_port), ntohs(rec->dst_port));
if (rec->tcp_flags) {
- putchar(' ');
- if (rec->tcp_flags & TCP_SYN) {
- putchar('S');
- }
- if (rec->tcp_flags & TCP_FIN) {
- putchar('F');
- }
- if (rec->tcp_flags & TCP_PSH) {
- putchar('P');
- }
- if (rec->tcp_flags & TCP_RST) {
- putchar('R');
- }
- if (rec->tcp_flags & TCP_URG) {
- putchar('U');
- }
- if (rec->tcp_flags & TCP_ACK) {
- putchar('.');
- }
- if (rec->tcp_flags & 0x40) {
- printf("[40]");
- }
- if (rec->tcp_flags & 0x80) {
- printf("[80]");
- }
+ struct ds s = DS_EMPTY_INITIALIZER;
+ packet_format_tcp_flags(&s, rec->tcp_flags);
+ printf(" %s", ds_cstr(&s));
+ ds_destroy(&s);
}
break;