02-08-2003 Marco Gerards <metgerards@student.han.nl> * Makefile (ipv4-srcs): add rtnetlink.c. (ADMHEADERS): add string.h. * config.h (CONFIG_IP_NOSIOCRT): Undefine macro. * glue-include/asm/string.h: New file. * linux-src/net/ipv3/devinet.c (inet_insert_ifa) [_HURD_]: Allow 0.0.0.0 as IP address. * linux-src/net/ipv4/fib_frontend.c (SIOCADDRT) [_HURD_]: Macro redefined. (SIOCDELRT) [_HURD_]: Likewise. * linux-src/net/ipv4/fib_semantics.c (SIOCADDRT) [_HURD_]: Likewise. (SIOCDELRT) [_HURD_]: Likewise. * pfinet-ops.c (SIOCADDRT): Likewise. (SIOCDELRT): Likewise. (S_pfinet_siocaddrt): New function. (S_pfinet_siocdelrt): Likewise. diff -Nrup /home/marco/src/hurdcvs/hurd/pfinet/Makefile pfinet/Makefile --- /home/marco/src/hurdcvs/hurd/pfinet/Makefile 2002-09-17 22:42:06.000000000 +0200 +++ pfinet/Makefile 2003-07-19 22:39:12.000000000 +0200 @@ -57,7 +57,8 @@ ipv4-srcs := af_inet.c \ tcp_timer.c \ timer.c \ udp.c \ - utils.c + utils.c \ + rtnetlink.c LINUXSRCS = $(core-srcs) $(ethernet-srcs) $(ipv4-srcs) \ $(notdir $(wildcard $(addprefix \ $(srcdir)/linux-src/arch/$(asm_syntax)/lib/,\ @@ -79,7 +80,7 @@ FROBBEDLINUXHEADERS = autoconf.h config. ip.h ip_fw.h ipx.h kernel.h major.h malloc.h mm.h net.h netdevice.h \ notifier.h param.h route.h sched.h skbuff.h socket.h sockios.h stat.h \ string.h tcp.h termios.h time.h timer.h types.h udp.h un.h wait.h -ASMHEADERS=bitops.h segment.h system.h +ASMHEADERS=bitops.h segment.h system.h string.h HURDLIBS=trivfs fshelp threads ports ihash shouldbeinlibc iohelp diff -Nrup /home/marco/src/hurdcvs/hurd/pfinet/config.h pfinet/config.h --- /home/marco/src/hurdcvs/hurd/pfinet/config.h 2000-02-04 07:32:38.000000000 +0100 +++ pfinet/config.h 2003-07-19 23:14:12.000000000 +0200 @@ -33,4 +33,4 @@ #define CONFIG_SKB_LARGE 1 -#define CONFIG_IP_NOSIOCRT 1 /* How convenient. */ +#undef CONFIG_IP_NOSIOCRT /* How convenient. */ diff -Nrup /home/marco/src/hurdcvs/hurd/pfinet/glue-include/asm/string.h pfinet/glue-include/asm/string.h --- /home/marco/src/hurdcvs/hurd/pfinet/glue-include/asm/string.h 1970-01-01 01:00:00.000000000 +0100 +++ pfinet/glue-include/asm/string.h 2003-08-02 19:02:24.000000000 +0200 @@ -0,0 +1 @@ + \ No newline at end of file diff -Nrup /home/marco/src/hurdcvs/hurd/pfinet/linux-src/net/ipv4/devinet.c pfinet/linux-src/net/ipv4/devinet.c --- /home/marco/src/hurdcvs/hurd/pfinet/linux-src/net/ipv4/devinet.c 2001-07-18 19:37:13.000000000 +0200 +++ pfinet/linux-src/net/ipv4/devinet.c 2003-08-03 16:34:25.000000000 +0200 @@ -214,10 +214,12 @@ inet_insert_ifa(struct in_device *in_dev { struct in_ifaddr *ifa1, **ifap, **last_primary; +#ifndef _HURD_ if (ifa->ifa_local == 0) { inet_free_ifa(ifa); return 0; } +#endif ifa->ifa_flags &= ~IFA_F_SECONDARY; last_primary = &in_dev->ifa_list; diff -Nrup /home/marco/src/hurdcvs/hurd/pfinet/linux-src/net/ipv4/fib_frontend.c pfinet/linux-src/net/ipv4/fib_frontend.c --- /home/marco/src/hurdcvs/hurd/pfinet/linux-src/net/ipv4/fib_frontend.c 2000-02-04 04:21:18.000000000 +0100 +++ pfinet/linux-src/net/ipv4/fib_frontend.c 2003-07-19 20:13:15.000000000 +0200 @@ -45,6 +45,13 @@ #include <net/arp.h> #include <net/ip_fib.h> +#ifdef _HURD_ +# undef SIOCADDRT +# undef SIOCDELRT +# define SIOCADDRT 0x890B +# define SIOCDELRT 0x890C +#endif + #define FFprint(a...) printk(KERN_DEBUG a) #ifndef CONFIG_IP_MULTIPLE_TABLES diff -Nrup /home/marco/src/hurdcvs/hurd/pfinet/linux-src/net/ipv4/fib_semantics.c pfinet/linux-src/net/ipv4/fib_semantics.c --- /home/marco/src/hurdcvs/hurd/pfinet/linux-src/net/ipv4/fib_semantics.c 2000-02-04 04:21:18.000000000 +0100 +++ pfinet/linux-src/net/ipv4/fib_semantics.c 2003-07-19 20:13:31.000000000 +0200 @@ -43,6 +43,13 @@ #include <net/sock.h> #include <net/ip_fib.h> +#ifdef _HURD_ +# undef SIOCADDRT +# undef SIOCDELRT +# define SIOCADDRT 0x890B +# define SIOCDELRT 0x890C +#endif + #define FSprintk(a...) static struct fib_info *fib_info_list; diff -Nrup /home/marco/src/hurdcvs/hurd/pfinet/pfinet-ops.c pfinet/pfinet-ops.c --- /home/marco/src/hurdcvs/hurd/pfinet/pfinet-ops.c 2002-06-11 23:40:28.000000000 +0200 +++ pfinet/pfinet-ops.c 2003-08-02 18:04:47.000000000 +0200 @@ -1,5 +1,5 @@ /* - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 02, 03 Free Software Foundation, Inc. Written by Marcus Brinkmann. This file is part of the GNU Hurd. @@ -34,7 +34,13 @@ #include <sys/ioctl.h> #include <net/if.h> -extern int dev_ifconf(char *arg); +#undef SIOCADDRT +#undef SIOCDELRT +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C + +int dev_ifconf (char *arg); +int ip_rt_ioctl (unsigned int cmd, void *arg); /* Return the list of devices in the format provided by SIOCGIFCONF in IFR, but don't return more then AMOUNT bytes. If AMOUNT is @@ -91,3 +97,35 @@ S_pfinet_siocgifconf (io_t port, __mutex_unlock (&global_lock); return err; } + +/* Add the route ROUTE to the route table. Pass in DEV the device name + that is set in ROUTE.RT_DEV. */ +error_t +S_pfinet_siocaddrt (io_t port, rtentry_t route, ifname_t dev) +{ + error_t err; + + /* In the rtentry structure a "char *" is used, this cannot be + passed using RPC. Fill it in again. */ + route.rt_dev = dev; + + err = ip_rt_ioctl (SIOCADDRT, &route); + + return err; +} + +/* Delete the route ROUTE from the route table. Pass in DEV the device + name that is set in ROUTE.RT_DEV. */ +error_t +S_pfinet_siocdelrt (io_t port, rtentry_t route, ifname_t dev) +{ + error_t err; + + /* In the rtentry structure a "char *" is used, this cannot be + passed using RPC. Fill it in again. */ + route.rt_dev = dev; + + err = ip_rt_ioctl (SIOCDELRT, &route); + + return err; +}