Loading fs/nfs/nfsroot.c +6 −7 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,7 @@ static char nfs_root_name[256] __initdata = ""; static char nfs_root_name[256] __initdata = ""; /* Address of NFS server */ /* Address of NFS server */ static __u32 servaddr __initdata = 0; static __be32 servaddr __initdata = 0; /* Name of directory to mount */ /* Name of directory to mount */ static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; Loading Loading @@ -327,7 +327,7 @@ static int __init root_nfs_name(char *name) */ */ static int __init root_nfs_addr(void) static int __init root_nfs_addr(void) { { if ((servaddr = root_server_addr) == INADDR_NONE) { if ((servaddr = root_server_addr) == htonl(INADDR_NONE)) { printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); return -1; return -1; } } Loading Loading @@ -411,7 +411,7 @@ __setup("nfsroot=", nfs_root_setup); * Construct sockaddr_in from address and port number. * Construct sockaddr_in from address and port number. */ */ static inline void static inline void set_sockaddr(struct sockaddr_in *sin, __u32 addr, __u16 port) set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port) { { sin->sin_family = AF_INET; sin->sin_family = AF_INET; sin->sin_addr.s_addr = addr; sin->sin_addr.s_addr = addr; Loading Loading @@ -468,14 +468,13 @@ static int __init root_nfs_ports(void) dprintk("Root-NFS: Portmapper on server returned %d " dprintk("Root-NFS: Portmapper on server returned %d " "as nfsd port\n", port); "as nfsd port\n", port); } } nfs_port = htons(nfs_port); if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { printk(KERN_ERR "Root-NFS: Unable to get mountd port " printk(KERN_ERR "Root-NFS: Unable to get mountd port " "number from server, using default\n"); "number from server, using default\n"); port = mountd_port; port = mountd_port; } } mount_port = htons(port); mount_port = port; dprintk("Root-NFS: mountd port is %d\n", port); dprintk("Root-NFS: mountd port is %d\n", port); return 0; return 0; Loading @@ -496,7 +495,7 @@ static int __init root_nfs_get_handle(void) int version = (nfs_data.flags & NFS_MOUNT_VER3) ? int version = (nfs_data.flags & NFS_MOUNT_VER3) ? NFS_MNT3_VERSION : NFS_MNT_VERSION; NFS_MNT3_VERSION : NFS_MNT_VERSION; set_sockaddr(&sin, servaddr, mount_port); set_sockaddr(&sin, servaddr, htons(mount_port)); status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); if (status < 0) if (status < 0) printk(KERN_ERR "Root-NFS: Server returned error %d " printk(KERN_ERR "Root-NFS: Server returned error %d " Loading @@ -519,6 +518,6 @@ void * __init nfs_root_data(void) || root_nfs_ports() < 0 || root_nfs_ports() < 0 || root_nfs_get_handle() < 0) || root_nfs_get_handle() < 0) return NULL; return NULL; set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port); set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, htons(nfs_port)); return (void*)&nfs_data; return (void*)&nfs_data; } } include/linux/nfs_fs.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -318,7 +318,7 @@ extern void put_nfs_open_context(struct nfs_open_context *ctx); extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ extern u32 root_nfs_parse_addr(char *name); /*__init*/ extern __be32 root_nfs_parse_addr(char *name); /*__init*/ static inline void nfs_fattr_init(struct nfs_fattr *fattr) static inline void nfs_fattr_init(struct nfs_fattr *fattr) { { Loading include/net/ipconfig.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -11,12 +11,12 @@ extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */ extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */ extern int ic_set_manually; /* IPconfig parameters set manually */ extern int ic_set_manually; /* IPconfig parameters set manually */ extern u32 ic_myaddr; /* My IP address */ extern __be32 ic_myaddr; /* My IP address */ extern u32 ic_gateway; /* Gateway IP address */ extern __be32 ic_gateway; /* Gateway IP address */ extern u32 ic_servaddr; /* Boot server IP address */ extern __be32 ic_servaddr; /* Boot server IP address */ extern u32 root_server_addr; /* Address of NFS server */ extern __be32 root_server_addr; /* Address of NFS server */ extern u8 root_server_path[]; /* Path to mount as root */ extern u8 root_server_path[]; /* Path to mount as root */ Loading net/ipv4/ipconfig.c +53 −52 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers #define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers - '3' from resolv.h */ - '3' from resolv.h */ #define NONE __constant_htonl(INADDR_NONE) /* /* * Public IP configuration * Public IP configuration Loading Loading @@ -129,19 +130,19 @@ int ic_proto_enabled __initdata = 0 static int ic_host_name_set __initdata = 0; /* Host name set by us? */ static int ic_host_name_set __initdata = 0; /* Host name set by us? */ u32 ic_myaddr = INADDR_NONE; /* My IP address */ __be32 ic_myaddr = NONE; /* My IP address */ static u32 ic_netmask = INADDR_NONE; /* Netmask for local subnet */ static __be32 ic_netmask = NONE; /* Netmask for local subnet */ u32 ic_gateway = INADDR_NONE; /* Gateway IP address */ __be32 ic_gateway = NONE; /* Gateway IP address */ u32 ic_servaddr = INADDR_NONE; /* Boot server IP address */ __be32 ic_servaddr = NONE; /* Boot server IP address */ u32 root_server_addr = INADDR_NONE; /* Address of NFS server */ __be32 root_server_addr = NONE; /* Address of NFS server */ u8 root_server_path[256] = { 0, }; /* Path to mount as root */ u8 root_server_path[256] = { 0, }; /* Path to mount as root */ /* Persistent data: */ /* Persistent data: */ static int ic_proto_used; /* Protocol used, if any */ static int ic_proto_used; /* Protocol used, if any */ static u32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ static u8 ic_domain[64]; /* DNS (not NIS) domain name */ static u8 ic_domain[64]; /* DNS (not NIS) domain name */ /* /* Loading Loading @@ -172,7 +173,7 @@ struct ic_device { struct net_device *dev; struct net_device *dev; unsigned short flags; unsigned short flags; short able; short able; u32 xid; __be32 xid; }; }; static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ Loading Loading @@ -223,7 +224,7 @@ static int __init ic_open_devs(void) d->flags = oflags; d->flags = oflags; d->able = able; d->able = able; if (able & IC_BOOTP) if (able & IC_BOOTP) get_random_bytes(&d->xid, sizeof(u32)); get_random_bytes(&d->xid, sizeof(__be32)); else else d->xid = 0; d->xid = 0; ic_proto_have_if |= able; ic_proto_have_if |= able; Loading Loading @@ -269,7 +270,7 @@ static void __init ic_close_devs(void) */ */ static inline void static inline void set_sockaddr(struct sockaddr_in *sin, u32 addr, u16 port) set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port) { { sin->sin_family = AF_INET; sin->sin_family = AF_INET; sin->sin_addr.s_addr = addr; sin->sin_addr.s_addr = addr; Loading Loading @@ -332,7 +333,7 @@ static int __init ic_setup_routes(void) { { /* No need to setup device routes, only the default route... */ /* No need to setup device routes, only the default route... */ if (ic_gateway != INADDR_NONE) { if (ic_gateway != NONE) { struct rtentry rm; struct rtentry rm; int err; int err; Loading Loading @@ -368,10 +369,10 @@ static int __init ic_defaults(void) if (!ic_host_name_set) if (!ic_host_name_set) sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); if (root_server_addr == INADDR_NONE) if (root_server_addr == NONE) root_server_addr = ic_servaddr; root_server_addr = ic_servaddr; if (ic_netmask == INADDR_NONE) { if (ic_netmask == NONE) { if (IN_CLASSA(ntohl(ic_myaddr))) if (IN_CLASSA(ntohl(ic_myaddr))) ic_netmask = htonl(IN_CLASSA_NET); ic_netmask = htonl(IN_CLASSA_NET); else if (IN_CLASSB(ntohl(ic_myaddr))) else if (IN_CLASSB(ntohl(ic_myaddr))) Loading Loading @@ -420,7 +421,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt { { struct arphdr *rarp; struct arphdr *rarp; unsigned char *rarp_ptr; unsigned char *rarp_ptr; u32 sip, tip; __be32 sip, tip; unsigned char *sha, *tha; /* s for "source", t for "target" */ unsigned char *sha, *tha; /* s for "source", t for "target" */ struct ic_device *d; struct ic_device *d; Loading Loading @@ -485,12 +486,12 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt goto drop_unlock; goto drop_unlock; /* Discard packets which are not from specified server. */ /* Discard packets which are not from specified server. */ if (ic_servaddr != INADDR_NONE && ic_servaddr != sip) if (ic_servaddr != NONE && ic_servaddr != sip) goto drop_unlock; goto drop_unlock; /* We have a winner! */ /* We have a winner! */ ic_dev = dev; ic_dev = dev; if (ic_myaddr == INADDR_NONE) if (ic_myaddr == NONE) ic_myaddr = tip; ic_myaddr = tip; ic_servaddr = sip; ic_servaddr = sip; ic_got_reply = IC_RARP; ic_got_reply = IC_RARP; Loading Loading @@ -530,13 +531,13 @@ struct bootp_pkt { /* BOOTP packet format */ u8 htype; /* HW address type */ u8 htype; /* HW address type */ u8 hlen; /* HW address length */ u8 hlen; /* HW address length */ u8 hops; /* Used only by gateways */ u8 hops; /* Used only by gateways */ u32 xid; /* Transaction ID */ __be32 xid; /* Transaction ID */ u16 secs; /* Seconds since we started */ __be16 secs; /* Seconds since we started */ u16 flags; /* Just what it says */ __be16 flags; /* Just what it says */ u32 client_ip; /* Client's IP address if known */ __be32 client_ip; /* Client's IP address if known */ u32 your_ip; /* Assigned IP address */ __be32 your_ip; /* Assigned IP address */ u32 server_ip; /* (Next, e.g. NFS) Server's IP address */ __be32 server_ip; /* (Next, e.g. NFS) Server's IP address */ u32 relay_ip; /* IP address of BOOTP relay */ __be32 relay_ip; /* IP address of BOOTP relay */ u8 hw_addr[16]; /* Client's HW address */ u8 hw_addr[16]; /* Client's HW address */ u8 serv_name[64]; /* Server host name */ u8 serv_name[64]; /* Server host name */ u8 boot_file[128]; /* Name of boot file */ u8 boot_file[128]; /* Name of boot file */ Loading Loading @@ -576,7 +577,7 @@ static const u8 ic_bootp_cookie[4] = { 99, 130, 83, 99 }; static void __init static void __init ic_dhcp_init_options(u8 *options) ic_dhcp_init_options(u8 *options) { { u8 mt = ((ic_servaddr == INADDR_NONE) u8 mt = ((ic_servaddr == NONE) ? DHCPDISCOVER : DHCPREQUEST); ? DHCPDISCOVER : DHCPREQUEST); u8 *e = options; u8 *e = options; Loading Loading @@ -666,7 +667,7 @@ static inline void ic_bootp_init(void) int i; int i; for (i = 0; i < CONF_NAMESERVERS_MAX; i++) for (i = 0; i < CONF_NAMESERVERS_MAX; i++) ic_nameservers[i] = INADDR_NONE; ic_nameservers[i] = NONE; dev_add_pack(&bootp_packet_type); dev_add_pack(&bootp_packet_type); } } Loading Loading @@ -708,7 +709,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d h->frag_off = htons(IP_DF); h->frag_off = htons(IP_DF); h->ttl = 64; h->ttl = 64; h->protocol = IPPROTO_UDP; h->protocol = IPPROTO_UDP; h->daddr = INADDR_BROADCAST; h->daddr = htonl(INADDR_BROADCAST); h->check = ip_fast_csum((unsigned char *) h, h->ihl); h->check = ip_fast_csum((unsigned char *) h, h->ihl); /* Construct UDP header */ /* Construct UDP header */ Loading @@ -730,8 +731,8 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d b->htype = dev->type; /* can cause undefined behavior */ b->htype = dev->type; /* can cause undefined behavior */ } } b->hlen = dev->addr_len; b->hlen = dev->addr_len; b->your_ip = INADDR_NONE; b->your_ip = NONE; b->server_ip = INADDR_NONE; b->server_ip = NONE; memcpy(b->hw_addr, dev->dev_addr, dev->addr_len); memcpy(b->hw_addr, dev->dev_addr, dev->addr_len); b->secs = htons(jiffies_diff / HZ); b->secs = htons(jiffies_diff / HZ); b->xid = d->xid; b->xid = d->xid; Loading Loading @@ -788,11 +789,11 @@ static void __init ic_do_bootp_ext(u8 *ext) switch (*ext++) { switch (*ext++) { case 1: /* Subnet mask */ case 1: /* Subnet mask */ if (ic_netmask == INADDR_NONE) if (ic_netmask == NONE) memcpy(&ic_netmask, ext+1, 4); memcpy(&ic_netmask, ext+1, 4); break; break; case 3: /* Default gateway */ case 3: /* Default gateway */ if (ic_gateway == INADDR_NONE) if (ic_gateway == NONE) memcpy(&ic_gateway, ext+1, 4); memcpy(&ic_gateway, ext+1, 4); break; break; case 6: /* DNS server */ case 6: /* DNS server */ Loading @@ -800,7 +801,7 @@ static void __init ic_do_bootp_ext(u8 *ext) if (servers > CONF_NAMESERVERS_MAX) if (servers > CONF_NAMESERVERS_MAX) servers = CONF_NAMESERVERS_MAX; servers = CONF_NAMESERVERS_MAX; for (i = 0; i < servers; i++) { for (i = 0; i < servers; i++) { if (ic_nameservers[i] == INADDR_NONE) if (ic_nameservers[i] == NONE) memcpy(&ic_nameservers[i], ext+1+4*i, 4); memcpy(&ic_nameservers[i], ext+1+4*i, 4); } } break; break; Loading Loading @@ -917,7 +918,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str #ifdef IPCONFIG_DHCP #ifdef IPCONFIG_DHCP if (ic_proto_enabled & IC_USE_DHCP) { if (ic_proto_enabled & IC_USE_DHCP) { u32 server_id = INADDR_NONE; __be32 server_id = NONE; int mt = 0; int mt = 0; ext = &b->exten[4]; ext = &b->exten[4]; Loading Loading @@ -949,7 +950,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str /* While in the process of accepting one offer, /* While in the process of accepting one offer, * ignore all others. * ignore all others. */ */ if (ic_myaddr != INADDR_NONE) if (ic_myaddr != NONE) goto drop_unlock; goto drop_unlock; /* Let's accept that offer. */ /* Let's accept that offer. */ Loading @@ -965,7 +966,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str * precedence over the bootp header one if * precedence over the bootp header one if * they are different. * they are different. */ */ if ((server_id != INADDR_NONE) && if ((server_id != NONE) && (b->server_ip != server_id)) (b->server_ip != server_id)) b->server_ip = ic_servaddr; b->server_ip = ic_servaddr; break; break; Loading @@ -979,8 +980,8 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str default: default: /* Urque. Forget it*/ /* Urque. Forget it*/ ic_myaddr = INADDR_NONE; ic_myaddr = NONE; ic_servaddr = INADDR_NONE; ic_servaddr = NONE; goto drop_unlock; goto drop_unlock; }; }; Loading @@ -1004,9 +1005,9 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ic_dev = dev; ic_dev = dev; ic_myaddr = b->your_ip; ic_myaddr = b->your_ip; ic_servaddr = b->server_ip; ic_servaddr = b->server_ip; if (ic_gateway == INADDR_NONE && b->relay_ip) if (ic_gateway == NONE && b->relay_ip) ic_gateway = b->relay_ip; ic_gateway = b->relay_ip; if (ic_nameservers[0] == INADDR_NONE) if (ic_nameservers[0] == NONE) ic_nameservers[0] = ic_servaddr; ic_nameservers[0] = ic_servaddr; ic_got_reply = IC_BOOTP; ic_got_reply = IC_BOOTP; Loading Loading @@ -1150,7 +1151,7 @@ static int __init ic_dynamic(void) #endif #endif if (!ic_got_reply) { if (!ic_got_reply) { ic_myaddr = INADDR_NONE; ic_myaddr = NONE; return -1; return -1; } } Loading Loading @@ -1182,12 +1183,12 @@ static int pnp_seq_show(struct seq_file *seq, void *v) seq_printf(seq, seq_printf(seq, "domain %s\n", ic_domain); "domain %s\n", ic_domain); for (i = 0; i < CONF_NAMESERVERS_MAX; i++) { for (i = 0; i < CONF_NAMESERVERS_MAX; i++) { if (ic_nameservers[i] != INADDR_NONE) if (ic_nameservers[i] != NONE) seq_printf(seq, seq_printf(seq, "nameserver %u.%u.%u.%u\n", "nameserver %u.%u.%u.%u\n", NIPQUAD(ic_nameservers[i])); NIPQUAD(ic_nameservers[i])); } } if (ic_servaddr != INADDR_NONE) if (ic_servaddr != NONE) seq_printf(seq, seq_printf(seq, "bootserver %u.%u.%u.%u\n", "bootserver %u.%u.%u.%u\n", NIPQUAD(ic_servaddr)); NIPQUAD(ic_servaddr)); Loading @@ -1213,9 +1214,9 @@ static struct file_operations pnp_seq_fops = { * need to have root_server_addr set _before_ IPConfig gets called as it * need to have root_server_addr set _before_ IPConfig gets called as it * can override it. * can override it. */ */ u32 __init root_nfs_parse_addr(char *name) __be32 __init root_nfs_parse_addr(char *name) { { u32 addr; __be32 addr; int octets = 0; int octets = 0; char *cp, *cq; char *cp, *cq; Loading @@ -1237,7 +1238,7 @@ u32 __init root_nfs_parse_addr(char *name) addr = in_aton(name); addr = in_aton(name); memmove(name, cp, strlen(cp) + 1); memmove(name, cp, strlen(cp) + 1); } else } else addr = INADDR_NONE; addr = NONE; return addr; return addr; } } Loading @@ -1248,7 +1249,7 @@ u32 __init root_nfs_parse_addr(char *name) static int __init ip_auto_config(void) static int __init ip_auto_config(void) { { u32 addr; __be32 addr; #ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS proc_net_fops_create("pnp", S_IRUGO, &pnp_seq_fops); proc_net_fops_create("pnp", S_IRUGO, &pnp_seq_fops); Loading Loading @@ -1277,11 +1278,11 @@ static int __init ip_auto_config(void) * interfaces and no default was set), use BOOTP or RARP to get the * interfaces and no default was set), use BOOTP or RARP to get the * missing values. * missing values. */ */ if (ic_myaddr == INADDR_NONE || if (ic_myaddr == NONE || #ifdef CONFIG_ROOT_NFS #ifdef CONFIG_ROOT_NFS (MAJOR(ROOT_DEV) == UNNAMED_MAJOR (MAJOR(ROOT_DEV) == UNNAMED_MAJOR && root_server_addr == INADDR_NONE && root_server_addr == NONE && ic_servaddr == INADDR_NONE) || && ic_servaddr == NONE) || #endif #endif ic_first_dev->next) { ic_first_dev->next) { #ifdef IPCONFIG_DYNAMIC #ifdef IPCONFIG_DYNAMIC Loading Loading @@ -1334,7 +1335,7 @@ static int __init ip_auto_config(void) } } addr = root_nfs_parse_addr(root_server_path); addr = root_nfs_parse_addr(root_server_path); if (root_server_addr == INADDR_NONE) if (root_server_addr == NONE) root_server_addr = addr; root_server_addr = addr; /* /* Loading Loading @@ -1461,19 +1462,19 @@ static int __init ip_auto_config_setup(char *addrs) switch (num) { switch (num) { case 0: case 0: if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) ic_myaddr = INADDR_NONE; ic_myaddr = NONE; break; break; case 1: case 1: if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) ic_servaddr = INADDR_NONE; ic_servaddr = NONE; break; break; case 2: case 2: if ((ic_gateway = in_aton(ip)) == INADDR_ANY) if ((ic_gateway = in_aton(ip)) == INADDR_ANY) ic_gateway = INADDR_NONE; ic_gateway = NONE; break; break; case 3: case 3: if ((ic_netmask = in_aton(ip)) == INADDR_ANY) if ((ic_netmask = in_aton(ip)) == INADDR_ANY) ic_netmask = INADDR_NONE; ic_netmask = NONE; break; break; case 4: case 4: if ((dp = strchr(ip, '.'))) { if ((dp = strchr(ip, '.'))) { Loading Loading
fs/nfs/nfsroot.c +6 −7 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,7 @@ static char nfs_root_name[256] __initdata = ""; static char nfs_root_name[256] __initdata = ""; /* Address of NFS server */ /* Address of NFS server */ static __u32 servaddr __initdata = 0; static __be32 servaddr __initdata = 0; /* Name of directory to mount */ /* Name of directory to mount */ static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, }; Loading Loading @@ -327,7 +327,7 @@ static int __init root_nfs_name(char *name) */ */ static int __init root_nfs_addr(void) static int __init root_nfs_addr(void) { { if ((servaddr = root_server_addr) == INADDR_NONE) { if ((servaddr = root_server_addr) == htonl(INADDR_NONE)) { printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); printk(KERN_ERR "Root-NFS: No NFS server available, giving up.\n"); return -1; return -1; } } Loading Loading @@ -411,7 +411,7 @@ __setup("nfsroot=", nfs_root_setup); * Construct sockaddr_in from address and port number. * Construct sockaddr_in from address and port number. */ */ static inline void static inline void set_sockaddr(struct sockaddr_in *sin, __u32 addr, __u16 port) set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port) { { sin->sin_family = AF_INET; sin->sin_family = AF_INET; sin->sin_addr.s_addr = addr; sin->sin_addr.s_addr = addr; Loading Loading @@ -468,14 +468,13 @@ static int __init root_nfs_ports(void) dprintk("Root-NFS: Portmapper on server returned %d " dprintk("Root-NFS: Portmapper on server returned %d " "as nfsd port\n", port); "as nfsd port\n", port); } } nfs_port = htons(nfs_port); if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { printk(KERN_ERR "Root-NFS: Unable to get mountd port " printk(KERN_ERR "Root-NFS: Unable to get mountd port " "number from server, using default\n"); "number from server, using default\n"); port = mountd_port; port = mountd_port; } } mount_port = htons(port); mount_port = port; dprintk("Root-NFS: mountd port is %d\n", port); dprintk("Root-NFS: mountd port is %d\n", port); return 0; return 0; Loading @@ -496,7 +495,7 @@ static int __init root_nfs_get_handle(void) int version = (nfs_data.flags & NFS_MOUNT_VER3) ? int version = (nfs_data.flags & NFS_MOUNT_VER3) ? NFS_MNT3_VERSION : NFS_MNT_VERSION; NFS_MNT3_VERSION : NFS_MNT_VERSION; set_sockaddr(&sin, servaddr, mount_port); set_sockaddr(&sin, servaddr, htons(mount_port)); status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); status = nfsroot_mount(&sin, nfs_path, &fh, version, protocol); if (status < 0) if (status < 0) printk(KERN_ERR "Root-NFS: Server returned error %d " printk(KERN_ERR "Root-NFS: Server returned error %d " Loading @@ -519,6 +518,6 @@ void * __init nfs_root_data(void) || root_nfs_ports() < 0 || root_nfs_ports() < 0 || root_nfs_get_handle() < 0) || root_nfs_get_handle() < 0) return NULL; return NULL; set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port); set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, htons(nfs_port)); return (void*)&nfs_data; return (void*)&nfs_data; } }
include/linux/nfs_fs.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -318,7 +318,7 @@ extern void put_nfs_open_context(struct nfs_open_context *ctx); extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ extern u32 root_nfs_parse_addr(char *name); /*__init*/ extern __be32 root_nfs_parse_addr(char *name); /*__init*/ static inline void nfs_fattr_init(struct nfs_fattr *fattr) static inline void nfs_fattr_init(struct nfs_fattr *fattr) { { Loading
include/net/ipconfig.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -11,12 +11,12 @@ extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */ extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */ extern int ic_set_manually; /* IPconfig parameters set manually */ extern int ic_set_manually; /* IPconfig parameters set manually */ extern u32 ic_myaddr; /* My IP address */ extern __be32 ic_myaddr; /* My IP address */ extern u32 ic_gateway; /* Gateway IP address */ extern __be32 ic_gateway; /* Gateway IP address */ extern u32 ic_servaddr; /* Boot server IP address */ extern __be32 ic_servaddr; /* Boot server IP address */ extern u32 root_server_addr; /* Address of NFS server */ extern __be32 root_server_addr; /* Address of NFS server */ extern u8 root_server_path[]; /* Path to mount as root */ extern u8 root_server_path[]; /* Path to mount as root */ Loading
net/ipv4/ipconfig.c +53 −52 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,7 @@ #define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers #define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers - '3' from resolv.h */ - '3' from resolv.h */ #define NONE __constant_htonl(INADDR_NONE) /* /* * Public IP configuration * Public IP configuration Loading Loading @@ -129,19 +130,19 @@ int ic_proto_enabled __initdata = 0 static int ic_host_name_set __initdata = 0; /* Host name set by us? */ static int ic_host_name_set __initdata = 0; /* Host name set by us? */ u32 ic_myaddr = INADDR_NONE; /* My IP address */ __be32 ic_myaddr = NONE; /* My IP address */ static u32 ic_netmask = INADDR_NONE; /* Netmask for local subnet */ static __be32 ic_netmask = NONE; /* Netmask for local subnet */ u32 ic_gateway = INADDR_NONE; /* Gateway IP address */ __be32 ic_gateway = NONE; /* Gateway IP address */ u32 ic_servaddr = INADDR_NONE; /* Boot server IP address */ __be32 ic_servaddr = NONE; /* Boot server IP address */ u32 root_server_addr = INADDR_NONE; /* Address of NFS server */ __be32 root_server_addr = NONE; /* Address of NFS server */ u8 root_server_path[256] = { 0, }; /* Path to mount as root */ u8 root_server_path[256] = { 0, }; /* Path to mount as root */ /* Persistent data: */ /* Persistent data: */ static int ic_proto_used; /* Protocol used, if any */ static int ic_proto_used; /* Protocol used, if any */ static u32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */ static u8 ic_domain[64]; /* DNS (not NIS) domain name */ static u8 ic_domain[64]; /* DNS (not NIS) domain name */ /* /* Loading Loading @@ -172,7 +173,7 @@ struct ic_device { struct net_device *dev; struct net_device *dev; unsigned short flags; unsigned short flags; short able; short able; u32 xid; __be32 xid; }; }; static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */ Loading Loading @@ -223,7 +224,7 @@ static int __init ic_open_devs(void) d->flags = oflags; d->flags = oflags; d->able = able; d->able = able; if (able & IC_BOOTP) if (able & IC_BOOTP) get_random_bytes(&d->xid, sizeof(u32)); get_random_bytes(&d->xid, sizeof(__be32)); else else d->xid = 0; d->xid = 0; ic_proto_have_if |= able; ic_proto_have_if |= able; Loading Loading @@ -269,7 +270,7 @@ static void __init ic_close_devs(void) */ */ static inline void static inline void set_sockaddr(struct sockaddr_in *sin, u32 addr, u16 port) set_sockaddr(struct sockaddr_in *sin, __be32 addr, __be16 port) { { sin->sin_family = AF_INET; sin->sin_family = AF_INET; sin->sin_addr.s_addr = addr; sin->sin_addr.s_addr = addr; Loading Loading @@ -332,7 +333,7 @@ static int __init ic_setup_routes(void) { { /* No need to setup device routes, only the default route... */ /* No need to setup device routes, only the default route... */ if (ic_gateway != INADDR_NONE) { if (ic_gateway != NONE) { struct rtentry rm; struct rtentry rm; int err; int err; Loading Loading @@ -368,10 +369,10 @@ static int __init ic_defaults(void) if (!ic_host_name_set) if (!ic_host_name_set) sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); if (root_server_addr == INADDR_NONE) if (root_server_addr == NONE) root_server_addr = ic_servaddr; root_server_addr = ic_servaddr; if (ic_netmask == INADDR_NONE) { if (ic_netmask == NONE) { if (IN_CLASSA(ntohl(ic_myaddr))) if (IN_CLASSA(ntohl(ic_myaddr))) ic_netmask = htonl(IN_CLASSA_NET); ic_netmask = htonl(IN_CLASSA_NET); else if (IN_CLASSB(ntohl(ic_myaddr))) else if (IN_CLASSB(ntohl(ic_myaddr))) Loading Loading @@ -420,7 +421,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt { { struct arphdr *rarp; struct arphdr *rarp; unsigned char *rarp_ptr; unsigned char *rarp_ptr; u32 sip, tip; __be32 sip, tip; unsigned char *sha, *tha; /* s for "source", t for "target" */ unsigned char *sha, *tha; /* s for "source", t for "target" */ struct ic_device *d; struct ic_device *d; Loading Loading @@ -485,12 +486,12 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt goto drop_unlock; goto drop_unlock; /* Discard packets which are not from specified server. */ /* Discard packets which are not from specified server. */ if (ic_servaddr != INADDR_NONE && ic_servaddr != sip) if (ic_servaddr != NONE && ic_servaddr != sip) goto drop_unlock; goto drop_unlock; /* We have a winner! */ /* We have a winner! */ ic_dev = dev; ic_dev = dev; if (ic_myaddr == INADDR_NONE) if (ic_myaddr == NONE) ic_myaddr = tip; ic_myaddr = tip; ic_servaddr = sip; ic_servaddr = sip; ic_got_reply = IC_RARP; ic_got_reply = IC_RARP; Loading Loading @@ -530,13 +531,13 @@ struct bootp_pkt { /* BOOTP packet format */ u8 htype; /* HW address type */ u8 htype; /* HW address type */ u8 hlen; /* HW address length */ u8 hlen; /* HW address length */ u8 hops; /* Used only by gateways */ u8 hops; /* Used only by gateways */ u32 xid; /* Transaction ID */ __be32 xid; /* Transaction ID */ u16 secs; /* Seconds since we started */ __be16 secs; /* Seconds since we started */ u16 flags; /* Just what it says */ __be16 flags; /* Just what it says */ u32 client_ip; /* Client's IP address if known */ __be32 client_ip; /* Client's IP address if known */ u32 your_ip; /* Assigned IP address */ __be32 your_ip; /* Assigned IP address */ u32 server_ip; /* (Next, e.g. NFS) Server's IP address */ __be32 server_ip; /* (Next, e.g. NFS) Server's IP address */ u32 relay_ip; /* IP address of BOOTP relay */ __be32 relay_ip; /* IP address of BOOTP relay */ u8 hw_addr[16]; /* Client's HW address */ u8 hw_addr[16]; /* Client's HW address */ u8 serv_name[64]; /* Server host name */ u8 serv_name[64]; /* Server host name */ u8 boot_file[128]; /* Name of boot file */ u8 boot_file[128]; /* Name of boot file */ Loading Loading @@ -576,7 +577,7 @@ static const u8 ic_bootp_cookie[4] = { 99, 130, 83, 99 }; static void __init static void __init ic_dhcp_init_options(u8 *options) ic_dhcp_init_options(u8 *options) { { u8 mt = ((ic_servaddr == INADDR_NONE) u8 mt = ((ic_servaddr == NONE) ? DHCPDISCOVER : DHCPREQUEST); ? DHCPDISCOVER : DHCPREQUEST); u8 *e = options; u8 *e = options; Loading Loading @@ -666,7 +667,7 @@ static inline void ic_bootp_init(void) int i; int i; for (i = 0; i < CONF_NAMESERVERS_MAX; i++) for (i = 0; i < CONF_NAMESERVERS_MAX; i++) ic_nameservers[i] = INADDR_NONE; ic_nameservers[i] = NONE; dev_add_pack(&bootp_packet_type); dev_add_pack(&bootp_packet_type); } } Loading Loading @@ -708,7 +709,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d h->frag_off = htons(IP_DF); h->frag_off = htons(IP_DF); h->ttl = 64; h->ttl = 64; h->protocol = IPPROTO_UDP; h->protocol = IPPROTO_UDP; h->daddr = INADDR_BROADCAST; h->daddr = htonl(INADDR_BROADCAST); h->check = ip_fast_csum((unsigned char *) h, h->ihl); h->check = ip_fast_csum((unsigned char *) h, h->ihl); /* Construct UDP header */ /* Construct UDP header */ Loading @@ -730,8 +731,8 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d b->htype = dev->type; /* can cause undefined behavior */ b->htype = dev->type; /* can cause undefined behavior */ } } b->hlen = dev->addr_len; b->hlen = dev->addr_len; b->your_ip = INADDR_NONE; b->your_ip = NONE; b->server_ip = INADDR_NONE; b->server_ip = NONE; memcpy(b->hw_addr, dev->dev_addr, dev->addr_len); memcpy(b->hw_addr, dev->dev_addr, dev->addr_len); b->secs = htons(jiffies_diff / HZ); b->secs = htons(jiffies_diff / HZ); b->xid = d->xid; b->xid = d->xid; Loading Loading @@ -788,11 +789,11 @@ static void __init ic_do_bootp_ext(u8 *ext) switch (*ext++) { switch (*ext++) { case 1: /* Subnet mask */ case 1: /* Subnet mask */ if (ic_netmask == INADDR_NONE) if (ic_netmask == NONE) memcpy(&ic_netmask, ext+1, 4); memcpy(&ic_netmask, ext+1, 4); break; break; case 3: /* Default gateway */ case 3: /* Default gateway */ if (ic_gateway == INADDR_NONE) if (ic_gateway == NONE) memcpy(&ic_gateway, ext+1, 4); memcpy(&ic_gateway, ext+1, 4); break; break; case 6: /* DNS server */ case 6: /* DNS server */ Loading @@ -800,7 +801,7 @@ static void __init ic_do_bootp_ext(u8 *ext) if (servers > CONF_NAMESERVERS_MAX) if (servers > CONF_NAMESERVERS_MAX) servers = CONF_NAMESERVERS_MAX; servers = CONF_NAMESERVERS_MAX; for (i = 0; i < servers; i++) { for (i = 0; i < servers; i++) { if (ic_nameservers[i] == INADDR_NONE) if (ic_nameservers[i] == NONE) memcpy(&ic_nameservers[i], ext+1+4*i, 4); memcpy(&ic_nameservers[i], ext+1+4*i, 4); } } break; break; Loading Loading @@ -917,7 +918,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str #ifdef IPCONFIG_DHCP #ifdef IPCONFIG_DHCP if (ic_proto_enabled & IC_USE_DHCP) { if (ic_proto_enabled & IC_USE_DHCP) { u32 server_id = INADDR_NONE; __be32 server_id = NONE; int mt = 0; int mt = 0; ext = &b->exten[4]; ext = &b->exten[4]; Loading Loading @@ -949,7 +950,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str /* While in the process of accepting one offer, /* While in the process of accepting one offer, * ignore all others. * ignore all others. */ */ if (ic_myaddr != INADDR_NONE) if (ic_myaddr != NONE) goto drop_unlock; goto drop_unlock; /* Let's accept that offer. */ /* Let's accept that offer. */ Loading @@ -965,7 +966,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str * precedence over the bootp header one if * precedence over the bootp header one if * they are different. * they are different. */ */ if ((server_id != INADDR_NONE) && if ((server_id != NONE) && (b->server_ip != server_id)) (b->server_ip != server_id)) b->server_ip = ic_servaddr; b->server_ip = ic_servaddr; break; break; Loading @@ -979,8 +980,8 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str default: default: /* Urque. Forget it*/ /* Urque. Forget it*/ ic_myaddr = INADDR_NONE; ic_myaddr = NONE; ic_servaddr = INADDR_NONE; ic_servaddr = NONE; goto drop_unlock; goto drop_unlock; }; }; Loading @@ -1004,9 +1005,9 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ic_dev = dev; ic_dev = dev; ic_myaddr = b->your_ip; ic_myaddr = b->your_ip; ic_servaddr = b->server_ip; ic_servaddr = b->server_ip; if (ic_gateway == INADDR_NONE && b->relay_ip) if (ic_gateway == NONE && b->relay_ip) ic_gateway = b->relay_ip; ic_gateway = b->relay_ip; if (ic_nameservers[0] == INADDR_NONE) if (ic_nameservers[0] == NONE) ic_nameservers[0] = ic_servaddr; ic_nameservers[0] = ic_servaddr; ic_got_reply = IC_BOOTP; ic_got_reply = IC_BOOTP; Loading Loading @@ -1150,7 +1151,7 @@ static int __init ic_dynamic(void) #endif #endif if (!ic_got_reply) { if (!ic_got_reply) { ic_myaddr = INADDR_NONE; ic_myaddr = NONE; return -1; return -1; } } Loading Loading @@ -1182,12 +1183,12 @@ static int pnp_seq_show(struct seq_file *seq, void *v) seq_printf(seq, seq_printf(seq, "domain %s\n", ic_domain); "domain %s\n", ic_domain); for (i = 0; i < CONF_NAMESERVERS_MAX; i++) { for (i = 0; i < CONF_NAMESERVERS_MAX; i++) { if (ic_nameservers[i] != INADDR_NONE) if (ic_nameservers[i] != NONE) seq_printf(seq, seq_printf(seq, "nameserver %u.%u.%u.%u\n", "nameserver %u.%u.%u.%u\n", NIPQUAD(ic_nameservers[i])); NIPQUAD(ic_nameservers[i])); } } if (ic_servaddr != INADDR_NONE) if (ic_servaddr != NONE) seq_printf(seq, seq_printf(seq, "bootserver %u.%u.%u.%u\n", "bootserver %u.%u.%u.%u\n", NIPQUAD(ic_servaddr)); NIPQUAD(ic_servaddr)); Loading @@ -1213,9 +1214,9 @@ static struct file_operations pnp_seq_fops = { * need to have root_server_addr set _before_ IPConfig gets called as it * need to have root_server_addr set _before_ IPConfig gets called as it * can override it. * can override it. */ */ u32 __init root_nfs_parse_addr(char *name) __be32 __init root_nfs_parse_addr(char *name) { { u32 addr; __be32 addr; int octets = 0; int octets = 0; char *cp, *cq; char *cp, *cq; Loading @@ -1237,7 +1238,7 @@ u32 __init root_nfs_parse_addr(char *name) addr = in_aton(name); addr = in_aton(name); memmove(name, cp, strlen(cp) + 1); memmove(name, cp, strlen(cp) + 1); } else } else addr = INADDR_NONE; addr = NONE; return addr; return addr; } } Loading @@ -1248,7 +1249,7 @@ u32 __init root_nfs_parse_addr(char *name) static int __init ip_auto_config(void) static int __init ip_auto_config(void) { { u32 addr; __be32 addr; #ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS proc_net_fops_create("pnp", S_IRUGO, &pnp_seq_fops); proc_net_fops_create("pnp", S_IRUGO, &pnp_seq_fops); Loading Loading @@ -1277,11 +1278,11 @@ static int __init ip_auto_config(void) * interfaces and no default was set), use BOOTP or RARP to get the * interfaces and no default was set), use BOOTP or RARP to get the * missing values. * missing values. */ */ if (ic_myaddr == INADDR_NONE || if (ic_myaddr == NONE || #ifdef CONFIG_ROOT_NFS #ifdef CONFIG_ROOT_NFS (MAJOR(ROOT_DEV) == UNNAMED_MAJOR (MAJOR(ROOT_DEV) == UNNAMED_MAJOR && root_server_addr == INADDR_NONE && root_server_addr == NONE && ic_servaddr == INADDR_NONE) || && ic_servaddr == NONE) || #endif #endif ic_first_dev->next) { ic_first_dev->next) { #ifdef IPCONFIG_DYNAMIC #ifdef IPCONFIG_DYNAMIC Loading Loading @@ -1334,7 +1335,7 @@ static int __init ip_auto_config(void) } } addr = root_nfs_parse_addr(root_server_path); addr = root_nfs_parse_addr(root_server_path); if (root_server_addr == INADDR_NONE) if (root_server_addr == NONE) root_server_addr = addr; root_server_addr = addr; /* /* Loading Loading @@ -1461,19 +1462,19 @@ static int __init ip_auto_config_setup(char *addrs) switch (num) { switch (num) { case 0: case 0: if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) if ((ic_myaddr = in_aton(ip)) == INADDR_ANY) ic_myaddr = INADDR_NONE; ic_myaddr = NONE; break; break; case 1: case 1: if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) if ((ic_servaddr = in_aton(ip)) == INADDR_ANY) ic_servaddr = INADDR_NONE; ic_servaddr = NONE; break; break; case 2: case 2: if ((ic_gateway = in_aton(ip)) == INADDR_ANY) if ((ic_gateway = in_aton(ip)) == INADDR_ANY) ic_gateway = INADDR_NONE; ic_gateway = NONE; break; break; case 3: case 3: if ((ic_netmask = in_aton(ip)) == INADDR_ANY) if ((ic_netmask = in_aton(ip)) == INADDR_ANY) ic_netmask = INADDR_NONE; ic_netmask = NONE; break; break; case 4: case 4: if ((dp = strchr(ip, '.'))) { if ((dp = strchr(ip, '.'))) { Loading