aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/ethereal.pod.template61
-rw-r--r--doc/tethereal.pod.template61
-rw-r--r--epan/resolv.c54
3 files changed, 114 insertions, 62 deletions
diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template
index ac390979fd..870383648c 100644
--- a/doc/ethereal.pod.template
+++ b/doc/ethereal.pod.template
@@ -953,15 +953,19 @@ type of the field is also given.
=head1 FILES
-F</usr/local/etc/ethereal.conf> and F<$HOME/.ethereal/preferences>
-contain system-wide and personal preference settings, respectively. The
-file contains preference settings of the form I<prefname>B<:>I<value>,
-one per line, where I<prefname> is the name of the preference (which is
-the same name that would appear in the preference file), and I<value> is
-the value to which it should be set; white space is allowed between B<:>
-and I<value>. A preference setting can be continued on subsequent lines
-by indenting the continuation lines with white space. A B<#> character
-starts a comment that runs to the end of the line.
+The F<ethereal.conf> file, which is installed in the F<etc> directory
+under the main installation directory (for example, F</usr/local/etc>)
+on UNIX-compatible systems, and in the main installation directory (for
+example, F<C:\Program Files\Ethereal>) on Windows systems, and
+F<$HOME/.ethereal/preferences>, contain system-wide and personal
+preference settings, respectively. The file contains preference
+settings of the form I<prefname>B<:>I<value>, one per line, where
+I<prefname> is the name of the preference (which is the same name that
+would appear in the preference file), and I<value> is the value to which
+it should be set; white space is allowed between B<:> and I<value>. A
+preference setting can be continued on subsequent lines by indenting the
+continuation lines with white space. A B<#> character starts a comment
+that runs to the end of the line.
The system-wide preference file is read first, if it exists, overriding
B<Ethereal>'s default values; the personal preferences file is then
@@ -973,13 +977,15 @@ in the I<Edit:Preferences> dialog box, F<$HOME/.ethereal/preferences>
will be overwritten with the new settings, destroying any comments that
were in the file.
-F</etc/ethers> is consulted to correlate 6-byte hardware addresses to
-names. If an address is not found in F</etc/ethers>, the
-F<$HOME/.ethereal/ethers> file is consulted next. Each line contains
-one hardware address and name, separated by whitespace. The digits of
-the hardware address are separated by either a colon (:), a dash (-), or
-a period (.). The following three lines are valid lines of an ethers
-file:
+The F<ethers> file, which is found in the F</etc> directory on
+UNIX-compatible systems, and in the main installation directory (for
+example, F<C:\Program Files\Ethereal>) on Windows systems, is consulted
+to correlate 6-byte hardware addresses to names. If an address is not
+found in the F<ethers> file, the F<$HOME/.ethereal/ethers> file is
+consulted next. Each line contains one hardware address and name,
+separated by whitespace. The digits of the hardware address are
+separated by either a colon (:), a dash (-), or a period (.). The
+following three lines are valid lines of an ethers file:
ff:ff:ff:ff:ff:ff Broadcast
c0-00-ff-ff-ff-ff TR_broadcast
@@ -988,18 +994,21 @@ file:
The F<manuf> file, which is installed in the F<etc> directory under the
main installation directory (for example, F</usr/local/etc>) on
UNIX-compatible systems, and in the main installation directory (for
-example, F<C:\Program Files\Ethereal> on Windows systems, matches the
+example, F<C:\Program Files\Ethereal>) on Windows systems, matches the
3-byte vendor portion of a 6-byte hardware address with the
manufacturer's name. The format of the file is the same as the
-F</etc/ethers> file, except that each address is three bytes instead of
-six.
-
-F</etc/ipxnets> and F<$HOME/.ethereal/ipxnets> correlate 4-byte IPX
-network numbers to names. The format is the same as the F</etc/ethers>
-file, except that each address if four bytes instead of six.
-Additionally, the address can be represented a single hexadecimal
-number, as is more common in the IPX world, rather than four hex octets.
-For example, these four lines are valid lines of an ipxnets file.
+F<ethers> file, except that each address is three bytes instead of six.
+
+The F<ipxnets> file, which is found in the F</etc> directory on
+UNIX-compatible systems, and in the main installation directory (for
+example, F<C:\Program Files\Ethereal>) on Windows systems, correlates
+4-byte IPX network numbers to names. If a network number is not found
+in the F<ipxnets> file, the F<$HOME/.ethereal/ipxnets> file is consulted
+next. The format is the same as the F<ethers> file, except that each
+address if four bytes instead of six. Additionally, the address can be
+represented a single hexadecimal number, as is more common in the IPX
+world, rather than four hex octets. For example, these four lines are
+valid lines of an ipxnets file.
C0.A8.2C.00 HR
c0-a8-1c-00 CEO
diff --git a/doc/tethereal.pod.template b/doc/tethereal.pod.template
index a7bd2699c9..d1cb33a1f1 100644
--- a/doc/tethereal.pod.template
+++ b/doc/tethereal.pod.template
@@ -437,28 +437,34 @@ type of the field is also given.
=head1 FILES
-F</usr/local/etc/ethereal.conf> and F<$HOME/.ethereal/preferences>
-contain system-wide and personal preference settings, respectively. The
-file contains preference settings of the form I<prefname>B<:>I<value>,
-one per line, where I<prefname> is the name of the preference (which is
-the same name that would appear in the preference file), and I<value> is
-the value to which it should be set; white space is allowed between B<:>
-and I<value>. A preference setting can be continued on subsequent lines
-by indenting the continuation lines with white space. A B<#> character
-starts a comment that runs to the end of the line.
+The F<ethereal.conf> file, which is installed in the F<etc> directory
+under the main installation directory (for example, F</usr/local/etc>)
+on UNIX-compatible systems, and in the main installation directory (for
+example, F<C:\Program Files\Ethereal>) on Windows systems, and
+F<$HOME/.ethereal/preferences>, contain system-wide and personal
+preference settings, respectively. The file contains preference
+settings of the form I<prefname>B<:>I<value>, one per line, where
+I<prefname> is the name of the preference (which is the same name that
+would appear in the preference file), and I<value> is the value to which
+it should be set; white space is allowed between B<:> and I<value>. A
+preference setting can be continued on subsequent lines by indenting the
+continuation lines with white space. A B<#> character starts a comment
+that runs to the end of the line.
The system-wide preference file is read first, if it exists, overriding
B<Tethereal>'s default values; the personal preferences file is then
read, if it exists, overriding default values and values read from the
system-wide preference file.
-F</etc/ethers> is consulted to correlate 6-byte hardware addresses to
-names. If an address is not found in F</etc/ethers>, the
-F<$HOME/.ethereal/ethers> file is consulted next. Each line contains
-one hardware address and name, separated by whitespace. The digits of
-the hardware address are separated by either a colon (:), a dash (-), or
-a period (.). The following three lines are valid lines of an ethers
-file:
+The F<ethers> file, which is found in the F</etc> directory on
+UNIX-compatible systems, and in the main installation directory (for
+example, F<C:\Program Files\Ethereal>) on Windows systems, is consulted
+to correlate 6-byte hardware addresses to names. If an address is not
+found in the F<ethers> file, the F<$HOME/.ethereal/ethers> file is
+consulted next. Each line contains one hardware address and name,
+separated by whitespace. The digits of the hardware address are
+separated by either a colon (:), a dash (-), or a period (.). The
+following three lines are valid lines of an ethers file:
ff:ff:ff:ff:ff:ff Broadcast
c0-00-ff-ff-ff-ff TR_broadcast
@@ -467,18 +473,21 @@ file:
The F<manuf> file, which is installed in the F<etc> directory under the
main installation directory (for example, F</usr/local/etc>) on
UNIX-compatible systems, and in the main installation directory (for
-example, F<C:\Program Files\Ethereal> on Windows systems, matches the
+example, F<C:\Program Files\Ethereal>) on Windows systems, matches the
3-byte vendor portion of a 6-byte hardware address with the
manufacturer's name. The format of the file is the same as the
-F</etc/ethers> file, except that each address is three bytes instead of
-six.
-
-F</etc/ipxnets> and F<$HOME/.ethereal/ipxnets> correlate 4-byte IPX
-network numbers to names. The format is the same as the F</etc/ethers>
-file, except that each address if four bytes instead of six.
-Additionally, the address can be represented a single hexadecimal
-number, as is more common in the IPX world, rather than four hex octets.
-For example, these four lines are valid lines of an ipxnets file.
+F<ethers> file, except that each address is three bytes instead of six.
+
+The F<ipxnets> file, which is found in the F</etc> directory on
+UNIX-compatible systems, and in the main installation directory (for
+example, F<C:\Program Files\Ethereal>) on Windows systems, correlates
+4-byte IPX network numbers to names. If a network number is not found
+in the F<ipxnets> file, the F<$HOME/.ethereal/ipxnets> file is consulted
+next. The format is the same as the F<ethers> file, except that each
+address if four bytes instead of six. Additionally, the address can be
+represented a single hexadecimal number, as is more common in the IPX
+world, rather than four hex octets. For example, these four lines are
+valid lines of an ipxnets file.
C0.A8.2C.00 HR
c0-a8-1c-00 CEO
diff --git a/epan/resolv.c b/epan/resolv.c
index aab6507658..b3d5f54bea 100644
--- a/epan/resolv.c
+++ b/epan/resolv.c
@@ -1,7 +1,7 @@
/* resolv.c
* Routines for network object lookup
*
- * $Id: resolv.c,v 1.12 2001/08/21 06:39:16 guy Exp $
+ * $Id: resolv.c,v 1.13 2001/10/21 19:54:49 guy Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -83,13 +83,8 @@
#include "prefs.h"
-/*
- * XXX - on Windows, do "/etc/ethers" and "/etc/ipxnets" exist, perhaps in
- * some other directory, or should we instead look for them in the Ethereal
- * installation directory, treating them as Ethereal-specific files?
- */
-#define EPATH_ETHERS "/etc/ethers"
-#define EPATH_IPXNETS "/etc/ipxnets"
+#define ENAME_ETHERS "ethers"
+#define ENAME_IPXNETS "ipxnets"
#define ENAME_MANUF "manuf"
#define EPATH_PERSONAL_ETHERS ".ethereal/ethers" /* with "$HOME/" prefix */
#define EPATH_PERSONAL_IPXNETS ".ethereal/ipxnets" /* with "$HOME/" prefix */
@@ -172,11 +167,13 @@ static int ipxnet_resolution_initialized = 0;
/*
* Global variables (can be changed in GUI sections)
+ * XXX - they could be changed in GUI code, but there's currently no
+ * GUI code to change them.
*/
-gchar *g_ethers_path = EPATH_ETHERS;
+gchar *g_ethers_path = NULL; /* {directory}/ENAME_ETHERS */
gchar *g_pethers_path = NULL; /* "$HOME"/EPATH_PERSONAL_ETHERS */
-gchar *g_ipxnets_path = EPATH_IPXNETS;
+gchar *g_ipxnets_path = NULL; /* {directory}/ENAME_IPXNETS */
gchar *g_pipxnets_path = NULL; /* "$HOME"/EPATH_PERSONAL_IPXNETS */
/* first resolving call */
@@ -627,9 +624,25 @@ static hashmanuf_t *manuf_name_lookup(const guint8 *addr)
static void initialize_ethers(void)
{
+ char *dir;
ether_t *eth;
char *manuf_path;
+ /* Compute the pathname of the ethers file.
+ * On UNIX, it's "/etc/ethers"; on Windows, it's "ethers" under the
+ * datafile directory (there's no notion of an "ethers file" on
+ * Windows, so it's an Ethereal-specific file).
+ */
+ if (g_ethers_path == NULL) {
+#ifdef WIN32
+ dir = get_datafile_dir();
+#else
+ dir = "/etc";
+#endif
+ g_ethers_path = g_malloc(strlen(dir) + strlen(ENAME_ETHERS) + 2);
+ sprintf(g_ethers_path, "%s/%s", dir, ENAME_ETHERS);
+ }
+
/* Set g_pethers_path here, but don't actually do anything
* with it. It's used in get_ethbyname() and get_ethbyaddr()
*/
@@ -926,6 +939,27 @@ static ipxnet_t *get_ipxnetbyaddr(guint32 addr)
static void initialize_ipxnets(void)
{
+ char *dir;
+
+ /* Compute the pathname of the ipxnets file.
+ * On UNIX, it's "/etc/ipxnets"; on Windows, it's "ipxnets" under the
+ * datafile directory (there's no notion of an "ipxnets file" on
+ * Windows, so it's an Ethereal-specific file).
+ *
+ * XXX - is there a notion of an "ipxnets file" in any flavor of
+ * UNIX, or with any add-on Netware package for UNIX? If not,
+ * should the UNIX version of the ipxnets file be in the datafile
+ * directory as well?
+ */
+ if (g_ipxnets_path == NULL) {
+#ifdef WIN32
+ dir = get_datafile_dir();
+#else
+ dir = "/etc";
+#endif
+ g_ipxnets_path = g_malloc(strlen(dir) + strlen(ENAME_IPXNETS) + 2);
+ sprintf(g_ipxnets_path, "%s/%s", dir, ENAME_IPXNETS);
+ }
/* Set g_pipxnets_path here, but don't actually do anything
* with it. It's used in get_ipxnetbyname() and get_ipxnetbyaddr()