Changeset 4bde2394 in rtems
- Timestamp:
- 09/19/01 17:30:38 (21 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 6a9db57
- Parents:
- d34d2e69
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libnetworking/ChangeLog
rd34d2e69 r4bde2394 1 2001-09-19 Chris Johns <ccj@acm.org> 2 3 * nfs/bootp_subr.c, rtems/rtems_bootp.c, rtems/rtems_bsdnet.h, 4 rtems/rtems_bsdnet_internal.h Added support for populating the 5 initial "root" filesystem with information obtained via the DHCP 6 response. 7 1 8 2001-08-16 Mike Siers <mikes@poliac.com> 2 9 -
c/src/exec/libnetworking/nfs/bootp_subr.c
rd34d2e69 r4bde2394 70 70 #include <nfs/xdr_subs.h> 71 71 72 #include <sys/stat.h> 73 #include <sys/types.h> 74 #include <fcntl.h> 75 #include <rtems/mkrootfs.h> 76 72 77 #define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */ 73 78 … … 148 153 struct proc *procp); 149 154 150 void bootpc_init( void);155 void bootpc_init(int update_files); 151 156 152 157 #ifdef BOOTP_DEBUG … … 690 695 static struct sockaddr_in dhcp_netmask; 691 696 static struct sockaddr_in dhcp_gw; 697 static char *dhcp_hostname; 692 698 693 699 static void … … 796 802 panic("Can't set host name"); 797 803 printf("Hostname is %s\n", p); 804 dhcp_hostname = strdup(p); 798 805 break; 799 806 … … 865 872 866 873 void 867 bootpc_init( void)874 bootpc_init(int update_files) 868 875 { 869 876 struct bootp_packet call; … … 888 895 return; 889 896 897 /* 898 * If we are to update the files create the root 899 * file structure. 900 */ 901 if (update_files) 902 if (rtems_create_root_fs () < 0) { 903 printf("Error creating the root filesystem.\nFile not created.\n"); 904 update_files = 0; 905 } 906 907 memset(dhcp_hostname, 0, sizeof(dhcp_hostname)); 908 890 909 /* 891 910 * Find a network interface. … … 1027 1046 rtems_bsdnet_log_host_address = rtems_bsdnet_bootp_server_address; 1028 1047 printip ("Log server ip address", rtems_bsdnet_log_host_address); 1029 1048 1049 /* 1050 * Update the files if we are asked too. 1051 */ 1052 if (update_files) { 1053 char *dn = rtems_bsdnet_domain_name; 1054 char *hn = dhcp_hostname; 1055 if (!dn) 1056 dn = "mydomain"; 1057 if (!hn) 1058 hn = "me"; 1059 rtems_rootfs_append_host_rec(*((unsigned long*) &myaddr.sin_addr), hn, dn); 1060 1061 /* 1062 * Should the given domainname be used here ? 1063 */ 1064 if (dhcp_gotserver) { 1065 if (rtems_bsdnet_bootp_server_name) 1066 hn = rtems_bsdnet_bootp_server_name; 1067 else 1068 hn = "bootps"; 1069 rtems_rootfs_append_host_rec(*((unsigned long *) &rtems_bsdnet_bootp_server_address), 1070 hn, dn); 1071 } 1072 1073 if (dhcp_gotlogserver) { 1074 rtems_rootfs_append_host_rec(*((unsigned long *) &rtems_bsdnet_log_host_address), 1075 "logs", dn); 1076 } 1077 1078 /* 1079 * Setup the DNS configuration file /etc/resolv.conf. 1080 */ 1081 if (rtems_bsdnet_nameserver_count) { 1082 int i; 1083 char buf[64]; 1084 const char *bufl[1]; 1085 1086 bufl[0] = buf; 1087 1088 #define MKFILE_MODE (S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH) 1089 1090 if (rtems_bsdnet_domain_name && 1091 (strlen(rtems_bsdnet_domain_name) < (sizeof(buf) - 1))) { 1092 strcpy(buf, "search "); 1093 strcat(buf, rtems_bsdnet_domain_name); 1094 strcat(buf, "\n"); 1095 rtems_rootfs_file_append ("/etc/resolv.conf", MKFILE_MODE, 1, bufl); 1096 } 1097 1098 for (i = 0; i < rtems_bsdnet_nameserver_count; i++) { 1099 strcpy(buf, "nameserver "); 1100 strcat(buf, inet_ntoa(rtems_bsdnet_ntpserver[i])); 1101 strcat(buf, "\n"); 1102 if (rtems_rootfs_file_append ("/etc/resolv.conf", MKFILE_MODE, 1, bufl)) 1103 break; 1104 } 1105 } 1106 } 1107 1030 1108 /* 1031 1109 * Configure the interface with the new settings -
c/src/exec/libnetworking/rtems/rtems_bootp.c
rd34d2e69 r4bde2394 15 15 { 16 16 rtems_bsdnet_semaphore_obtain (); 17 bootpc_init ( );17 bootpc_init (FALSE); 18 18 rtems_bsdnet_semaphore_release (); 19 19 } 20 21 /* 22 * Perform a BOOTP request and update "standard" files in /etc 23 * with the results. 24 */ 25 void 26 rtems_bsdnet_do_bootp_and_rootfs (void) 27 { 28 rtems_bsdnet_semaphore_obtain (); 29 bootpc_init (TRUE); 30 rtems_bsdnet_semaphore_release (); 31 } -
c/src/exec/libnetworking/rtems/rtems_bsdnet.h
rd34d2e69 r4bde2394 171 171 172 172 void rtems_bsdnet_do_bootp (void); 173 void rtems_bsdnet_do_bootp_and_rootfs (void); 174 173 175 int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority); 174 176 -
c/src/exec/libnetworking/rtems/rtems_bsdnet_internal.h
rd34d2e69 r4bde2394 176 176 void ipintr (void); 177 177 void arpintr (void); 178 void bootpc_init( void);178 void bootpc_init(int ); 179 179 int socket (int, int, int); 180 180 int ioctl (int, int, ...); -
c/src/libnetworking/ChangeLog
rd34d2e69 r4bde2394 1 2001-09-19 Chris Johns <ccj@acm.org> 2 3 * nfs/bootp_subr.c, rtems/rtems_bootp.c, rtems/rtems_bsdnet.h, 4 rtems/rtems_bsdnet_internal.h Added support for populating the 5 initial "root" filesystem with information obtained via the DHCP 6 response. 7 1 8 2001-08-16 Mike Siers <mikes@poliac.com> 2 9 -
c/src/libnetworking/nfs/bootp_subr.c
rd34d2e69 r4bde2394 70 70 #include <nfs/xdr_subs.h> 71 71 72 #include <sys/stat.h> 73 #include <sys/types.h> 74 #include <fcntl.h> 75 #include <rtems/mkrootfs.h> 76 72 77 #define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */ 73 78 … … 148 153 struct proc *procp); 149 154 150 void bootpc_init( void);155 void bootpc_init(int update_files); 151 156 152 157 #ifdef BOOTP_DEBUG … … 690 695 static struct sockaddr_in dhcp_netmask; 691 696 static struct sockaddr_in dhcp_gw; 697 static char *dhcp_hostname; 692 698 693 699 static void … … 796 802 panic("Can't set host name"); 797 803 printf("Hostname is %s\n", p); 804 dhcp_hostname = strdup(p); 798 805 break; 799 806 … … 865 872 866 873 void 867 bootpc_init( void)874 bootpc_init(int update_files) 868 875 { 869 876 struct bootp_packet call; … … 888 895 return; 889 896 897 /* 898 * If we are to update the files create the root 899 * file structure. 900 */ 901 if (update_files) 902 if (rtems_create_root_fs () < 0) { 903 printf("Error creating the root filesystem.\nFile not created.\n"); 904 update_files = 0; 905 } 906 907 memset(dhcp_hostname, 0, sizeof(dhcp_hostname)); 908 890 909 /* 891 910 * Find a network interface. … … 1027 1046 rtems_bsdnet_log_host_address = rtems_bsdnet_bootp_server_address; 1028 1047 printip ("Log server ip address", rtems_bsdnet_log_host_address); 1029 1048 1049 /* 1050 * Update the files if we are asked too. 1051 */ 1052 if (update_files) { 1053 char *dn = rtems_bsdnet_domain_name; 1054 char *hn = dhcp_hostname; 1055 if (!dn) 1056 dn = "mydomain"; 1057 if (!hn) 1058 hn = "me"; 1059 rtems_rootfs_append_host_rec(*((unsigned long*) &myaddr.sin_addr), hn, dn); 1060 1061 /* 1062 * Should the given domainname be used here ? 1063 */ 1064 if (dhcp_gotserver) { 1065 if (rtems_bsdnet_bootp_server_name) 1066 hn = rtems_bsdnet_bootp_server_name; 1067 else 1068 hn = "bootps"; 1069 rtems_rootfs_append_host_rec(*((unsigned long *) &rtems_bsdnet_bootp_server_address), 1070 hn, dn); 1071 } 1072 1073 if (dhcp_gotlogserver) { 1074 rtems_rootfs_append_host_rec(*((unsigned long *) &rtems_bsdnet_log_host_address), 1075 "logs", dn); 1076 } 1077 1078 /* 1079 * Setup the DNS configuration file /etc/resolv.conf. 1080 */ 1081 if (rtems_bsdnet_nameserver_count) { 1082 int i; 1083 char buf[64]; 1084 const char *bufl[1]; 1085 1086 bufl[0] = buf; 1087 1088 #define MKFILE_MODE (S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH) 1089 1090 if (rtems_bsdnet_domain_name && 1091 (strlen(rtems_bsdnet_domain_name) < (sizeof(buf) - 1))) { 1092 strcpy(buf, "search "); 1093 strcat(buf, rtems_bsdnet_domain_name); 1094 strcat(buf, "\n"); 1095 rtems_rootfs_file_append ("/etc/resolv.conf", MKFILE_MODE, 1, bufl); 1096 } 1097 1098 for (i = 0; i < rtems_bsdnet_nameserver_count; i++) { 1099 strcpy(buf, "nameserver "); 1100 strcat(buf, inet_ntoa(rtems_bsdnet_ntpserver[i])); 1101 strcat(buf, "\n"); 1102 if (rtems_rootfs_file_append ("/etc/resolv.conf", MKFILE_MODE, 1, bufl)) 1103 break; 1104 } 1105 } 1106 } 1107 1030 1108 /* 1031 1109 * Configure the interface with the new settings -
c/src/libnetworking/rtems/rtems_bootp.c
rd34d2e69 r4bde2394 15 15 { 16 16 rtems_bsdnet_semaphore_obtain (); 17 bootpc_init ( );17 bootpc_init (FALSE); 18 18 rtems_bsdnet_semaphore_release (); 19 19 } 20 21 /* 22 * Perform a BOOTP request and update "standard" files in /etc 23 * with the results. 24 */ 25 void 26 rtems_bsdnet_do_bootp_and_rootfs (void) 27 { 28 rtems_bsdnet_semaphore_obtain (); 29 bootpc_init (TRUE); 30 rtems_bsdnet_semaphore_release (); 31 } -
c/src/libnetworking/rtems/rtems_bsdnet.h
rd34d2e69 r4bde2394 171 171 172 172 void rtems_bsdnet_do_bootp (void); 173 void rtems_bsdnet_do_bootp_and_rootfs (void); 174 173 175 int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority); 174 176 -
c/src/libnetworking/rtems/rtems_bsdnet_internal.h
rd34d2e69 r4bde2394 176 176 void ipintr (void); 177 177 void arpintr (void); 178 void bootpc_init( void);178 void bootpc_init(int ); 179 179 int socket (int, int, int); 180 180 int ioctl (int, int, ...); -
cpukit/libnetworking/ChangeLog
rd34d2e69 r4bde2394 1 2001-09-19 Chris Johns <ccj@acm.org> 2 3 * nfs/bootp_subr.c, rtems/rtems_bootp.c, rtems/rtems_bsdnet.h, 4 rtems/rtems_bsdnet_internal.h Added support for populating the 5 initial "root" filesystem with information obtained via the DHCP 6 response. 7 1 8 2001-08-16 Mike Siers <mikes@poliac.com> 2 9 -
cpukit/libnetworking/nfs/bootp_subr.c
rd34d2e69 r4bde2394 70 70 #include <nfs/xdr_subs.h> 71 71 72 #include <sys/stat.h> 73 #include <sys/types.h> 74 #include <fcntl.h> 75 #include <rtems/mkrootfs.h> 76 72 77 #define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */ 73 78 … … 148 153 struct proc *procp); 149 154 150 void bootpc_init( void);155 void bootpc_init(int update_files); 151 156 152 157 #ifdef BOOTP_DEBUG … … 690 695 static struct sockaddr_in dhcp_netmask; 691 696 static struct sockaddr_in dhcp_gw; 697 static char *dhcp_hostname; 692 698 693 699 static void … … 796 802 panic("Can't set host name"); 797 803 printf("Hostname is %s\n", p); 804 dhcp_hostname = strdup(p); 798 805 break; 799 806 … … 865 872 866 873 void 867 bootpc_init( void)874 bootpc_init(int update_files) 868 875 { 869 876 struct bootp_packet call; … … 888 895 return; 889 896 897 /* 898 * If we are to update the files create the root 899 * file structure. 900 */ 901 if (update_files) 902 if (rtems_create_root_fs () < 0) { 903 printf("Error creating the root filesystem.\nFile not created.\n"); 904 update_files = 0; 905 } 906 907 memset(dhcp_hostname, 0, sizeof(dhcp_hostname)); 908 890 909 /* 891 910 * Find a network interface. … … 1027 1046 rtems_bsdnet_log_host_address = rtems_bsdnet_bootp_server_address; 1028 1047 printip ("Log server ip address", rtems_bsdnet_log_host_address); 1029 1048 1049 /* 1050 * Update the files if we are asked too. 1051 */ 1052 if (update_files) { 1053 char *dn = rtems_bsdnet_domain_name; 1054 char *hn = dhcp_hostname; 1055 if (!dn) 1056 dn = "mydomain"; 1057 if (!hn) 1058 hn = "me"; 1059 rtems_rootfs_append_host_rec(*((unsigned long*) &myaddr.sin_addr), hn, dn); 1060 1061 /* 1062 * Should the given domainname be used here ? 1063 */ 1064 if (dhcp_gotserver) { 1065 if (rtems_bsdnet_bootp_server_name) 1066 hn = rtems_bsdnet_bootp_server_name; 1067 else 1068 hn = "bootps"; 1069 rtems_rootfs_append_host_rec(*((unsigned long *) &rtems_bsdnet_bootp_server_address), 1070 hn, dn); 1071 } 1072 1073 if (dhcp_gotlogserver) { 1074 rtems_rootfs_append_host_rec(*((unsigned long *) &rtems_bsdnet_log_host_address), 1075 "logs", dn); 1076 } 1077 1078 /* 1079 * Setup the DNS configuration file /etc/resolv.conf. 1080 */ 1081 if (rtems_bsdnet_nameserver_count) { 1082 int i; 1083 char buf[64]; 1084 const char *bufl[1]; 1085 1086 bufl[0] = buf; 1087 1088 #define MKFILE_MODE (S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH) 1089 1090 if (rtems_bsdnet_domain_name && 1091 (strlen(rtems_bsdnet_domain_name) < (sizeof(buf) - 1))) { 1092 strcpy(buf, "search "); 1093 strcat(buf, rtems_bsdnet_domain_name); 1094 strcat(buf, "\n"); 1095 rtems_rootfs_file_append ("/etc/resolv.conf", MKFILE_MODE, 1, bufl); 1096 } 1097 1098 for (i = 0; i < rtems_bsdnet_nameserver_count; i++) { 1099 strcpy(buf, "nameserver "); 1100 strcat(buf, inet_ntoa(rtems_bsdnet_ntpserver[i])); 1101 strcat(buf, "\n"); 1102 if (rtems_rootfs_file_append ("/etc/resolv.conf", MKFILE_MODE, 1, bufl)) 1103 break; 1104 } 1105 } 1106 } 1107 1030 1108 /* 1031 1109 * Configure the interface with the new settings -
cpukit/libnetworking/rtems/rtems_bootp.c
rd34d2e69 r4bde2394 15 15 { 16 16 rtems_bsdnet_semaphore_obtain (); 17 bootpc_init ( );17 bootpc_init (FALSE); 18 18 rtems_bsdnet_semaphore_release (); 19 19 } 20 21 /* 22 * Perform a BOOTP request and update "standard" files in /etc 23 * with the results. 24 */ 25 void 26 rtems_bsdnet_do_bootp_and_rootfs (void) 27 { 28 rtems_bsdnet_semaphore_obtain (); 29 bootpc_init (TRUE); 30 rtems_bsdnet_semaphore_release (); 31 } -
cpukit/libnetworking/rtems/rtems_bsdnet.h
rd34d2e69 r4bde2394 171 171 172 172 void rtems_bsdnet_do_bootp (void); 173 void rtems_bsdnet_do_bootp_and_rootfs (void); 174 173 175 int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority); 174 176 -
cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
rd34d2e69 r4bde2394 176 176 void ipintr (void); 177 177 void arpintr (void); 178 void bootpc_init( void);178 void bootpc_init(int ); 179 179 int socket (int, int, int); 180 180 int ioctl (int, int, ...);
Note: See TracChangeset
for help on using the changeset viewer.