From f4814f877d82f6242c95c10bb661fadecc5ab24b Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 6 Oct 2000 15:14:12 +0000 Subject: 2000-10-06 Marcus Brinkmann * Makefile (SRCS): Add tunnel.c * tunnel.c: New file. * linux-src/net/ipv4/devinet.c (configure_device): New argument PEER. Implement support for setting the destination address for point-to-point interfaces. (inquire_device): New argument PEER. Implement support to get the destination address. * main.c: Include fcntl.h. Update prototype of configure_device. Set trivfs_support_read and trivfs_support_write to 1, as we support those in some cases now. For the same reason, set trivfs_allow_open to O_READ | O_WRITE. (pfinet_demuxer): If the port is not in the socketport_class, don't try io_server (so requests for trivfs are not catched too early). (find_device): Use setup_tunnel_device for tun* interfaces. (main): Add peer argument to configure_device call for the lo interface. * options.c: Update prototypes for configure_device, inquire_device. (options): Add --peer option. (stuct parse_interface): Add peer member. (parse_hook_add_interface): Initialize peer. (parse_opt): Add a case for --peer. Add peer argument to configure_device call. (add_dev_opts): Add peer variable, add it to inquire_device call arguments. Check for peer argument and add it to command line if it is there. * pfinet.h: Add prototype for setup_tunnel_device. --- pfinet/linux-src/net/ipv4/devinet.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'pfinet/linux-src') diff --git a/pfinet/linux-src/net/ipv4/devinet.c b/pfinet/linux-src/net/ipv4/devinet.c index 64525bb3..71beaf18 100644 --- a/pfinet/linux-src/net/ipv4/devinet.c +++ b/pfinet/linux-src/net/ipv4/devinet.c @@ -401,7 +401,7 @@ static __inline__ int inet_abc_len(u32 addr) error_t configure_device (struct device *dev, - uint32_t addr, uint32_t netmask) + uint32_t addr, uint32_t netmask, uint32_t peer) { struct in_device *in_dev = dev->ip_ptr; struct in_ifaddr *ifa = in_dev ? in_dev->ifa_list : 0; @@ -422,7 +422,7 @@ configure_device (struct device *dev, if (addr != INADDR_NONE) ifa->ifa_address = ifa->ifa_local = addr; - if (netmask != INADDR_NONE) + if (netmask != INADDR_NONE && !(dev->flags & IFF_POINTOPOINT)) { ifa->ifa_mask = netmask; ifa->ifa_prefixlen = inet_mask_len (ifa->ifa_mask); @@ -431,6 +431,15 @@ configure_device (struct device *dev, else ifa->ifa_broadcast = 0; } + if (peer != INADDR_NONE && (dev->flags & IFF_POINTOPOINT)) + { + ifa->ifa_prefixlen = 32; + if (netmask != INADDR_NONE) + ifa->ifa_mask = netmask; + else + ifa->ifa_mask = inet_make_mask(32); + ifa->ifa_address = peer; + } return - (inet_set_ifa (dev, ifa) ?: dev_change_flags (dev, dev->flags | IFF_UP)); @@ -438,7 +447,7 @@ configure_device (struct device *dev, void inquire_device (struct device *dev, - uint32_t *addr, uint32_t *netmask) + uint32_t *addr, uint32_t *netmask, uint32_t *peer) { struct in_device *in_dev = dev->ip_ptr; struct in_ifaddr *ifa = in_dev ? in_dev->ifa_list : 0; @@ -447,9 +456,10 @@ inquire_device (struct device *dev, { *addr = ifa->ifa_local; *netmask = ifa->ifa_mask; + *peer = ifa->ifa_address; } else - *addr = *netmask = INADDR_NONE; + *addr = *netmask = *peer = INADDR_NONE; } #else -- cgit v1.2.3