[ovs-dev] [packet_in v2 04/18] ofp-print: Remove vestigial 'total_len' argument.
Ethan Jackson
ethan at nicira.com
Sat Jan 7 19:11:45 UTC 2012
ofp_print_packet() and ofp_packet_to_string() don't use the
'total_len' argument which they require callers to supply.
Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
lib/dpif.c | 3 +--
lib/ofp-print.c | 13 +++++--------
lib/ofp-print.h | 4 ++--
ofproto/ofproto-dpif.c | 2 +-
tests/test-flows.c | 2 +-
5 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/lib/dpif.c b/lib/dpif.c
index 9cbf877..a01b998 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -962,7 +962,7 @@ dpif_execute(struct dpif *dpif,
if (!(error ? VLOG_DROP_WARN(&error_rl) : VLOG_DROP_DBG(&dpmsg_rl))) {
struct ds ds = DS_EMPTY_INITIALIZER;
- char *packet = ofp_packet_to_string(buf->data, buf->size, buf->size);
+ char *packet = ofp_packet_to_string(buf->data, buf->size);
ds_put_format(&ds, "%s: execute ", dpif_name(dpif));
format_odp_actions(&ds, actions, actions_len);
if (error) {
@@ -1098,7 +1098,6 @@ dpif_recv(struct dpif *dpif, struct dpif_upcall *upcall)
char *packet;
packet = ofp_packet_to_string(upcall->packet->data,
- upcall->packet->size,
upcall->packet->size);
ds_init(&flow);
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index fe852b4..7ed3ce1 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -50,14 +50,12 @@ static void ofp_print_error(struct ds *, int error);
/* Returns a string that represents the contents of the Ethernet frame in the
* 'len' bytes starting at 'data' to 'stream' as output by tcpdump.
- * 'total_len' specifies the full length of the Ethernet frame (of which 'len'
- * bytes were captured).
*
* The caller must free the returned string.
*
* This starts and kills a tcpdump subprocess so it's quite expensive. */
char *
-ofp_packet_to_string(const void *data, size_t len, size_t total_len OVS_UNUSED)
+ofp_packet_to_string(const void *data, size_t len)
{
struct ds ds = DS_EMPTY_INITIALIZER;
struct ofpbuf buf;
@@ -145,8 +143,7 @@ ofp_print_packet_in(struct ds *string, const struct ofp_packet_in *op,
ds_put_char(string, '\n');
}
if (verbosity > 1) {
- char *packet = ofp_packet_to_string(op->data, data_len,
- ntohs(op->total_len));
+ char *packet = ofp_packet_to_string(op->data, data_len);
ds_put_cstr(string, packet);
free(packet);
}
@@ -403,7 +400,7 @@ ofp_print_packet_out(struct ds *string, const struct ofp_packet_out *opo,
ds_put_format(string, " data_len=%d", data_len);
if (verbosity > 0 && len > sizeof *opo) {
char *packet = ofp_packet_to_string(
- (uint8_t *)opo->actions + actions_len, data_len, data_len);
+ (uint8_t *) opo->actions + actions_len, data_len);
ds_put_char(string, '\n');
ds_put_cstr(string, packet);
free(packet);
@@ -1597,7 +1594,7 @@ ofp_print(FILE *stream, const void *oh, size_t len, int verbosity)
*
* This starts and kills a tcpdump subprocess so it's quite expensive. */
void
-ofp_print_packet(FILE *stream, const void *data, size_t len, size_t total_len)
+ofp_print_packet(FILE *stream, const void *data, size_t len)
{
- print_and_free(stream, ofp_packet_to_string(data, len, total_len));
+ print_and_free(stream, ofp_packet_to_string(data, len));
}
diff --git a/lib/ofp-print.h b/lib/ofp-print.h
index 8503056..428f5ce 100644
--- a/lib/ofp-print.h
+++ b/lib/ofp-print.h
@@ -32,14 +32,14 @@ extern "C" {
#endif
void ofp_print(FILE *, const void *, size_t, int verbosity);
-void ofp_print_packet(FILE *stream, const void *data, size_t len, size_t total_len);
+void ofp_print_packet(FILE *stream, const void *data, size_t len);
void ofp_print_actions(struct ds *, const union ofp_action *, size_t);
void ofp_print_match(struct ds *, const struct ofp_match *, int verbosity);
char *ofp_to_string(const void *, size_t, int verbosity);
char *ofp_match_to_string(const struct ofp_match *, int verbosity);
-char *ofp_packet_to_string(const void *data, size_t len, size_t total_len);
+char *ofp_packet_to_string(const void *data, size_t len);
char *ofp_message_type_to_string(uint8_t type);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index fe99d70..1645632 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5825,7 +5825,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[],
}
ds_put_cstr(&result, "Packet: ");
- s = ofp_packet_to_string(packet->data, packet->size, packet->size);
+ s = ofp_packet_to_string(packet->data, packet->size);
ds_put_cstr(&result, s);
free(s);
diff --git a/tests/test-flows.c b/tests/test-flows.c
index 9d36eb1..55f7dee 100644
--- a/tests/test-flows.c
+++ b/tests/test-flows.c
@@ -78,7 +78,7 @@ main(int argc OVS_UNUSED, char *argv[])
errors++;
printf("mismatch on packet #%d (1-based).\n", n);
printf("Packet:\n");
- ofp_print_packet(stdout, packet->data, packet->size, packet->size);
+ ofp_print_packet(stdout, packet->data, packet->size);
ovs_hex_dump(stdout, packet->data, packet->size, 0, true);
cls_rule_print(&rule);
printf("Expected flow:\n%s\n", exp_s);
--
1.7.7.1
More information about the dev
mailing list