From: Justin Pettit Date: Thu, 2 Jul 2009 20:40:20 +0000 (-0700) Subject: Show more information about connection when querying status. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae8871ec5b944315294bb9a1531d2ec8cc2ca3da;p=openvswitch Show more information about connection when querying status. It is often useful in debugging to know the ports and IP addresses being used in an OpenFlow connection. This commit adds the remote and local IP addresses and ports used for a connection to the "status" information returned by ovs-ofctl. Feature #1484. --- diff --git a/secchan/status.c b/secchan/status.c index 8bbfd180..b2cb9356 100644 --- a/secchan/status.c +++ b/secchan/status.c @@ -27,6 +27,7 @@ #include "ofpbuf.h" #include "ofproto.h" #include "openflow/nicira-ext.h" +#include "packets.h" #include "rconn.h" #include "svec.h" #include "timeval.h" @@ -93,8 +94,18 @@ rconn_status_cb(struct status_reply *sr, void *rconn_) { struct rconn *rconn = rconn_; time_t now = time_now(); + uint32_t remote_ip = rconn_get_remote_ip(rconn); + uint32_t local_ip = rconn_get_local_ip(rconn); status_reply_put(sr, "name=%s", rconn_get_name(rconn)); + if (remote_ip) { + status_reply_put(sr, "remote-ip="IP_FMT, IP_ARGS(&remote_ip)); + 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", + ntohs(rconn_get_local_port(rconn))); + } status_reply_put(sr, "state=%s", rconn_get_state(rconn)); status_reply_put(sr, "backoff=%d", rconn_get_backoff(rconn)); status_reply_put(sr, "probe-interval=%d", rconn_get_probe_interval(rconn));