Lines Matching +full:magic +full:- +full:packet

2  * bootptest.c - Test out a bootp server.
6 * The packet printing routine is from the Berkeley "tcpdump"
7 * program with some enhancements I added. The print-bootp.c
16 * (See the copyright notice in print-bootp.c)
27 * 12/02/93 Released version 1.4 (with bootp-2.3.2)
37 char *usage = "bootptest [-h] server-name [vendor-data-template-file]";
101 struct sockaddr_in sin_from; /* Packet source */
109 char *sndbuf; /* Send packet buffer */
110 char *rcvbuf; /* Receive packet buffer */
116 * Vendor magic cookies for CMU and RFC1048
124 * Initialization such as command-line processing is done, then
150 argc--; in main()
173 /* default magic number */ in main()
178 if (argv[0][0] != '-') in main()
185 argc--; argv++; in main()
193 case 'm': /* Magic number value. */ in main()
196 argc--; argv++; in main()
206 argc--; in main()
213 argc--; in main()
216 /* Get optional vendor-data-template-file. */ in main()
219 argc--; in main()
239 bootps_port = ntohs((u_short) sep->s_port); in main()
241 warnx("bootps/udp: unknown service -- using port %d", in main()
256 bcopy(hep->h_addr, &server_addr, sizeof(server_addr)); in main()
260 /* XXX - not yet */ in main()
272 bootpc_port = ntohs(sep->s_port); in main()
274 warnx("bootpc/udp: unknown service -- using port %d", in main()
302 bp->bp_op = BOOTREQUEST; in main()
304 bp->bp_xid = (u_int32) htonl(xid); in main()
306 strncpy(bp->bp_file, bp_file, BP_FILE_LEN); in main()
319 if (getether(ifr->ifr_name, (char*)eaddr)) { in main()
320 printf("Can not get ether addr for %s\n", ifr->ifr_name); in main()
323 /* Copy Ethernet address into request packet. */ in main()
324 bp->bp_htype = 1; in main()
325 bp->bp_hlen = 6; in main()
326 bcopy(eaddr, bp->bp_chaddr, bp->bp_hlen); in main()
334 bcopy(hep->h_addr, &bp->bp_ciaddr, hep->h_length); in main()
340 bcopy((char*)&vend_magic, bp->bp_vend, 4); in main()
342 bp->bp_vend[4] = TAG_END; in main()
346 * This also determines the size of the packet. in main()
356 n = BUFLEN - sizeof(*bp) + BP_VEND_LEN; in main()
357 n = read(fd, bp->bp_vend, n); in main()
367 snaplen += (n - BP_VEND_LEN); in main()
379 bp->bp_secs = secs = 0; in main()
397 * Otherwise, bump the "wait time" field and re-send. in main()
404 bp->bp_secs = htons(secs); in main()
415 printf("received short packet\n"); in main()
420 /* Print the received packet. */ in main()
440 /* Print the request packet. */ in send_request()
445 /* Send the request packet. */ in send_request()
473 putchar('-'); in printfn()
502 * tab-width: 4
503 * c-indent-level: 4
504 * c-argdecl-indent: 4
505 * c-continued-statement-offset: 4
506 * c-continued-brace-offset: -4
507 * c-label-offset: -4
508 * c-brace-offset: 0