wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * NFS support driver - based on etherboot and U-BOOT's tftp.c |
| 3 | * |
| 4 | * Masami Komiya <mkomiya@sonare.it> 2004 |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | /* NOTE: the NFS code is heavily inspired by the NetBSD netboot code (read: |
| 9 | * large portions are copied verbatim) as distributed in OSKit 0.97. A few |
| 10 | * changes were necessary to adapt the code to Etherboot and to fix several |
| 11 | * inconsistencies. Also the RPC message preparation is done "by hand" to |
| 12 | * avoid adding netsprintf() which I find hard to understand and use. */ |
| 13 | |
| 14 | /* NOTE 2: Etherboot does not care about things beyond the kernel image, so |
| 15 | * it loads the kernel image off the boot server (ARP_SERVER) and does not |
| 16 | * access the client root disk (root-path in dhcpd.conf), which would use |
| 17 | * ARP_ROOTSERVER. The root disk is something the operating system we are |
| 18 | * about to load needs to use. This is different from the OSKit 0.97 logic. */ |
| 19 | |
| 20 | /* NOTE 3: Symlink handling introduced by Anselm M Hoffmeister, 2003-July-14 |
| 21 | * If a symlink is encountered, it is followed as far as possible (recursion |
| 22 | * possible, maximum 16 steps). There is no clearing of ".."'s inside the |
| 23 | * path, so please DON'T DO THAT. thx. */ |
| 24 | |
| 25 | #include <common.h> |
| 26 | #include <command.h> |
| 27 | #include <net.h> |
| 28 | #include <malloc.h> |
Joe Hershberger | ed19185 | 2015-03-22 17:09:08 -0500 | [diff] [blame] | 29 | #include <mapmem.h> |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 30 | #include "nfs.h" |
| 31 | #include "bootp.h" |
| 32 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 33 | #define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ |
Hiroshi Ito | 3702cd7 | 2008-01-31 18:35:04 +0900 | [diff] [blame] | 34 | #define NFS_RETRY_COUNT 30 |
Tetsuyuki Kobayashi | 147e390 | 2012-07-03 22:25:21 +0000 | [diff] [blame] | 35 | #ifndef CONFIG_NFS_TIMEOUT |
| 36 | # define NFS_TIMEOUT 2000UL |
| 37 | #else |
| 38 | # define NFS_TIMEOUT CONFIG_NFS_TIMEOUT |
| 39 | #endif |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 40 | |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 41 | #define NFS_RPC_ERR 1 |
| 42 | #define NFS_RPC_DROP 124 |
| 43 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 44 | static int fs_mounted; |
| 45 | static unsigned long rpc_id; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 46 | static int nfs_offset = -1; |
| 47 | static int nfs_len; |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 48 | static ulong nfs_timeout = NFS_TIMEOUT; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 49 | |
| 50 | static char dirfh[NFS_FHSIZE]; /* file handle of directory */ |
| 51 | static char filefh[NFS_FHSIZE]; /* file handle of kernel image */ |
| 52 | |
Joe Hershberger | d4bb76a | 2012-05-23 07:59:14 +0000 | [diff] [blame] | 53 | static enum net_loop_state nfs_download_state; |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 54 | static struct in_addr nfs_server_ip; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 55 | static int nfs_server_mount_port; |
| 56 | static int nfs_server_port; |
| 57 | static int nfs_our_port; |
| 58 | static int nfs_timeout_count; |
| 59 | static int nfs_state; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 60 | #define STATE_PRCLOOKUP_PROG_MOUNT_REQ 1 |
| 61 | #define STATE_PRCLOOKUP_PROG_NFS_REQ 2 |
| 62 | #define STATE_MOUNT_REQ 3 |
| 63 | #define STATE_UMOUNT_REQ 4 |
| 64 | #define STATE_LOOKUP_REQ 5 |
| 65 | #define STATE_READ_REQ 6 |
| 66 | #define STATE_READLINK_REQ 7 |
| 67 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 68 | static char *nfs_filename; |
| 69 | static char *nfs_path; |
| 70 | static char nfs_path_buff[2048]; |
| 71 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 72 | static inline int store_block(uchar *src, unsigned offset, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 73 | { |
wdenk | 77ef4c6 | 2004-02-24 22:33:21 +0000 | [diff] [blame] | 74 | ulong newsize = offset + len; |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 75 | #ifdef CONFIG_SYS_DIRECT_FLASH_NFS |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 76 | int i, rc = 0; |
| 77 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 78 | for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 79 | /* start address in flash? */ |
| 80 | if (load_addr + offset >= flash_info[i].start[0]) { |
| 81 | rc = 1; |
| 82 | break; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | if (rc) { /* Flash is destination for this packet */ |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 87 | rc = flash_write((uchar *)src, (ulong)(load_addr+offset), len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 88 | if (rc) { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 89 | flash_perror(rc); |
Wolfgang Denk | b077b50 | 2005-08-06 01:11:12 +0200 | [diff] [blame] | 90 | return -1; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 91 | } |
| 92 | } else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 93 | #endif /* CONFIG_SYS_DIRECT_FLASH_NFS */ |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 94 | { |
Joe Hershberger | ed19185 | 2015-03-22 17:09:08 -0500 | [diff] [blame] | 95 | void *ptr = map_sysmem(load_addr + offset, len); |
| 96 | |
| 97 | memcpy(ptr, src, len); |
| 98 | unmap_sysmem(ptr); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 99 | } |
wdenk | 77ef4c6 | 2004-02-24 22:33:21 +0000 | [diff] [blame] | 100 | |
Joe Hershberger | 290c899 | 2015-04-08 01:41:02 -0500 | [diff] [blame] | 101 | if (net_boot_file_size < (offset + len)) |
| 102 | net_boot_file_size = newsize; |
Wolfgang Denk | b077b50 | 2005-08-06 01:11:12 +0200 | [diff] [blame] | 103 | return 0; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 106 | static char *basename(char *path) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 107 | { |
| 108 | char *fname; |
| 109 | |
| 110 | fname = path + strlen(path) - 1; |
| 111 | while (fname >= path) { |
| 112 | if (*fname == '/') { |
| 113 | fname++; |
| 114 | break; |
| 115 | } |
| 116 | fname--; |
| 117 | } |
| 118 | return fname; |
| 119 | } |
| 120 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 121 | static char *dirname(char *path) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 122 | { |
| 123 | char *fname; |
| 124 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 125 | fname = basename(path); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 126 | --fname; |
| 127 | *fname = '\0'; |
| 128 | return path; |
| 129 | } |
| 130 | |
| 131 | /************************************************************************** |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 132 | RPC_ADD_CREDENTIALS - Add RPC authentication/verifier entries |
| 133 | **************************************************************************/ |
Ralf Hubert | 2f8641c | 2016-07-01 13:19:51 +0200 | [diff] [blame] | 134 | static uint32_t *rpc_add_credentials(uint32_t *p) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 135 | { |
| 136 | int hl; |
| 137 | int hostnamelen; |
| 138 | char hostname[256]; |
| 139 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 140 | strcpy(hostname, ""); |
| 141 | hostnamelen = strlen(hostname); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 142 | |
| 143 | /* Here's the executive summary on authentication requirements of the |
| 144 | * various NFS server implementations: Linux accepts both AUTH_NONE |
| 145 | * and AUTH_UNIX authentication (also accepts an empty hostname field |
| 146 | * in the AUTH_UNIX scheme). *BSD refuses AUTH_NONE, but accepts |
| 147 | * AUTH_UNIX (also accepts an empty hostname field in the AUTH_UNIX |
| 148 | * scheme). To be safe, use AUTH_UNIX and pass the hostname if we have |
| 149 | * it (if the BOOTP/DHCP reply didn't give one, just use an empty |
| 150 | * hostname). */ |
| 151 | |
| 152 | hl = (hostnamelen + 3) & ~3; |
| 153 | |
| 154 | /* Provide an AUTH_UNIX credential. */ |
| 155 | *p++ = htonl(1); /* AUTH_UNIX */ |
| 156 | *p++ = htonl(hl+20); /* auth length */ |
| 157 | *p++ = htonl(0); /* stamp */ |
| 158 | *p++ = htonl(hostnamelen); /* hostname string */ |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 159 | if (hostnamelen & 3) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 160 | *(p + hostnamelen / 4) = 0; /* add zero padding */ |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 161 | memcpy(p, hostname, hostnamelen); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 162 | p += hl / 4; |
| 163 | *p++ = 0; /* uid */ |
| 164 | *p++ = 0; /* gid */ |
| 165 | *p++ = 0; /* auxiliary gid list */ |
| 166 | |
| 167 | /* Provide an AUTH_NONE verifier. */ |
| 168 | *p++ = 0; /* AUTH_NONE */ |
| 169 | *p++ = 0; /* auth length */ |
| 170 | |
| 171 | return p; |
| 172 | } |
| 173 | |
| 174 | /************************************************************************** |
| 175 | RPC_LOOKUP - Lookup RPC Port numbers |
| 176 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 177 | static void rpc_req(int rpc_prog, int rpc_proc, uint32_t *data, int datalen) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 178 | { |
| 179 | struct rpc_t pkt; |
| 180 | unsigned long id; |
| 181 | uint32_t *p; |
| 182 | int pktlen; |
| 183 | int sport; |
| 184 | |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 185 | id = ++rpc_id; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 186 | pkt.u.call.id = htonl(id); |
| 187 | pkt.u.call.type = htonl(MSG_CALL); |
| 188 | pkt.u.call.rpcvers = htonl(2); /* use RPC version 2 */ |
| 189 | pkt.u.call.prog = htonl(rpc_prog); |
| 190 | pkt.u.call.vers = htonl(2); /* portmapper is version 2 */ |
| 191 | pkt.u.call.proc = htonl(rpc_proc); |
| 192 | p = (uint32_t *)&(pkt.u.call.data); |
| 193 | |
| 194 | if (datalen) |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 195 | memcpy((char *)p, (char *)data, datalen*sizeof(uint32_t)); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 196 | |
| 197 | pktlen = (char *)p + datalen*sizeof(uint32_t) - (char *)&pkt; |
| 198 | |
Joe Hershberger | a8ca4f6 | 2015-04-08 01:41:05 -0500 | [diff] [blame] | 199 | memcpy((char *)net_tx_packet + net_eth_hdr_size() + IP_UDP_HDR_SIZE, |
| 200 | (char *)&pkt, pktlen); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 201 | |
| 202 | if (rpc_prog == PROG_PORTMAP) |
| 203 | sport = SUNRPC_PORT; |
| 204 | else if (rpc_prog == PROG_MOUNT) |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 205 | sport = nfs_server_mount_port; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 206 | else |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 207 | sport = nfs_server_port; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 208 | |
Joe Hershberger | a8ca4f6 | 2015-04-08 01:41:05 -0500 | [diff] [blame] | 209 | net_send_udp_packet(net_server_ethaddr, nfs_server_ip, sport, |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 210 | nfs_our_port, pktlen); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | /************************************************************************** |
| 214 | RPC_LOOKUP - Lookup RPC Port numbers |
| 215 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 216 | static void rpc_lookup_req(int prog, int ver) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 217 | { |
| 218 | uint32_t data[16]; |
| 219 | |
| 220 | data[0] = 0; data[1] = 0; /* auth credential */ |
| 221 | data[2] = 0; data[3] = 0; /* auth verifier */ |
| 222 | data[4] = htonl(prog); |
| 223 | data[5] = htonl(ver); |
| 224 | data[6] = htonl(17); /* IP_UDP */ |
| 225 | data[7] = 0; |
| 226 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 227 | rpc_req(PROG_PORTMAP, PORTMAP_GETPORT, data, 8); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | /************************************************************************** |
| 231 | NFS_MOUNT - Mount an NFS Filesystem |
| 232 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 233 | static void nfs_mount_req(char *path) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 234 | { |
| 235 | uint32_t data[1024]; |
| 236 | uint32_t *p; |
| 237 | int len; |
| 238 | int pathlen; |
| 239 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 240 | pathlen = strlen(path); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 241 | |
| 242 | p = &(data[0]); |
Ralf Hubert | 2f8641c | 2016-07-01 13:19:51 +0200 | [diff] [blame] | 243 | p = rpc_add_credentials(p); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 244 | |
| 245 | *p++ = htonl(pathlen); |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 246 | if (pathlen & 3) |
| 247 | *(p + pathlen / 4) = 0; |
| 248 | memcpy(p, path, pathlen); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 249 | p += (pathlen + 3) / 4; |
| 250 | |
| 251 | len = (uint32_t *)p - (uint32_t *)&(data[0]); |
| 252 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 253 | rpc_req(PROG_MOUNT, MOUNT_ADDENTRY, data, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | /************************************************************************** |
| 257 | NFS_UMOUNTALL - Unmount all our NFS Filesystems on the Server |
| 258 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 259 | static void nfs_umountall_req(void) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 260 | { |
| 261 | uint32_t data[1024]; |
| 262 | uint32_t *p; |
| 263 | int len; |
| 264 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 265 | if ((nfs_server_mount_port == -1) || (!fs_mounted)) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 266 | /* Nothing mounted, nothing to umount */ |
| 267 | return; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 268 | |
| 269 | p = &(data[0]); |
Ralf Hubert | 2f8641c | 2016-07-01 13:19:51 +0200 | [diff] [blame] | 270 | p = rpc_add_credentials(p); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 271 | |
| 272 | len = (uint32_t *)p - (uint32_t *)&(data[0]); |
| 273 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 274 | rpc_req(PROG_MOUNT, MOUNT_UMOUNTALL, data, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | /*************************************************************************** |
| 278 | * NFS_READLINK (AH 2003-07-14) |
| 279 | * This procedure is called when read of the first block fails - |
| 280 | * this probably happens when it's a directory or a symlink |
| 281 | * In case of successful readlink(), the dirname is manipulated, |
| 282 | * so that inside the nfs() function a recursion can be done. |
| 283 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 284 | static void nfs_readlink_req(void) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 285 | { |
| 286 | uint32_t data[1024]; |
| 287 | uint32_t *p; |
| 288 | int len; |
| 289 | |
| 290 | p = &(data[0]); |
Ralf Hubert | 2f8641c | 2016-07-01 13:19:51 +0200 | [diff] [blame] | 291 | p = rpc_add_credentials(p); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 292 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 293 | memcpy(p, filefh, NFS_FHSIZE); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 294 | p += (NFS_FHSIZE / 4); |
| 295 | |
| 296 | len = (uint32_t *)p - (uint32_t *)&(data[0]); |
| 297 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 298 | rpc_req(PROG_NFS, NFS_READLINK, data, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | /************************************************************************** |
| 302 | NFS_LOOKUP - Lookup Pathname |
| 303 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 304 | static void nfs_lookup_req(char *fname) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 305 | { |
| 306 | uint32_t data[1024]; |
| 307 | uint32_t *p; |
| 308 | int len; |
| 309 | int fnamelen; |
| 310 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 311 | fnamelen = strlen(fname); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 312 | |
| 313 | p = &(data[0]); |
Ralf Hubert | 2f8641c | 2016-07-01 13:19:51 +0200 | [diff] [blame] | 314 | p = rpc_add_credentials(p); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 315 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 316 | memcpy(p, dirfh, NFS_FHSIZE); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 317 | p += (NFS_FHSIZE / 4); |
| 318 | *p++ = htonl(fnamelen); |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 319 | if (fnamelen & 3) |
| 320 | *(p + fnamelen / 4) = 0; |
| 321 | memcpy(p, fname, fnamelen); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 322 | p += (fnamelen + 3) / 4; |
| 323 | |
| 324 | len = (uint32_t *)p - (uint32_t *)&(data[0]); |
| 325 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 326 | rpc_req(PROG_NFS, NFS_LOOKUP, data, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | /************************************************************************** |
| 330 | NFS_READ - Read File on NFS Server |
| 331 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 332 | static void nfs_read_req(int offset, int readlen) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 333 | { |
| 334 | uint32_t data[1024]; |
| 335 | uint32_t *p; |
| 336 | int len; |
| 337 | |
| 338 | p = &(data[0]); |
Ralf Hubert | 2f8641c | 2016-07-01 13:19:51 +0200 | [diff] [blame] | 339 | p = rpc_add_credentials(p); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 340 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 341 | memcpy(p, filefh, NFS_FHSIZE); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 342 | p += (NFS_FHSIZE / 4); |
| 343 | *p++ = htonl(offset); |
| 344 | *p++ = htonl(readlen); |
| 345 | *p++ = 0; |
| 346 | |
| 347 | len = (uint32_t *)p - (uint32_t *)&(data[0]); |
| 348 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 349 | rpc_req(PROG_NFS, NFS_READ, data, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | /************************************************************************** |
| 353 | RPC request dispatcher |
| 354 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 355 | static void nfs_send(void) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 356 | { |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 357 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 358 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 359 | switch (nfs_state) { |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 360 | case STATE_PRCLOOKUP_PROG_MOUNT_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 361 | rpc_lookup_req(PROG_MOUNT, 1); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 362 | break; |
| 363 | case STATE_PRCLOOKUP_PROG_NFS_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 364 | rpc_lookup_req(PROG_NFS, 2); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 365 | break; |
| 366 | case STATE_MOUNT_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 367 | nfs_mount_req(nfs_path); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 368 | break; |
| 369 | case STATE_UMOUNT_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 370 | nfs_umountall_req(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 371 | break; |
| 372 | case STATE_LOOKUP_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 373 | nfs_lookup_req(nfs_filename); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 374 | break; |
| 375 | case STATE_READ_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 376 | nfs_read_req(nfs_offset, nfs_len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 377 | break; |
| 378 | case STATE_READLINK_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 379 | nfs_readlink_req(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 380 | break; |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | /************************************************************************** |
| 385 | Handlers for the reply from server |
| 386 | **************************************************************************/ |
| 387 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 388 | static int rpc_lookup_reply(int prog, uchar *pkt, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 389 | { |
| 390 | struct rpc_t rpc_pkt; |
| 391 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 392 | memcpy((unsigned char *)&rpc_pkt, pkt, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 393 | |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 394 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 395 | |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 396 | if (ntohl(rpc_pkt.u.reply.id) > rpc_id) |
| 397 | return -NFS_RPC_ERR; |
| 398 | else if (ntohl(rpc_pkt.u.reply.id) < rpc_id) |
| 399 | return -NFS_RPC_DROP; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 400 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 401 | if (rpc_pkt.u.reply.rstatus || |
| 402 | rpc_pkt.u.reply.verifier || |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 403 | rpc_pkt.u.reply.astatus) |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 404 | return -1; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 405 | |
| 406 | switch (prog) { |
| 407 | case PROG_MOUNT: |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 408 | nfs_server_mount_port = ntohl(rpc_pkt.u.reply.data[0]); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 409 | break; |
| 410 | case PROG_NFS: |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 411 | nfs_server_port = ntohl(rpc_pkt.u.reply.data[0]); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 412 | break; |
| 413 | } |
| 414 | |
| 415 | return 0; |
| 416 | } |
| 417 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 418 | static int nfs_mount_reply(uchar *pkt, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 419 | { |
| 420 | struct rpc_t rpc_pkt; |
| 421 | |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 422 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 423 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 424 | memcpy((unsigned char *)&rpc_pkt, pkt, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 425 | |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 426 | if (ntohl(rpc_pkt.u.reply.id) > rpc_id) |
| 427 | return -NFS_RPC_ERR; |
| 428 | else if (ntohl(rpc_pkt.u.reply.id) < rpc_id) |
| 429 | return -NFS_RPC_DROP; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 430 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 431 | if (rpc_pkt.u.reply.rstatus || |
| 432 | rpc_pkt.u.reply.verifier || |
| 433 | rpc_pkt.u.reply.astatus || |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 434 | rpc_pkt.u.reply.data[0]) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 435 | return -1; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 436 | |
| 437 | fs_mounted = 1; |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 438 | memcpy(dirfh, rpc_pkt.u.reply.data + 1, NFS_FHSIZE); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 439 | |
| 440 | return 0; |
| 441 | } |
| 442 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 443 | static int nfs_umountall_reply(uchar *pkt, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 444 | { |
| 445 | struct rpc_t rpc_pkt; |
| 446 | |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 447 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 448 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 449 | memcpy((unsigned char *)&rpc_pkt, pkt, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 450 | |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 451 | if (ntohl(rpc_pkt.u.reply.id) > rpc_id) |
| 452 | return -NFS_RPC_ERR; |
| 453 | else if (ntohl(rpc_pkt.u.reply.id) < rpc_id) |
| 454 | return -NFS_RPC_DROP; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 455 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 456 | if (rpc_pkt.u.reply.rstatus || |
| 457 | rpc_pkt.u.reply.verifier || |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 458 | rpc_pkt.u.reply.astatus) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 459 | return -1; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 460 | |
| 461 | fs_mounted = 0; |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 462 | memset(dirfh, 0, sizeof(dirfh)); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 463 | |
| 464 | return 0; |
| 465 | } |
| 466 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 467 | static int nfs_lookup_reply(uchar *pkt, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 468 | { |
| 469 | struct rpc_t rpc_pkt; |
| 470 | |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 471 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 472 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 473 | memcpy((unsigned char *)&rpc_pkt, pkt, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 474 | |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 475 | if (ntohl(rpc_pkt.u.reply.id) > rpc_id) |
| 476 | return -NFS_RPC_ERR; |
| 477 | else if (ntohl(rpc_pkt.u.reply.id) < rpc_id) |
| 478 | return -NFS_RPC_DROP; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 479 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 480 | if (rpc_pkt.u.reply.rstatus || |
| 481 | rpc_pkt.u.reply.verifier || |
| 482 | rpc_pkt.u.reply.astatus || |
Guillaume GARDET | 7ba4c67 | 2016-06-06 15:11:45 +0200 | [diff] [blame] | 483 | rpc_pkt.u.reply.data[0]) { |
| 484 | switch (ntohl(rpc_pkt.u.reply.astatus)) { |
| 485 | case 0: /* Not an error */ |
| 486 | break; |
| 487 | case 2: /* Remote can't support NFS version */ |
| 488 | printf("*** ERROR: NFS version not supported: Requested: V%d, accepted: min V%d - max V%d\n", |
| 489 | 2, |
| 490 | ntohl(rpc_pkt.u.reply.data[0]), |
| 491 | ntohl(rpc_pkt.u.reply.data[1])); |
| 492 | break; |
| 493 | default: /* Unknown error on 'accept state' flag */ |
| 494 | printf("*** ERROR: accept state error (%d)\n", |
| 495 | ntohl(rpc_pkt.u.reply.astatus)); |
| 496 | break; |
| 497 | } |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 498 | return -1; |
Guillaume GARDET | 7ba4c67 | 2016-06-06 15:11:45 +0200 | [diff] [blame] | 499 | } |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 500 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 501 | memcpy(filefh, rpc_pkt.u.reply.data + 1, NFS_FHSIZE); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 502 | |
| 503 | return 0; |
| 504 | } |
| 505 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 506 | static int nfs_readlink_reply(uchar *pkt, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 507 | { |
| 508 | struct rpc_t rpc_pkt; |
| 509 | int rlen; |
| 510 | |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 511 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 512 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 513 | memcpy((unsigned char *)&rpc_pkt, pkt, len); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 514 | |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 515 | if (ntohl(rpc_pkt.u.reply.id) > rpc_id) |
| 516 | return -NFS_RPC_ERR; |
| 517 | else if (ntohl(rpc_pkt.u.reply.id) < rpc_id) |
| 518 | return -NFS_RPC_DROP; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 519 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 520 | if (rpc_pkt.u.reply.rstatus || |
| 521 | rpc_pkt.u.reply.verifier || |
| 522 | rpc_pkt.u.reply.astatus || |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 523 | rpc_pkt.u.reply.data[0]) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 524 | return -1; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 525 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 526 | rlen = ntohl(rpc_pkt.u.reply.data[1]); /* new path length */ |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 527 | |
| 528 | if (*((char *)&(rpc_pkt.u.reply.data[2])) != '/') { |
| 529 | int pathlen; |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 530 | strcat(nfs_path, "/"); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 531 | pathlen = strlen(nfs_path); |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 532 | memcpy(nfs_path + pathlen, (uchar *)&(rpc_pkt.u.reply.data[2]), |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 533 | rlen); |
Ed Swarthout | 867d870 | 2009-11-19 02:47:28 -0600 | [diff] [blame] | 534 | nfs_path[pathlen + rlen] = 0; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 535 | } else { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 536 | memcpy(nfs_path, (uchar *)&(rpc_pkt.u.reply.data[2]), rlen); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 537 | nfs_path[rlen] = 0; |
| 538 | } |
| 539 | return 0; |
| 540 | } |
| 541 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 542 | static int nfs_read_reply(uchar *pkt, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 543 | { |
| 544 | struct rpc_t rpc_pkt; |
| 545 | int rlen; |
| 546 | |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 547 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 548 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 549 | memcpy((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply)); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 550 | |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 551 | if (ntohl(rpc_pkt.u.reply.id) > rpc_id) |
| 552 | return -NFS_RPC_ERR; |
| 553 | else if (ntohl(rpc_pkt.u.reply.id) < rpc_id) |
| 554 | return -NFS_RPC_DROP; |
wdenk | acd9b10 | 2004-03-14 00:59:59 +0000 | [diff] [blame] | 555 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 556 | if (rpc_pkt.u.reply.rstatus || |
| 557 | rpc_pkt.u.reply.verifier || |
| 558 | rpc_pkt.u.reply.astatus || |
| 559 | rpc_pkt.u.reply.data[0]) { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 560 | if (rpc_pkt.u.reply.rstatus) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 561 | return -9999; |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 562 | if (rpc_pkt.u.reply.astatus) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 563 | return -9999; |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 564 | return -ntohl(rpc_pkt.u.reply.data[0]); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 565 | } |
| 566 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 567 | if ((nfs_offset != 0) && !((nfs_offset) % |
| 568 | (NFS_READ_SIZE / 2 * 10 * HASHES_PER_LINE))) |
| 569 | puts("\n\t "); |
| 570 | if (!(nfs_offset % ((NFS_READ_SIZE / 2) * 10))) |
| 571 | putc('#'); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 572 | |
| 573 | rlen = ntohl(rpc_pkt.u.reply.data[18]); |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 574 | if (store_block((uchar *)pkt + sizeof(rpc_pkt.u.reply), |
| 575 | nfs_offset, rlen)) |
Wolfgang Denk | b077b50 | 2005-08-06 01:11:12 +0200 | [diff] [blame] | 576 | return -9999; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 577 | |
| 578 | return rlen; |
| 579 | } |
| 580 | |
| 581 | /************************************************************************** |
| 582 | Interfaces of U-BOOT |
| 583 | **************************************************************************/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 584 | static void nfs_timeout_handler(void) |
wdenk | d9ee50d | 2004-09-28 21:51:42 +0000 | [diff] [blame] | 585 | { |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 586 | if (++nfs_timeout_count > NFS_RETRY_COUNT) { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 587 | puts("\nRetry count exceeded; starting again\n"); |
Joe Hershberger | c80b41b0 | 2015-04-08 01:41:21 -0500 | [diff] [blame] | 588 | net_start_again(); |
Evan Samanas | b956fba | 2009-11-09 20:08:36 -0600 | [diff] [blame] | 589 | } else { |
| 590 | puts("T "); |
Joe Hershberger | c80b41b0 | 2015-04-08 01:41:21 -0500 | [diff] [blame] | 591 | net_set_timeout_handler(nfs_timeout + |
| 592 | NFS_TIMEOUT * nfs_timeout_count, |
| 593 | nfs_timeout_handler); |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 594 | nfs_send(); |
Hiroshi Ito | 3702cd7 | 2008-01-31 18:35:04 +0900 | [diff] [blame] | 595 | } |
wdenk | d9ee50d | 2004-09-28 21:51:42 +0000 | [diff] [blame] | 596 | } |
| 597 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 598 | static void nfs_handler(uchar *pkt, unsigned dest, struct in_addr sip, |
| 599 | unsigned src, unsigned len) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 600 | { |
| 601 | int rlen; |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 602 | int reply; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 603 | |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 604 | debug("%s\n", __func__); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 605 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 606 | if (dest != nfs_our_port) |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 607 | return; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 608 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 609 | switch (nfs_state) { |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 610 | case STATE_PRCLOOKUP_PROG_MOUNT_REQ: |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 611 | if (rpc_lookup_reply(PROG_MOUNT, pkt, len) == -NFS_RPC_DROP) |
| 612 | break; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 613 | nfs_state = STATE_PRCLOOKUP_PROG_NFS_REQ; |
| 614 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 615 | break; |
| 616 | |
| 617 | case STATE_PRCLOOKUP_PROG_NFS_REQ: |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 618 | if (rpc_lookup_reply(PROG_NFS, pkt, len) == -NFS_RPC_DROP) |
| 619 | break; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 620 | nfs_state = STATE_MOUNT_REQ; |
| 621 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 622 | break; |
| 623 | |
| 624 | case STATE_MOUNT_REQ: |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 625 | reply = nfs_mount_reply(pkt, len); |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 626 | if (reply == -NFS_RPC_DROP) { |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 627 | break; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 628 | } else if (reply == -NFS_RPC_ERR) { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 629 | puts("*** ERROR: Cannot mount\n"); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 630 | /* just to be sure... */ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 631 | nfs_state = STATE_UMOUNT_REQ; |
| 632 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 633 | } else { |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 634 | nfs_state = STATE_LOOKUP_REQ; |
| 635 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 636 | } |
| 637 | break; |
| 638 | |
| 639 | case STATE_UMOUNT_REQ: |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 640 | reply = nfs_umountall_reply(pkt, len); |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 641 | if (reply == -NFS_RPC_DROP) { |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 642 | break; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 643 | } else if (reply == -NFS_RPC_ERR) { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 644 | puts("*** ERROR: Cannot umount\n"); |
Joe Hershberger | d4bb76a | 2012-05-23 07:59:14 +0000 | [diff] [blame] | 645 | net_set_state(NETLOOP_FAIL); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 646 | } else { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 647 | puts("\ndone\n"); |
Joe Hershberger | d4bb76a | 2012-05-23 07:59:14 +0000 | [diff] [blame] | 648 | net_set_state(nfs_download_state); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 649 | } |
| 650 | break; |
| 651 | |
| 652 | case STATE_LOOKUP_REQ: |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 653 | reply = nfs_lookup_reply(pkt, len); |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 654 | if (reply == -NFS_RPC_DROP) { |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 655 | break; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 656 | } else if (reply == -NFS_RPC_ERR) { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 657 | puts("*** ERROR: File lookup fail\n"); |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 658 | nfs_state = STATE_UMOUNT_REQ; |
| 659 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 660 | } else { |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 661 | nfs_state = STATE_READ_REQ; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 662 | nfs_offset = 0; |
| 663 | nfs_len = NFS_READ_SIZE; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 664 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 665 | } |
| 666 | break; |
| 667 | |
| 668 | case STATE_READLINK_REQ: |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 669 | reply = nfs_readlink_reply(pkt, len); |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 670 | if (reply == -NFS_RPC_DROP) { |
Matthias Brugger | b8d5b8c | 2012-12-11 19:14:16 +0100 | [diff] [blame] | 671 | break; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 672 | } else if (reply == -NFS_RPC_ERR) { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 673 | puts("*** ERROR: Symlink fail\n"); |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 674 | nfs_state = STATE_UMOUNT_REQ; |
| 675 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 676 | } else { |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 677 | debug("Symlink --> %s\n", nfs_path); |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 678 | nfs_filename = basename(nfs_path); |
| 679 | nfs_path = dirname(nfs_path); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 680 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 681 | nfs_state = STATE_MOUNT_REQ; |
| 682 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 683 | } |
| 684 | break; |
| 685 | |
| 686 | case STATE_READ_REQ: |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 687 | rlen = nfs_read_reply(pkt, len); |
Joe Hershberger | c80b41b0 | 2015-04-08 01:41:21 -0500 | [diff] [blame] | 688 | net_set_timeout_handler(nfs_timeout, nfs_timeout_handler); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 689 | if (rlen > 0) { |
| 690 | nfs_offset += rlen; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 691 | nfs_send(); |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 692 | } else if ((rlen == -NFSERR_ISDIR) || (rlen == -NFSERR_INVAL)) { |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 693 | /* symbolic link */ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 694 | nfs_state = STATE_READLINK_REQ; |
| 695 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 696 | } else { |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 697 | if (!rlen) |
Joe Hershberger | d4bb76a | 2012-05-23 07:59:14 +0000 | [diff] [blame] | 698 | nfs_download_state = NETLOOP_SUCCESS; |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 699 | nfs_state = STATE_UMOUNT_REQ; |
| 700 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 701 | } |
| 702 | break; |
| 703 | } |
| 704 | } |
| 705 | |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 706 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 707 | void nfs_start(void) |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 708 | { |
Robin Getz | 9e0a4d6 | 2009-07-23 03:01:03 -0400 | [diff] [blame] | 709 | debug("%s\n", __func__); |
Joe Hershberger | d4bb76a | 2012-05-23 07:59:14 +0000 | [diff] [blame] | 710 | nfs_download_state = NETLOOP_FAIL; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 711 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 712 | nfs_server_ip = net_server_ip; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 713 | nfs_path = (char *)nfs_path_buff; |
| 714 | |
| 715 | if (nfs_path == NULL) { |
Joe Hershberger | d4bb76a | 2012-05-23 07:59:14 +0000 | [diff] [blame] | 716 | net_set_state(NETLOOP_FAIL); |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 717 | puts("*** ERROR: Fail allocate memory\n"); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 718 | return; |
| 719 | } |
| 720 | |
Joe Hershberger | 290c899 | 2015-04-08 01:41:02 -0500 | [diff] [blame] | 721 | if (net_boot_file_name[0] == '\0') { |
Joe Hershberger | a8d4f89 | 2016-08-15 14:42:16 -0500 | [diff] [blame^] | 722 | sprintf(nfs_path, "/nfsroot/%02X%02X%02X%02X.img", |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 723 | net_ip.s_addr & 0xFF, |
| 724 | (net_ip.s_addr >> 8) & 0xFF, |
| 725 | (net_ip.s_addr >> 16) & 0xFF, |
| 726 | (net_ip.s_addr >> 24) & 0xFF); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 727 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 728 | printf("*** Warning: no boot file name; using '%s'\n", |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 729 | nfs_path); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 730 | } else { |
Joe Hershberger | 290c899 | 2015-04-08 01:41:02 -0500 | [diff] [blame] | 731 | char *p = net_boot_file_name; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 732 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 733 | p = strchr(p, ':'); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 734 | |
| 735 | if (p != NULL) { |
Joe Hershberger | 290c899 | 2015-04-08 01:41:02 -0500 | [diff] [blame] | 736 | nfs_server_ip = string_to_ip(net_boot_file_name); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 737 | ++p; |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 738 | strcpy(nfs_path, p); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 739 | } else { |
Joe Hershberger | 290c899 | 2015-04-08 01:41:02 -0500 | [diff] [blame] | 740 | strcpy(nfs_path, net_boot_file_name); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 741 | } |
| 742 | } |
| 743 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 744 | nfs_filename = basename(nfs_path); |
| 745 | nfs_path = dirname(nfs_path); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 746 | |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 747 | printf("Using %s device\n", eth_get_name()); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 748 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 749 | printf("File transfer via NFS from server %pI4; our IP address is %pI4", |
| 750 | &nfs_server_ip, &net_ip); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 751 | |
| 752 | /* Check if we need to send across this subnet */ |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 753 | if (net_gateway.s_addr && net_netmask.s_addr) { |
| 754 | struct in_addr our_net; |
| 755 | struct in_addr server_net; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 756 | |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 757 | our_net.s_addr = net_ip.s_addr & net_netmask.s_addr; |
| 758 | server_net.s_addr = net_server_ip.s_addr & net_netmask.s_addr; |
| 759 | if (our_net.s_addr != server_net.s_addr) |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 760 | printf("; sending through gateway %pI4", |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 761 | &net_gateway); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 762 | } |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 763 | printf("\nFilename '%s/%s'.", nfs_path, nfs_filename); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 764 | |
Joe Hershberger | 290c899 | 2015-04-08 01:41:02 -0500 | [diff] [blame] | 765 | if (net_boot_file_expected_size_in_blocks) { |
| 766 | printf(" Size is 0x%x Bytes = ", |
| 767 | net_boot_file_expected_size_in_blocks << 9); |
| 768 | print_size(net_boot_file_expected_size_in_blocks << 9, ""); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 769 | } |
Joe Hershberger | 6ecfc6b | 2012-05-15 08:59:09 +0000 | [diff] [blame] | 770 | printf("\nLoad address: 0x%lx\n" |
wdenk | 42c0547 | 2004-03-23 22:14:11 +0000 | [diff] [blame] | 771 | "Loading: *\b", load_addr); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 772 | |
Joe Hershberger | c80b41b0 | 2015-04-08 01:41:21 -0500 | [diff] [blame] | 773 | net_set_timeout_handler(nfs_timeout, nfs_timeout_handler); |
Joe Hershberger | 5874dec | 2015-04-08 01:41:01 -0500 | [diff] [blame] | 774 | net_set_udp_handler(nfs_handler); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 775 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 776 | nfs_timeout_count = 0; |
| 777 | nfs_state = STATE_PRCLOOKUP_PROG_MOUNT_REQ; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 778 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 779 | /*nfs_our_port = 4096 + (get_ticks() % 3072);*/ |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 780 | /*FIX ME !!!*/ |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 781 | nfs_our_port = 1000; |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 782 | |
| 783 | /* zero out server ether in case the server ip has changed */ |
Joe Hershberger | 8ecdbed | 2015-04-08 01:41:04 -0500 | [diff] [blame] | 784 | memset(net_server_ethaddr, 0, 6); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 785 | |
Joe Hershberger | 40d7ca9 | 2015-04-08 01:41:10 -0500 | [diff] [blame] | 786 | nfs_send(); |
wdenk | be9c1cb | 2004-02-24 02:00:03 +0000 | [diff] [blame] | 787 | } |