Messages in this thread Patch in this message |  | | Date | Thu, 12 Dec 1996 15:27:27 -0500 | From | "David S. Miller" <> | Subject | misc. 2.1.15 fixes |
| |
The following allows appletalk and nfsroot to compile again
diff -u --recursive --new-file --exclude=CVS vanilla/v2.1.15/linux/fs/nfs/nfsroot.c linux/fs/nfs/nfsroot.c --- vanilla/v2.1.15/linux/fs/nfs/nfsroot.c Fri Nov 22 05:32:12 1996 +++ linux/fs/nfs/nfsroot.c Thu Dec 12 13:20:26 1996 @@ -85,10 +85,12 @@ #include <linux/skbuff.h> #include <linux/socket.h> #include <linux/route.h> +#include <linux/ip.h> #include <linux/nfs.h> #include <linux/nfs_fs.h> #include <linux/nfs_mount.h> #include <linux/in.h> +#include <linux/netlink.h> #include <net/route.h> #include <net/sock.h> @@ -152,7 +154,10 @@ /* Yes, we use sys_socket, but there's no include file for it */ extern asmlinkage int sys_socket(int family, int type, int protocol); - +extern void fib_lock(void); +extern void fib_unlock(void); +extern int rtmsg_process(struct nlmsghdr *n, struct in_rtmsg *r); +extern unsigned long ip_get_mask(unsigned long addr); /*************************************************************************** @@ -462,17 +470,21 @@ */ static int root_add_bootp_route(void) { - struct rtentry route; - - memset(&route, 0, sizeof(route)); - route.rt_dev = bootp_dev->name; - route.rt_mss = bootp_dev->mtu; - route.rt_flags = RTF_UP; - ((struct sockaddr_in *) &(route.rt_dst)) -> sin_addr.s_addr = 0; - ((struct sockaddr_in *) &(route.rt_dst)) -> sin_family = AF_INET; - ((struct sockaddr_in *) &(route.rt_genmask)) -> sin_addr.s_addr = 0; - ((struct sockaddr_in *) &(route.rt_genmask)) -> sin_family = AF_INET; - if (ip_rt_new(&route)) { + struct nlmsghdr dummy_nlh; + struct in_rtmsg rtm; + int err; + + memset(&rtm, 0, sizeof(struct in_rtmsg)); + dummy_nlh.nlmsg_seq = 0; + dummy_nlh.nlmsg_pid = current->pid; + dummy_nlh.nlmsg_type = RTMSG_NEWROUTE; + memcpy(&rtm.rtmsg_device, bootp_dev->name, 15); + rtm.rtmsg_mtu = bootp_dev->mtu; + rtm.rtmsg_flags = RTF_UP; + fib_lock(); + err = rtmsg_process(&dummy_nlh, &rtm); + fib_unlock(); + if (err) { printk(KERN_ERR "BOOTP: Adding of route failed!\n"); return -1; } @@ -486,14 +498,20 @@ */ static int root_del_bootp_route(void) { - struct rtentry route; + struct nlmsghdr dummy_nlh; + struct in_rtmsg rtm; + int err; if (!bootp_have_route) return 0; - memset(&route, 0, sizeof(route)); - ((struct sockaddr_in *) &(route.rt_dst)) -> sin_addr.s_addr = 0; - ((struct sockaddr_in *) &(route.rt_genmask)) -> sin_addr.s_addr = 0; - if (ip_rt_kill(&route)) { + memset(&rtm, 0, sizeof(struct in_rtmsg)); + dummy_nlh.nlmsg_seq = 0; + dummy_nlh.nlmsg_pid = current->pid; + dummy_nlh.nlmsg_type = RTMSG_DELROUTE; + fib_lock(); + err = rtmsg_process(&dummy_nlh, &rtm); + fib_unlock(); + if (err) { printk(KERN_ERR "BOOTP: Deleting of route failed!\n"); return -1; } @@ -581,7 +599,7 @@ msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = NULL; - result = sock->ops->sendmsg(sock, &msg, size, 0, 0); + result = sock_sendmsg(sock, &msg, size); set_fs(oldfs); return (result != size); } @@ -606,7 +624,7 @@ msg.msg_iovlen = 1; msg.msg_control = NULL; msg.msg_namelen = 0; - result = sock->ops->recvmsg(sock, &msg, size, O_NONBLOCK, 0, &msg.msg_namelen); + result = sock_recvmsg(sock, &msg, size, MSG_DONTWAIT); set_fs(oldfs); return result; } @@ -721,9 +739,9 @@ return -1; /* Bind/connect the sockets */ - ((struct sock *) bootp_xmit_sock->data) -> broadcast = 1; - ((struct sock *) bootp_xmit_sock->data) -> reuse = 1; - ((struct sock *) bootp_recv_sock->data) -> reuse = 1; + bootp_xmit_sock->sk->broadcast = 1; + bootp_xmit_sock->sk->reuse = 1; + bootp_recv_sock->sk->reuse = 1; if (root_bind_udp_sock(bootp_recv_sock, INADDR_ANY, 68) || root_bind_udp_sock(bootp_xmit_sock, INADDR_ANY, 68) || root_connect_udp_sock(bootp_xmit_sock, INADDR_BROADCAST, 67)) @@ -1277,7 +1298,9 @@ */ static int root_nfs_setup(void) { - struct rtentry route; + struct in_rtmsg rtm; + struct nlmsghdr dummy_nlh; + int err; /* Set the default system name in case none was previously found */ if (!system_utsname.nodename[0]) { @@ -1304,28 +1327,37 @@ * gatewayed default route. Note that this gives sufficient network * setup even for full system operation in all common cases. */ - memset(&route, 0, sizeof(route)); /* Local subnet route */ - route.rt_dev = root_dev->name; - route.rt_mss = root_dev->mtu; - route.rt_flags = RTF_UP; - *((struct sockaddr_in *) &(route.rt_dst)) = myaddr; - (((struct sockaddr_in *) &(route.rt_dst)))->sin_addr.s_addr &= netmask.sin_addr.s_addr; - *((struct sockaddr_in *) &(route.rt_genmask)) = netmask; - if (ip_rt_new(&route)) { + dummy_nlh.nlmsg_seq = 0; + dummy_nlh.nlmsg_pid = current->pid; + dummy_nlh.nlmsg_type = RTMSG_NEWROUTE; + + memset(&rtm, 0, sizeof(struct in_rtmsg)); /* Local subnet route */ + memcpy(&rtm.rtmsg_device, root_dev->name, 15); + rtm.rtmsg_mtu = root_dev->mtu; + rtm.rtmsg_flags = RTF_UP; + rtm.rtmsg_prefixlen = (32 - ffz(~(netmask.sin_addr.s_addr))); + rtm.rtmsg_prefix = myaddr.sin_addr; + fib_lock(); + err = rtmsg_process(&dummy_nlh, &rtm); + fib_unlock(); + if (err) { printk(KERN_ERR "Root-NFS: Adding of local route failed!\n"); return -1; } if (gateway.sin_addr.s_addr != INADDR_NONE) { /* Default route */ - (((struct sockaddr_in *) &(route.rt_dst)))->sin_addr.s_addr = INADDR_ANY; - (((struct sockaddr_in *) &(route.rt_genmask)))->sin_addr.s_addr = INADDR_ANY; - *((struct sockaddr_in *) &(route.rt_gateway)) = gateway; - route.rt_flags |= RTF_GATEWAY; + rtm.rtmsg_prefix.s_addr = INADDR_ANY; + rtm.rtmsg_prefixlen = 32; + rtm.rtmsg_gateway = gateway.sin_addr; + rtm.rtmsg_flags |= RTF_GATEWAY; if ((gateway.sin_addr.s_addr ^ myaddr.sin_addr.s_addr) & netmask.sin_addr.s_addr) { printk(KERN_ERR "Root-NFS: Gateway not on local network!\n"); return -1; } - if (ip_rt_new(&route)) { + fib_lock(); + err = rtmsg_process(&dummy_nlh, &rtm); + fib_unlock(); + if (err) { printk(KERN_ERR "Root-NFS: Adding of default route failed!\n"); return -1; } diff -u --recursive --new-file --exclude=CVS vanilla/v2.1.15/linux/net/ipv4/fib.c linux/net/ipv4/fib.c --- vanilla/v2.1.15/linux/net/ipv4/fib.c Thu Dec 12 09:54:23 1996 +++ linux/net/ipv4/fib.c Thu Dec 12 13:37:56 1996 @@ -66,7 +66,7 @@ static int fib_stamp; -static int rtmsg_process(struct nlmsghdr *n, struct in_rtmsg *r); +int rtmsg_process(struct nlmsghdr *n, struct in_rtmsg *r); #ifdef CONFIG_RTNETLINK @@ -119,7 +119,7 @@ static struct wait_queue *fib_wait; atomic_t fib_users; -static void fib_lock(void) +void fib_lock(void) { while (fib_users) sleep_on(&fib_wait); @@ -127,7 +127,7 @@ dev_lock_list(); } -static void fib_unlock(void) +void fib_unlock(void) { dev_unlock_list(); if (atomic_dec_and_test(&fib_users)) { @@ -1397,7 +1397,7 @@ #endif -static int rtmsg_process(struct nlmsghdr *n, struct in_rtmsg *r) +int rtmsg_process(struct nlmsghdr *n, struct in_rtmsg *r) { unsigned long cmd=n->nlmsg_type; struct device * dev = NULL; diff -u --recursive --new-file --exclude=CVS vanilla/v2.1.15/linux/net/appletalk/ddp.c linux/net/appletalk/ddp.c --- vanilla/v2.1.15/linux/net/appletalk/ddp.c Thu Dec 12 09:54:22 1996 +++ linux/net/appletalk/ddp.c Thu Dec 12 13:51:35 1996 @@ -2110,7 +2110,7 @@ dev_remove_pack(<alk_packet_type); dev_remove_pack(&ppptalk_packet_type); unregister_snap_client(ddp_snap_id); - sock_unregister(atalk_proto_ops.family); + sock_unregister(&atalk_family_ops); free_route_list(); free_interface_list();
|  |