From 5442ecd0fee91a236bbdacd1ed631398b4bb0c33 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 4 Mar 2012 17:38:47 +0100 Subject: core.s2smanager: Log the entire stream header. --- core/s2smanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 3a625157..e3c536f4 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -447,7 +447,7 @@ function streamopened(session, attr) session.from_host = attr.from and nameprep(attr.from); session.streamid = uuid_gen(); - (session.log or log)("debug", "Incoming s2s received "); + (session.log or log)("debug", "Incoming s2s received %s", st.stanza("stream:stream", attr):top_tag()); if session.to_host then if not hosts[session.to_host] then -- Attempting to connect to a host we don't serve -- cgit v1.2.3 From 1758d8c92c1915af55e037972069a618e207497e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 5 Mar 2012 22:07:40 +0100 Subject: mod_admin_telnet: Commond and flexible way to show stream properties. --- plugins/mod_admin_telnet.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index b211d271..b96f69b9 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -487,6 +487,19 @@ function def_env.c2s:close(match_jid) return true, "Total: "..count.." sessions closed"; end +local function session_flags(session, line) + if session.cert_identity_status == "valid" then + line[#line+1] = "(secure)"; + end + if session.secure then + line[#line+1] = "(encrypted)"; + end + if session.compressed then + line[#line+1] = "(compressed)"; + end + return table.concat(line, " "); +end + def_env.s2s = {}; function def_env.s2s:show(match_jid) local _print = self.session.print; @@ -499,7 +512,7 @@ function def_env.s2s:show(match_jid) for remotehost, session in pairs(host_session.s2sout) do if (not match_jid) or remotehost:match(match_jid) or host:match(match_jid) then count_out = count_out + 1; - print(" "..host.." -> "..remotehost..(session.cert_identity_status == "valid" and " (secure)" or "")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or "")); + print(session_flags(session, {" ", host, "->", remotehost})); if session.sendq then print(" There are "..#session.sendq.." queued outgoing stanzas for this connection"); end @@ -536,7 +549,7 @@ function def_env.s2s:show(match_jid) -- Pft! is what I say to list comprehensions or (session.hosts and #array.collect(keys(session.hosts)):filter(subhost_filter)>0)) then count_in = count_in + 1; - print(" "..host.." <- "..(session.from_host or "(unknown)")..(session.cert_identity_status == "valid" and " (secure)" or "")..(session.secure and " (encrypted)" or "")..(session.compressed and " (compressed)" or "")); + print(session_flags(session, {" ", host, "<-", session.from_host or "(unknown)"})); if session.type == "s2sin_unauthed" then print(" Connection not yet authenticated"); end -- cgit v1.2.3 From b0477db2640555c5d8972d7af99d35e4863f4ce0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 5 Mar 2012 22:10:09 +0100 Subject: mod_admin_telnet: (encrypted) is redundant in combination with (secure) --- plugins/mod_admin_telnet.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index b96f69b9..ca30a3b4 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -490,8 +490,7 @@ end local function session_flags(session, line) if session.cert_identity_status == "valid" then line[#line+1] = "(secure)"; - end - if session.secure then + elseif session.secure then line[#line+1] = "(encrypted)"; end if session.compressed then -- cgit v1.2.3 From 63782b344eebd404631aa507b8fbcabf6529867f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 5 Mar 2012 22:11:05 +0100 Subject: mod_admin_telnet: Add flag for stream management. --- plugins/mod_admin_telnet.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index ca30a3b4..9041552b 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -496,6 +496,9 @@ local function session_flags(session, line) if session.compressed then line[#line+1] = "(compressed)"; end + if session.smacks then + line[#line+1] = "(sm)"; + end return table.concat(line, " "); end -- cgit v1.2.3 From 6d4dea87b271b2b7aafddb96dd42c0dfcbf11b55 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 5 Mar 2012 22:11:29 +0100 Subject: mod_admin_telnet: Add flag for IPv6 --- plugins/mod_admin_telnet.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 9041552b..0dfdc827 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -499,6 +499,9 @@ local function session_flags(session, line) if session.smacks then line[#line+1] = "(sm)"; end + if session.conn and session.conn:ip():match(":") then + line[#line+1] = "(IPv6)"; + end return table.concat(line, " "); end -- cgit v1.2.3