summaryrefslogtreecommitdiff
path: root/lisp/net/net-utils.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2016-06-25 10:31:04 -0400
committerMark Oteiza <mvoteiza@udel.edu>2016-06-25 10:38:33 -0400
commitd6930356cabd3036e445cc6a2f668b1fd3e0cde4 (patch)
tree57bbae7f8dd0bd22d6f03101063df7697c764667 /lisp/net/net-utils.el
parent852507f147b4253a8ec265951b70229cfd7c5a64 (diff)
downloademacs-d6930356cabd3036e445cc6a2f668b1fd3e0cde4.tar.gz
emacs-d6930356cabd3036e445cc6a2f668b1fd3e0cde4.tar.bz2
emacs-d6930356cabd3036e445cc6a2f668b1fd3e0cde4.zip
Teach net-utils more iproute2 and nl80211 tools
* lisp/net/net-utils.el (iwconfig-program): Add iw(8). (iwconfig-program-options): Add "dev" argument for iw. Another useful option is "phy"; beyond that one needs to know the interface name. (netstat-program): Add ss(8). (route-program): Add ip(8). (route-program-options): Add "route" argument for ip.
Diffstat (limited to 'lisp/net/net-utils.el')
-rw-r--r--lisp/net/net-utils.el42
1 files changed, 28 insertions, 14 deletions
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index b13bece3912..1547f5247aa 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -112,22 +112,31 @@ These options can be used to limit how many ICMP packets are emitted."
:group 'net-utils
:type '(repeat string))
-(defcustom iwconfig-program "iwconfig"
+(defcustom iwconfig-program
+ (cond ((executable-find "iwconfig") "iwconfig")
+ ((net-utils--executable-find-sbin "iw") "iw")
+ (t "iw"))
"Program to print wireless network configuration information."
:group 'net-utils
:type 'string
- :version "23.1")
+ :version "25.2")
-(defcustom iwconfig-program-options nil
+(defcustom iwconfig-program-options
+ (cond ((string-match-p "iw\\'" iwconfig-program) (list "dev"))
+ (t nil))
"Options for the iwconfig program."
:group 'net-utils
:type '(repeat string)
- :version "23.1")
+ :version "25.2")
-(defcustom netstat-program "netstat"
+(defcustom netstat-program
+ (cond ((executable-find "netstat") "netstat")
+ ((net-utils--executable-find-sbin "ss"))
+ (t "ss"))
"Program to print network statistics."
:group 'net-utils
- :type 'string)
+ :type 'string
+ :version "25.2")
(defcustom netstat-program-options
(list "-a")
@@ -147,20 +156,25 @@ These options can be used to limit how many ICMP packets are emitted."
:type '(repeat string))
(defcustom route-program
- (if (eq system-type 'windows-nt)
- "route"
- "netstat")
+ (cond ((eq system-type 'windows-nt) "route")
+ ((executable-find "netstat") "netstat")
+ ((net-utils--executable-find-sbin "netstat"))
+ ((executable-find "ip") "ip")
+ ((net-utils--executable-find-sbin "ip"))
+ (t "ip"))
"Program to print routing tables."
:group 'net-utils
- :type 'string)
+ :type 'string
+ :version "25.2")
(defcustom route-program-options
- (if (eq system-type 'windows-nt)
- (list "print")
- (list "-r"))
+ (cond ((eq system-type 'windows-nt) (list "print"))
+ ((string-match-p "netstat\\'" route-program) (list "-r"))
+ (t (list "route")))
"Options for the route program."
:group 'net-utils
- :type '(repeat string))
+ :type '(repeat string)
+ :version "25.2")
(defcustom nslookup-program "nslookup"
"Program to interactively query DNS information."