ucmd_dhcp.c 419 B

123456789101112131415161718
  1. /* dhcp: ring-3 command. Re-run the DHCP client; dhcp.c prints the exchange. */
  2. #include "ucmd_lib.h"
  3. void _start(const char *arg)
  4. {
  5. int r;
  6. (void)arg;
  7. r = u_syscall1(SYS_DHCP_RUN, 4000);
  8. if (r == -2)
  9. u_puts("dhcp: no NIC\n");
  10. else if (r == -3)
  11. u_puts("dhcp: TX failed (try netreset)\n");
  12. /* r == 0: dhcp_run() printed the lease; r == -1: it printed its own
  13. * failure line. */
  14. u_exit(r == 0 ? 0 : 1);
  15. }