summaryrefslogtreecommitdiff
path: root/pfinet/options.c
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-07-31 10:41:08 +0000
committerThomas Schwinge <tschwinge@gnu.org>2006-07-31 10:41:08 +0000
commitc74c6f31d1786c2ae8eaab90f434bd833493034d (patch)
treecdaac4c51708d9cc5b879afa6d9beab6cb386c31 /pfinet/options.c
parentdd79b1d8f8ae90cd34d5d0b307048c8aaea47d23 (diff)
2006-07-31 Stefan Siegl <stesie@brokenpipe.de>
* options.c (trivfs_append_args): Figure out the address of the default gateway and push the --gateway option to argz.
Diffstat (limited to 'pfinet/options.c')
-rw-r--r--pfinet/options.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pfinet/options.c b/pfinet/options.c
index 92534982..d05ac6d0 100644
--- a/pfinet/options.c
+++ b/pfinet/options.c
@@ -1,6 +1,6 @@
/* Pfinet option parsing
- Copyright (C) 1996,97,2000,01 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2000, 2001, 2006 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.org>
@@ -345,6 +345,8 @@ trivfs_append_args (struct trivfs_control *fsys, char **argz, size_t *argz_len)
{
error_t err = 0;
uint32_t addr, mask, peer, broad;
+ struct rt_key key = { 0 };
+ struct fib_result res;
inquire_device (dev, &addr, &mask, &peer, &broad);
@@ -365,7 +367,9 @@ trivfs_append_args (struct trivfs_control *fsys, char **argz, size_t *argz_len)
ADD_ADDR_OPT ("netmask", mask);
if (peer != addr)
ADD_ADDR_OPT ("peer", peer);
- /* XXX how do we figure out the default gateway? */
+ key.iif = dev->ifindex;
+ if (! main_table->tb_lookup (main_table, &key, &res))
+ ADD_ADDR_OPT ("gateway", FIB_RES_GW (res));
#undef ADD_ADDR_OPT
#undef ADD_OPT