udhcp_additional_items.diff 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. Index: include/usage.h
  2. ===================================================================
  3. RCS file: /var/cvs/busybox/include/usage.h,v
  4. retrieving revision 1.191
  5. diff -u -r1.191 usage.h
  6. --- a/include/usage.h 25 Feb 2004 10:35:55 -0000 1.191
  7. +++ b/include/usage.h 5 Mar 2004 14:32:45 -0000
  8. @@ -2606,6 +2606,7 @@
  9. "\t-p,\t--pidfile=file\tStore process ID of daemon in file\n" \
  10. "\t-q,\t--quit\tQuit after obtaining lease\n" \
  11. "\t-r,\t--request=IP\tIP address to request (default: none)\n" \
  12. + "\t-R,\t--require=NAME\tAdd NAME to request\n" \
  13. "\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \
  14. "\t-v,\t--version\tDisplay version"
  15. Index: networking/udhcp/README.udhcpc
  16. ===================================================================
  17. RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpc,v
  18. retrieving revision 1.3
  19. diff -u -r1.3 README.udhcpc
  20. --- a/networking/udhcp/README.udhcpc 11 Dec 2002 21:12:44 -0000 1.3
  21. +++ b/networking/udhcp/README.udhcpc 5 Mar 2004 14:32:46 -0000
  22. @@ -22,6 +22,7 @@
  23. -p, --pidfile=file Store process ID of daemon in file
  24. -q, --quit Quit after obtaining lease
  25. -r, --request=IP IP address to request (default: none)
  26. +-R, --require=NAME Add NAME to request
  27. -s, --script=file Run file at dhcp events (default:
  28. /usr/share/udhcpc/default.script)
  29. -v, --version Display version
  30. @@ -101,6 +102,8 @@
  31. additional options are easily added in options.c.
  32. +By default, only a few basic items are requested. To request additional
  33. +items use the -R option. Example: "-R rootpath"
  34. note on udhcpc's random seed
  35. ---------------------------
  36. Index: networking/udhcp/dhcpc.c
  37. ===================================================================
  38. RCS file: /var/cvs/busybox/networking/udhcp/dhcpc.c,v
  39. retrieving revision 1.16
  40. diff -u -r1.16 dhcpc.c
  41. --- a/networking/udhcp/dhcpc.c 30 Jan 2004 23:45:12 -0000 1.16
  42. +++ b/networking/udhcp/dhcpc.c 5 Mar 2004 14:32:46 -0000
  43. @@ -88,6 +88,7 @@
  44. " -p, --pidfile=file Store process ID of daemon in file\n"
  45. " -q, --quit Quit after obtaining lease\n"
  46. " -r, --request=IP IP address to request (default: none)\n"
  47. +" -R, --require=NAME Add NAME to the request\n"
  48. " -s, --script=file Run file at dhcp events (default:\n"
  49. " " DEFAULT_SCRIPT ")\n"
  50. " -v, --version Display version\n"
  51. @@ -203,6 +204,7 @@
  52. {"pidfile", required_argument, 0, 'p'},
  53. {"quit", no_argument, 0, 'q'},
  54. {"request", required_argument, 0, 'r'},
  55. + {"require", required_argument, 0, 'R'},
  56. {"script", required_argument, 0, 's'},
  57. {"version", no_argument, 0, 'v'},
  58. {0, 0, 0, 0}
  59. @@ -211,7 +213,7 @@
  60. /* get options */
  61. while (1) {
  62. int option_index = 0;
  63. - c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index);
  64. + c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:R:s:v", arg_options, &option_index);
  65. if (c == -1) break;
  66. switch (c) {
  67. @@ -254,6 +256,11 @@
  68. case 'r':
  69. requested_ip = inet_addr(optarg);
  70. break;
  71. + case 'R':
  72. + if (require_option(optarg)) {
  73. + fprintf(stderr,"WARNING: %s unknown/not-supported (Ignored)\n", optarg );
  74. + }
  75. + break;
  76. case 's':
  77. client_config.script = optarg;
  78. break;
  79. Index: networking/udhcp/options.c
  80. ===================================================================
  81. RCS file: /var/cvs/busybox/networking/udhcp/options.c,v
  82. retrieving revision 1.7
  83. diff -u -r1.7 options.c
  84. --- a/networking/udhcp/options.c 30 Jan 2004 23:45:12 -0000 1.7
  85. +++ b/networking/udhcp/options.c 5 Mar 2004 14:32:46 -0000
  86. @@ -57,7 +57,19 @@
  87. [OPTION_S32] = 4
  88. };
  89. -
  90. +/* find and mark requested item as required */
  91. +int require_option(char *name)
  92. +{
  93. + int i;
  94. + for (i = 0; dhcp_options[i].code; i++) {
  95. + if (strcmp(name, dhcp_options[i].name) == 0 ){
  96. + dhcp_options[i].flags |= OPTION_REQ;
  97. + return 0;
  98. + }
  99. + }
  100. + return 1;
  101. +}
  102. +
  103. /* get an option with bounds checking (warning, not aligned). */
  104. uint8_t *get_option(struct dhcpMessage *packet, int code)
  105. {
  106. Index: networking/udhcp/options.h
  107. ===================================================================
  108. RCS file: /var/cvs/busybox/networking/udhcp/options.h,v
  109. retrieving revision 1.5
  110. diff -u -r1.5 options.h
  111. --- a/networking/udhcp/options.h 30 Jan 2004 23:45:12 -0000 1.5
  112. +++ b/networking/udhcp/options.h 5 Mar 2004 14:32:46 -0000
  113. @@ -30,6 +30,7 @@
  114. extern struct dhcp_option dhcp_options[];
  115. extern int option_lengths[];
  116. +int require_option(char *name);
  117. uint8_t *get_option(struct dhcpMessage *packet, int code);
  118. int end_option(uint8_t *optionptr);
  119. int add_option_string(uint8_t *optionptr, uint8_t *string);