-
Notifications
You must be signed in to change notification settings - Fork 1
/
format_bsdp_entry
executable file
·1109 lines (1038 loc) · 43.1 KB
/
format_bsdp_entry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl -pw
use strict;
use warnings;
our ($c,@a,@b,@c,$bsdp_default,@arch);
BEGIN{
#my $ip='192.168.0.1';
#my $ip='192.168.219.1';
my $ip='192.0.2.1';
print <<"eof";$c++;
#########################
# #
# OPTION DECLERATIONS #
# #
#########################
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option ms-classless-static-routes code 249 = array of integer 8;
option test code 224 = string;
# grub options
# ---- -------
option grub code 150 = text;
# etherboot options
# --------- -------
# Definition of Etherboot options
# (taken from vendortags.html)
# We use an encapsulated option space to avoid polluting the site-local DHCP option space
#
option space etherboot;
option etherboot-encapsulated-options code 150 = encapsulate etherboot;
# Definition of option codes within the etherboot-encapsulated-options space
#
option etherboot.extensions-path code 18 = string;
option etherboot.magic code 128 = string; # e4:45:74:68:00:00;
option etherboot.kernel-cmdline code 129 = string;
option etherboot.menu-opts code 160 = string;
option etherboot.nic-dev-id code 175 = string; # from etherboot
option etherboot.menu-selection code 176 = unsigned integer 8;
option etherboot.motd-1 code 184 = string; # motd line 1
option etherboot.motd-2 code 185 = string; # motd line 2
option etherboot.motd-3 code 186 = string; # motd line 3
option etherboot.motd-4 code 187 = string; # motd line 4
option etherboot.motd-5 code 188 = string; # motd line 5
option etherboot.motd-6 code 189 = string; # motd line 6
option etherboot.motd-7 code 190 = string; # motd line 7
option etherboot.motd-8 code 191 = string; # motd line 8
option etherboot.image-1 code 192 = string; # menu entry 1
option etherboot.image-2 code 193 = string; # menu entry 2
option etherboot.image-3 code 194 = string; # menu entry 3
option etherboot.image-4 code 195 = string; # menu entry 4
option etherboot.image-5 code 196 = string; # menu entry 5
option etherboot.image-6 code 197 = string; # menu entry 6
option etherboot.image-7 code 198 = string; # menu entry 7
option etherboot.image-8 code 199 = string; # menu entry 8
option etherboot.image-9 code 200 = string; # menu entry 9
option etherboot.image-10 code 201 = string; # menu entry 10
option etherboot.image-11 code 202 = string; # menu entry 11
option etherboot.image-12 code 203 = string; # menu entry 12
option etherboot.image-13 code 204 = string; # menu entry 13
option etherboot.image-14 code 205 = string; # menu entry 14
option etherboot.image-15 code 206 = string; # menu entry 15
option etherboot.image-16 code 207 = string; # menu entry 16
option etherboot.kmod code 254 = string;
# Legacy support for Etherboot options as site-local options (i.e. non-encapsulated)
# Note: options defined after the switch to encapsulated options should not be defined here
#
option legacy-etherboot-magic code 128 = string;
option legacy-etherboot-kernel-cmdline code 129 = string;
option legacy-etherboot-menu-opts code 160 = string; # name value pairs
option legacy-etherboot-menu-selection code 176 = unsigned integer 8;
option legacy-etherboot-motd-1 code 184 = string;
option legacy-etherboot-motd-2 code 185 = string;
option legacy-etherboot-motd-3 code 186 = string;
option legacy-etherboot-motd-4 code 187 = string;
option legacy-etherboot-motd-5 code 188 = string;
option legacy-etherboot-motd-6 code 189 = string;
option legacy-etherboot-motd-7 code 190 = string;
option legacy-etherboot-motd-8 code 191 = string;
option legacy-etherboot-image-1 code 192 = string;
option legacy-etherboot-image-2 code 193 = string;
option legacy-etherboot-image-3 code 194 = string;
option legacy-etherboot-image-4 code 195 = string;
option legacy-etherboot-image-5 code 196 = string;
option legacy-etherboot-image-6 code 197 = string;
option legacy-etherboot-image-7 code 198 = string;
option legacy-etherboot-image-8 code 199 = string;
option legacy-etherboot-image-9 code 200 = string;
option legacy-etherboot-image-10 code 201 = string;
option legacy-etherboot-image-11 code 202 = string;
option legacy-etherboot-image-12 code 203 = string;
option legacy-etherboot-image-13 code 204 = string;
option legacy-etherboot-image-14 code 205 = string;
option legacy-etherboot-image-15 code 206 = string;
option legacy-etherboot-image-16 code 207 = string;
# PXE options
# --- -------
option client-arch code 93 = array of unsigned integer 16;
#http://www.iana.org/assignments/dhcpv6-parameters/processor-architecture.csv
#http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#processor-architecture
eof
{
my $fsp="%-30s %-16s %s %-9s %s\n";
my $fsa='# %s '.$fsp;
my $fsb='# %3d '.$fsp;
#my $fsa="# %s %s\n";
#my $fsb="# %3d %s\n";
my $fsc="# %3d %s\n";
my $fsd="# %s %-30s %s\n";
local $_;
my @vals;
my @keys;
open my $fh, '<', 'processor-architecture-key.csv';
while(<$fh>){
chomp;
s!$!!;
my ($a,@b,@c)=((split /,/),'','','');
@b=@b[0..2];
if('Type'eq$a){
@keys=@b
}elsif(! $a=~/^0x.. /){
print "#### $a @b\n";
}elsif($a=~/^0x([0-9a-f]{2}) 0x([0-9a-f]{2})$/){
$a=((hex $1)<<8)+hex $2;
$vals[$a]=\@b;
}
}
close $fh;
open $fh, '<', 'processor-architecture.csv';
while(<$fh>){
chomp;
s!$!!;
my ($a,$b,$c)=split /,/;
unless($a=~/^0x.. /){
printf $fsa,$a,$b,$c,@keys;
@keys=map {s/./-/g;$_} @keys;
$a=~s/./-/g;
$b=~s/./-/g;
$c=~s/./-/g;
printf $fsa,$a,$b,$c,@keys;
}elsif($a=~/^0x([0-9a-f]{2}) 0x([0-9a-f]{2})$/){
$a=((hex $1)<<8)+hex $2;
$c=~s/^\[(.*)\]$/$1/;
$c=~s/\]\[/, /g;
#$c='' unless $c=~/RFC/;
printf(($c?$fsb:$fsc),$a,$b,$c,@{$vals[$a]}[0..1],($vals[$a][2]||'tftp'));
push @c, sprintf <<'eof', $a, $b, ($vals[$a][0]?'#':'');
} elsif option client-arch = encode-int (%1$d,16) { # %1$d %2$s
%3$slog(debug, "2.%1$d");
eof
push @c, <<'eof', if $vals[$a][2];
option vendor-class-identifier "HTTPClient";
eof
if($vals[$a][0]){
push @c, sprintf <<'eof', $a, $b, $ip, @{$vals[$a]};
if not exists ipxe.busid {
#log(debug, "3.%1$d.old");
eof
unless($vals[$a][2]){
push @c, sprintf <<'eof', $a, $b, $ip, @{$vals[$a]};
if not exists ipxe.http {
log(debug, "4.%1$d.old.tftp");
filename "%5$sipxe.%4$s";
}elsif exists dhcp-server-identifier {
eof
}else{
push @c, <<'eof';
if exists dhcp-server-identifier {
eof
}
push @c, sprintf <<'eof', $a, $b, $ip, @{$vals[$a]};
log(debug, "4.%1$d.old.http");
filename = concat("http://", binary-to-ascii(10, 8, ".", option dhcp-server-identifier), "/tftpboot/%5$sipxe.%4$s");
}else{
log(debug, "4.%1$d.old.broken");
log(debug, "no server identifier");
filename "http://%3$s/tftpboot/%5$sipxe.%4$s";
}
}elsif substring(option ipxe.busid,0,1)=1 {
#log(debug, "3.%1$d.pci");
eof
unless($vals[$a][2]){
push @c, sprintf <<'eof', $a, $b, $ip, @{$vals[$a]};
if not exists ipxe.http {
log(debug, "4.%1$d.pci.tftp");
filename= concat("/ipxe/pci/",binary-to-ascii(16,32,":",substring(option ipxe.busid,1,99)),".%4$s");
}elsif exists dhcp-server-identifier {
eof
}else{
push @c, <<'eof';
if exists dhcp-server-identifier {
eof
}
push @c, sprintf <<'eof', $a, $b, $ip, @{$vals[$a]};
log(debug, "4.%1$d.pci.http");
filename= concat("http://", binary-to-ascii(10, 8, ".", option dhcp-server-identifier), "/tftpboot/ipxe/pci/",binary-to-ascii(16,32,":",substring(option ipxe.busid,1,99)),".%4$s");
}else{
log(debug, "4.%1$d.pci.broken");
log(debug, "no server identifier");
filename= concat("http://%3$s/tftpboot/ipxe/pci/",binary-to-ascii(16,32,":",substring(option ipxe.busid,1,99)),".%4$s");
}
}else{
#log(debug, "3.%1$d.other");
eof
unless($vals[$a][2]){
push @c, sprintf <<'eof', $a, $b, $ip, @{$vals[$a]};
if not exists ipxe.http {
log(debug, "4.%1$d.other.tftp");
filename= concat("/ipxe/other/",binary-to-ascii(16,8,":",option ipxe.busid),".%4$s");
}elsif exists dhcp-server-identifier {
eof
}else{
push @c, <<'eof';
if exists dhcp-server-identifier {
eof
}
push @c, sprintf <<'eof', $a, $b, $ip, @{$vals[$a]};
log(debug, "4.%1$d.other.http");
filename= concat("http://", binary-to-ascii(10, 8, ".", option dhcp-server-identifier), "/tftpboot/ipxe/other/",binary-to-ascii(16,8,":",option ipxe.busid),".%4$s");
}else{
log(debug, "4.%1$d.other.broken");
log(debug, "no server identifier");
filename= concat("http://%3$s/tftpboot/ipxe/other/",binary-to-ascii(16,8,":",option ipxe.busid),".%4$s");
}
}
eof
}
}elsif($a=~/-/){
}else{
printf $fsa,$a,$b,$c;
print;
print "\n";
}
}
}
print <<"eof";
option client-driver code 94 = {unsigned integer 8,unsigned integer 8,unsigned integer 8};
#option client-machine-identifier 97 = string;
# Definition of PXE specific options
# Code 1: Multicast IP address of bootfile
# Code 2: UDP port that client should monitor for MTFTP responses
# Code 3: UDP port that MTFTP servers are using to listen for MTFTP requests
# Code 4: Number of secondes a client must listen for activity before trying
# to start a new MTFTP transfer
# Code 5: Number of secondes a client must listen before trying to restart
# a MTFTP transfer
# define Option for the PXE class
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
# EFI options
# --- -------
# syslinux/pxelinux options
# -------- -------- -------
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.magic f1:00:74:7e;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
# ipxe options
# ---- -------
option space ipxe;
option ipxe-encap-opts code 175 = encapsulate ipxe;
# iPXE options, can be set in DHCP response packet
option ipxe.priority code 1 = signed integer 8;
option ipxe.keep-san code 8 = unsigned integer 8;
option ipxe.skip-san-boot code 9 = unsigned integer 8;
option ipxe.syslogs code 85 = string;
option ipxe.cert code 91 = string;
option ipxe.privkey code 92 = string;
option ipxe.crosscert code 93 = string;
option ipxe.no-pxedhcp code 176 = unsigned integer 8;
option ipxe.busid code 177 = string;
option ipxe.bios-drive code 189 = unsigned integer 8;
option ipxe.username code 190 = string;
option ipxe.password code 191 = string;
option ipxe.reverse-username code 192 = string;
option ipxe.reverse-password code 193 = string;
option ipxe.version code 235 = string;
option iscsi-initiator-iqn code 203 = string;
# iPXE feature flags, set in DHCP request packet
option ipxe.pxeext code 16 = unsigned integer 8;
option ipxe.iscsi code 17 = unsigned integer 8;
option ipxe.aoe code 18 = unsigned integer 8;
option ipxe.http code 19 = unsigned integer 8;
option ipxe.https code 20 = unsigned integer 8;
option ipxe.tftp code 21 = unsigned integer 8;
option ipxe.ftp code 22 = unsigned integer 8;
option ipxe.dns code 23 = unsigned integer 8;
option ipxe.bzimage code 24 = unsigned integer 8;
option ipxe.multiboot code 25 = unsigned integer 8;
option ipxe.slam code 26 = unsigned integer 8;
option ipxe.srp code 27 = unsigned integer 8;
option ipxe.nbi code 32 = unsigned integer 8;
option ipxe.pxe code 33 = unsigned integer 8;
option ipxe.elf code 34 = unsigned integer 8;
option ipxe.comboot code 35 = unsigned integer 8;
option ipxe.efi code 36 = unsigned integer 8;
option ipxe.fcoe code 37 = unsigned integer 8;
option ipxe.vlan code 38 = unsigned integer 8;
option ipxe.menu code 39 = unsigned integer 8;
option ipxe.sdi code 40 = unsigned integer 8;
option ipxe.nfs code 41 = unsigned integer 8;
# apple bsdp options
# ----- ---- -------
option space bsdp;
option bsdp.message_type code 1 = unsigned integer 8;
option bsdp.bsdp_version code 2 = unsigned integer 16;
option bsdp.server_identifier code 3 = ip-address;
option bsdp.server_priority code 4 = unsigned integer 16;
option bsdp.reply_port code 5 = unsigned integer 16;
option bsdp.boot_image_list_path code 6 = string;
#option bsdp.default_boot_image_id code 7 = { unsigned integer 8, unsigned integer 8, unsigned integer 16 };
option bsdp.default_boot_image_id code 7 = string;
#image type 0 os9
# 1 osx
# 2 osx server
# 3 hwdiag
#index 1-4095 local
#index 4096 - 65535 global
#option bsdp.selected_boot_image_id code 8 = { unsigned integer 8, unsigned integer 8, unsigned integer 16 };
option bsdp.selected_boot_image_id code 8 = string;
#option bsdp.boot_image_list code 9 = { unsigned integer 8, unsigned integer 8, unsigned integer 16, string };
option bsdp.boot_image_list code 9 = string;
#option bsdp.legacy_flag code 10 = null;
option bsdp.legacy_flag code 10 = string; # must be of zero length
option bsdp.attribute_filter code 11 = array of {unsigned integer 8, unsigned integer 8};
option bsdp.max_msg_size code 12 = unsigned integer 16;
option bsdp.machine_name code 130 = string;
option bsdp-43 code 43 = encapsulate bsdp;
#Mac NetBoot Options
option mac-nc-client-unknown code 220 = string;
option mac-nc-client-id code 221 = string;
option mac-version code 230 = string;
option mac-username code 232 = text;
option mac-password code 233 = text;
option mac-nb-img code 234 = string;
option mac-apps-img code 235 = string;
option mac-machine-name code 237 = text;
option mac-client-nb-img code 238 = string;
############
# #
# global #
# #
############
# dhcpd options
# ----- -------
authoritative;
ddns-update-style none;
ddns-updates off;
ignore client-updates;
#get-lease-hostnames true;
allow booting;
allow bootp;
log-facility local7;
# default client options
# ------- ------ -------
option domain-name "example.com";
option domain-search "example.com";
option domain-name-servers $ip;
option ntp-servers $ip;
option time-servers $ip;
option log-servers 192.0.2.2;
option netbios-name-servers 192.0.2.3;
option netbios-dd-server 192.0.2.3;
option netbios-node-type 0x8;
option netbios-scope "";
option lpr-servers 192.0.2.4;
option time-offset -25200; # MST
option fqdn.no-client-update true;
# Disable ProxyDHCP, we're in control of the primary DHCP server
option ipxe.no-pxedhcp 1;
# TFTP server defaults to DHCP server and is specified in both
# next-server field and tftp-server-name option field
#
option tftp-server-name = binary-to-ascii ( 10, 8, ".", config-option dhcp-server-identifier );
server-name = config-option tftp-server-name;
next-server = config-option dhcp-server-identifier;
# client class specific options
# ------ ----- -------- -------
set hwid = pick-first-value (
option etherboot.nic-dev-id,
option ipxe.busid,
00:00
);
if hwid=00:00 {set kmod = "no pci id reported";}
elsif hwid=01:00:01:81:68 {set kmod = "rtl8169-0x0001-0x8168";}
elsif hwid=01:0e:11:ae:32 {set kmod = "netel100";}
elsif hwid=01:0e:11:ae:34 {set kmod = "netel10";}
elsif hwid=01:0e:11:ae:35 {set kmod = "netflex3i";}
elsif hwid=01:0e:11:ae:40 {set kmod = "netel100d";}
elsif hwid=01:0e:11:ae:43 {set kmod = "netel100pi";}
elsif hwid=01:0e:11:b0:11 {set kmod = "netel100i";}
elsif hwid=01:0e:11:b0:12 {set kmod = "netelligent_10_t2";}
elsif hwid=01:0e:11:b0:30 {set kmod = "netelligent_10_100_ws_5100";}
elsif hwid=01:0e:11:f1:30 {set kmod = "thunder";}
elsif hwid=01:0e:11:f1:50 {set kmod = "netflex3b";}
elsif hwid=01:10:0b:00:20 {set kmod = "dp83815";}
elsif hwid=01:10:0b:00:22 {set kmod = "ns83820";}
elsif hwid=01:10:11:00:02 {set kmod = "dc21040";}
elsif hwid=01:10:11:00:09 {set kmod = "ds21140";}
elsif hwid=01:10:11:00:14 {set kmod = "dc21041";}
elsif hwid=01:10:11:00:19 {set kmod = "ds21142";}
elsif hwid=01:10:22:20:00 {set kmod = "pcnet32";}
elsif hwid=01:10:22:20:01 {set kmod = "amdhomepna";}
elsif hwid=01:10:22:26:25 {set kmod = "pcnetfastiii";}
elsif hwid=01:10:22:74:62 {set kmod = "amd8111e";}
elsif hwid=01:10:39:09:00 {set kmod = "sis900";}
elsif hwid=01:10:39:70:16 {set kmod = "sis7016";}
elsif hwid=01:10:4a:09:81 {set kmod = "tulip-0981";}
elsif hwid=01:10:4a:27:74 {set kmod = "SGThomson-STE10100A";}
elsif hwid=01:10:50:08:40 {set kmod = "winbond840";}
elsif hwid=01:10:50:09:40 {set kmod = "winbond940";}
elsif hwid=01:10:50:5a:5a {set kmod = "winbond940f";}
elsif hwid=01:10:8d:00:12 {set kmod = "oc2325";}
elsif hwid=01:10:8d:00:13 {set kmod = "oc2183";}
elsif hwid=01:10:8d:00:14 {set kmod = "oc2326";}
elsif hwid=01:10:b7:12:01 {set kmod = "3c982a";}
elsif hwid=01:10:b7:12:02 {set kmod = "3c982b";}
elsif hwid=01:10:b7:45:00 {set kmod = "3c450";}
elsif hwid=01:10:b7:45:00 {set kmod = "3c450-1";}
elsif hwid=01:10:b7:59:00 {set kmod = "3c590";}
elsif hwid=01:10:b7:59:50 {set kmod = "3c595";}
elsif hwid=01:10:b7:59:51 {set kmod = "3c595-1";}
elsif hwid=01:10:b7:59:52 {set kmod = "3c595-2";}
elsif hwid=01:10:b7:60:55 {set kmod = "3c556";}
elsif hwid=01:10:b7:76:46 {set kmod = "3csoho100-tx";}
elsif hwid=01:10:b7:76:46 {set kmod = "3csoho100-tx-1";}
elsif hwid=01:10:b7:77:70 {set kmod = "3c-airconnect";}
elsif hwid=01:10:b7:90:00 {set kmod = "3c900-tpo";}
elsif hwid=01:10:b7:90:00 {set kmod = "3c905-tpo";}
elsif hwid=01:10:b7:90:01 {set kmod = "3c900-t4";}
elsif hwid=01:10:b7:90:01 {set kmod = "3c905-t4";}
elsif hwid=01:10:b7:90:04 {set kmod = "3c900b-tpo";}
elsif hwid=01:10:b7:90:04 {set kmod = "3c905b-tpo";}
elsif hwid=01:10:b7:90:05 {set kmod = "3c900b-combo";}
elsif hwid=01:10:b7:90:05 {set kmod = "3c905b-combo";}
elsif hwid=01:10:b7:90:06 {set kmod = "3c900b-tpb2";}
elsif hwid=01:10:b7:90:06 {set kmod = "3c905b-tpb2";}
elsif hwid=01:10:b7:90:0a {set kmod = "3c900b-fl";}
elsif hwid=01:10:b7:90:0a {set kmod = "3c905b-fl";}
elsif hwid=01:10:b7:90:50 {set kmod = "3c905-tpo100";}
elsif hwid=01:10:b7:90:51 {set kmod = "3c905-combo";}
elsif hwid=01:10:b7:90:55 {set kmod = "3c905b-tpo100";}
elsif hwid=01:10:b7:90:56 {set kmod = "3c905b-t4";}
elsif hwid=01:10:b7:90:58 {set kmod = "3c905b-9058";}
elsif hwid=01:10:b7:90:5a {set kmod = "3c905b-fx";}
elsif hwid=01:10:b7:92:00 {set kmod = "3c905c-tpo";}
elsif hwid=01:10:b7:92:02 {set kmod = "3c920b-emb-ati";}
elsif hwid=01:10:b7:92:10 {set kmod = "3c920b-emb-wnm";}
elsif hwid=01:10:b7:93:00 {set kmod = "3csoho100b-tx";}
elsif hwid=01:10:b7:98:00 {set kmod = "3c980";}
elsif hwid=01:10:b7:98:00 {set kmod = "3c980-cyclone-1";}
elsif hwid=01:10:b7:98:05 {set kmod = "3c9805";}
elsif hwid=01:10:b7:98:05 {set kmod = "3c9805-1";}
elsif hwid=01:10:b8:00:05 {set kmod = "epic100";}
elsif hwid=01:10:b8:00:06 {set kmod = "smc-83c175";}
elsif hwid=01:10:b9:52:61 {set kmod = "ali1563";}
elsif hwid=01:10:bd:0e:34 {set kmod = "surecom-ne34";}
elsif hwid=01:10:d9:05:12 {set kmod = "mx98713";}
elsif hwid=01:10:d9:05:31 {set kmod = "mx98715";}
elsif hwid=01:10:de:00:37 {set kmod = "nforce10";}
elsif hwid=01:10:de:00:38 {set kmod = "nforce11";}
elsif hwid=01:10:de:00:56 {set kmod = "nforce8";}
elsif hwid=01:10:de:00:57 {set kmod = "nforce9";}
elsif hwid=01:10:de:00:66 {set kmod = "nforce2";}
elsif hwid=01:10:de:00:86 {set kmod = "nforce4";}
elsif hwid=01:10:de:00:8c {set kmod = "nforce5";}
elsif hwid=01:10:de:00:d6 {set kmod = "nforce3";}
elsif hwid=01:10:de:00:df {set kmod = "nforce7";}
elsif hwid=01:10:de:00:e6 {set kmod = "nforce6";}
elsif hwid=01:10:de:01:c3 {set kmod = "nforce";}
elsif hwid=01:10:de:02:68 {set kmod = "nforce12";}
elsif hwid=01:10:de:02:69 {set kmod = "nforce13";}
elsif hwid=01:10:de:03:72 {set kmod = "nforce14";}
elsif hwid=01:10:de:03:73 {set kmod = "nforce15";}
elsif hwid=01:10:ec:80:29 {set kmod = "rtl8029";}
elsif hwid=01:10:ec:81:29 {set kmod = "rtl8129";}
elsif hwid=01:10:ec:81:29 {set kmod = "rtl8169-0x8129";}
elsif hwid=01:10:ec:81:36 {set kmod = "rtl8169-0x8136";}
elsif hwid=01:10:ec:81:38 {set kmod = "rtl8139b";}
elsif hwid=01:10:ec:81:39 {set kmod = "rtl8139";}
elsif hwid=01:10:ec:81:67 {set kmod = "rtl8169-0x8167";}
elsif hwid=01:10:ec:81:68 {set kmod = "rtl8169-0x8168";}
elsif hwid=01:10:ec:81:69 {set kmod = "rtl8169-0x8169";}
elsif hwid=01:11:06:09:26 {set kmod = "via86c926";}
elsif hwid=01:11:06:30:43 {set kmod = "dlink-530tx-old";}
elsif hwid=01:11:06:30:53 {set kmod = "via6105m";}
elsif hwid=01:11:06:30:65 {set kmod = "dlink-530tx";}
elsif hwid=01:11:06:31:06 {set kmod = "via-rhine-6105";}
elsif hwid=01:11:06:31:19 {set kmod = "via-velocity";}
elsif hwid=01:11:06:61:00 {set kmod = "via-rhine-old";}
elsif hwid=01:11:12:12:11 {set kmod = "smc1211";}
elsif hwid=01:11:13:12:11 {set kmod = "smc1211-1";}
elsif hwid=01:11:13:12:16 {set kmod = "an983";}
elsif hwid=01:11:13:12:17 {set kmod = "mxic-98715";}
elsif hwid=01:11:13:95:11 {set kmod = "tulip-9511";}
elsif hwid=01:11:1a:10:23 {set kmod = "ss1023";}
elsif hwid=01:11:48:44:00 {set kmod = "tg3-9DXX";}
elsif hwid=01:11:48:45:00 {set kmod = "tg3-9MXX";}
elsif hwid=01:11:5d:00:03 {set kmod = "xircomtulip";}
elsif hwid=01:11:86:03:00 {set kmod = "dlink-528";}
elsif hwid=01:11:86:10:02 {set kmod = "dfe530txs";}
elsif hwid=01:11:86:13:00 {set kmod = "dfe538";}
elsif hwid=01:11:86:13:40 {set kmod = "dfe690txd";}
elsif hwid=01:11:86:15:61 {set kmod = "tulip-1561";}
elsif hwid=01:11:86:43:00 {set kmod = "rtl8169-0x4300";}
elsif hwid=01:11:ad:00:02 {set kmod = "82c168";}
elsif hwid=01:11:ad:c1:15 {set kmod = "lc82c115";}
elsif hwid=01:11:f6:14:01 {set kmod = "compexrl2000";}
elsif hwid=01:11:f6:20:11 {set kmod = "compexrl100atx";}
elsif hwid=01:11:f6:98:81 {set kmod = "rl100tx";}
elsif hwid=01:12:59:a1:17 {set kmod = "allied8139";}
elsif hwid=01:12:59:a1:20 {set kmod = "tulip-a120";}
elsif hwid=01:12:59:c1:07 {set kmod = "rtl8169-0xc107";}
elsif hwid=01:12:5b:14:00 {set kmod = "ax88140";}
elsif hwid=01:12:60:38:73 {set kmod = "dwl520";}
elsif hwid=01:12:60:38:73 {set kmod = "hwp01170";}
elsif hwid=01:12:60:38:73 {set kmod = "prism2_pci";}
elsif hwid=01:12:6c:80:30 {set kmod = "emobility";}
elsif hwid=01:12:82:90:09 {set kmod = "davicom9009";}
elsif hwid=01:12:82:90:09 {set kmod = "dm9009";}
elsif hwid=01:12:82:90:09 {set kmod = "dmfe9009";}
elsif hwid=01:12:82:91:00 {set kmod = "davicom9100";}
elsif hwid=01:12:82:91:00 {set kmod = "dm9100";}
elsif hwid=01:12:82:91:00 {set kmod = "dmfe9100";}
elsif hwid=01:12:82:91:02 {set kmod = "davicom9102";}
elsif hwid=01:12:82:91:02 {set kmod = "dm9102";}
elsif hwid=01:12:82:91:02 {set kmod = "dmfe9102";}
elsif hwid=01:12:82:91:32 {set kmod = "davicom9132";}
elsif hwid=01:12:82:91:32 {set kmod = "dm9132";}
elsif hwid=01:12:82:91:32 {set kmod = "dmfe9132";}
elsif hwid=01:12:c3:00:58 {set kmod = "holtek80232";}
elsif hwid=01:12:c3:55:98 {set kmod = "holtek80229";}
elsif hwid=01:13:17:09:81 {set kmod = "an981";}
elsif hwid=01:13:17:09:85 {set kmod = "centaur-p";}
elsif hwid=01:13:17:19:85 {set kmod = "centaur-c";}
elsif hwid=01:13:17:95:11 {set kmod = "an983b";}
elsif hwid=01:13:85:41:00 {set kmod = "ma301";}
elsif hwid=01:13:d1:ab:02 {set kmod = "tulip-ab02";}
elsif hwid=01:13:d1:ab:03 {set kmod = "tulip-ab03";}
elsif hwid=01:13:d1:ab:06 {set kmod = "fe2000vx";}
elsif hwid=01:13:d1:ab:08 {set kmod = "tulip-ab08";}
elsif hwid=01:13:f0:02:01 {set kmod = "sundance";}
elsif hwid=01:14:c1:00:08 {set kmod = "LANai-Z8E";}
elsif hwid=01:14:e4:16:44 {set kmod = "tg3-5700";}
elsif hwid=01:14:e4:16:45 {set kmod = "tg3-5701";}
elsif hwid=01:14:e4:16:46 {set kmod = "tg3-5702";}
elsif hwid=01:14:e4:16:47 {set kmod = "tg3-5703";}
elsif hwid=01:14:e4:16:48 {set kmod = "tg3-5704";}
elsif hwid=01:14:e4:16:4a {set kmod = "bnx2-5706";}
elsif hwid=01:14:e4:16:4c {set kmod = "bnx2-5708";}
elsif hwid=01:14:e4:16:4d {set kmod = "tg3-5702FE";}
elsif hwid=01:14:e4:16:53 {set kmod = "tg3-5705";}
elsif hwid=01:14:e4:16:54 {set kmod = "tg3-5705_2";}
elsif hwid=01:14:e4:16:59 {set kmod = "tg3-5721";}
elsif hwid=01:14:e4:16:5d {set kmod = "tg3-5705M";}
elsif hwid=01:14:e4:16:5e {set kmod = "tg3-5705M_2";}
elsif hwid=01:14:e4:16:77 {set kmod = "tg3-5751";}
elsif hwid=01:14:e4:16:96 {set kmod = "tg3-5782";}
elsif hwid=01:14:e4:16:9c {set kmod = "tg3-5788";}
elsif hwid=01:14:e4:16:a6 {set kmod = "tg3-5702X";}
elsif hwid=01:14:e4:16:a7 {set kmod = "tg3-5703X";}
elsif hwid=01:14:e4:16:a8 {set kmod = "tg3-5704S";}
elsif hwid=01:14:e4:16:aa {set kmod = "bnx2-5706S";}
elsif hwid=01:14:e4:16:ac {set kmod = "bnx2-5708S";}
elsif hwid=01:14:e4:16:c6 {set kmod = "tg3-5702A3";}
elsif hwid=01:14:e4:16:c7 {set kmod = "tg3-5703A3";}
elsif hwid=01:14:e4:17:0d {set kmod = "tg3-5901";}
elsif hwid=01:14:e4:17:0e {set kmod = "tg3-5901_2";}
elsif hwid=01:14:ea:ab:06 {set kmod = "fnw3603tx";}
elsif hwid=01:14:ea:ab:07 {set kmod = "fnw3800tx";}
elsif hwid=01:14:f1:18:03 {set kmod = "lanfinity";}
elsif hwid=01:15:00:13:60 {set kmod = "delta8139";}
elsif hwid=01:15:16:08:00 {set kmod = "MTD800";}
elsif hwid=01:15:16:08:03 {set kmod = "MTD803";}
elsif hwid=01:15:16:08:91 {set kmod = "MTD891";}
elsif hwid=01:15:b3:5a:44 {set kmod = "MT23108";}
elsif hwid=01:15:b3:62:74 {set kmod = "MT25204";}
elsif hwid=01:15:b3:62:78 {set kmod = "MT25208";}
elsif hwid=01:15:b3:62:82 {set kmod = "MT25218";}
elsif hwid=01:15:e8:01:30 {set kmod = "correga";}
elsif hwid=01:16:26:84:10 {set kmod = "tulip-8410";}
elsif hwid=01:16:38:11:00 {set kmod = "smc2602w";}
elsif hwid=01:16:ab:11:00 {set kmod = "gl24110p";}
elsif hwid=01:16:ab:11:01 {set kmod = "16ab-1101";}
elsif hwid=01:16:ab:11:02 {set kmod = "wdt11";}
elsif hwid=01:16:ec:01:16 {set kmod = "rtl8169-0x0116";}
elsif hwid=01:16:ec:36:85 {set kmod = "usr2415";}
elsif hwid=01:17:37:10:32 {set kmod = "rtl8169-0x1032";}
elsif hwid=01:17:37:ab:08 {set kmod = "tulip-1737-ab08";}
elsif hwid=01:17:37:ab:09 {set kmod = "tulip-ab09";}
elsif hwid=01:17:3b:03:e8 {set kmod = "tg3-ac1000";}
elsif hwid=01:17:3b:03:e9 {set kmod = "tg3-ac1001";}
elsif hwid=01:17:3b:03:ea {set kmod = "tg3-ac9100";}
elsif hwid=01:17:3b:03:eb {set kmod = "tg3-ac1003";}
elsif hwid=01:19:24:07:03 {set kmod = "falcon";}
elsif hwid=01:19:24:c1:01 {set kmod = "ef1002";}
elsif hwid=01:1a:f4:10:00 {set kmod = "virtio-net";}
elsif hwid=01:40:33:13:60 {set kmod = "addtron8139";}
elsif hwid=01:4a:14:50:00 {set kmod = "nv5000sc";}
elsif hwid=01:80:86:00:39 {set kmod = "intel21145";}
elsif hwid=01:80:86:10:00 {set kmod = "e1000-82542";}
elsif hwid=01:80:86:10:01 {set kmod = "e1000-82543gc-fiber";}
elsif hwid=01:80:86:10:04 {set kmod = "e1000-82543gc-copper";}
elsif hwid=01:80:86:10:08 {set kmod = "e1000-82544ei-copper";}
elsif hwid=01:80:86:10:09 {set kmod = "e1000-82544ei-fiber";}
elsif hwid=01:80:86:10:0c {set kmod = "e1000-82544gc-copper";}
elsif hwid=01:80:86:10:0d {set kmod = "e1000-82544gc-lom";}
elsif hwid=01:80:86:10:0e {set kmod = "e1000-82540em";}
elsif hwid=01:80:86:10:0f {set kmod = "e1000-82545em-copper";}
elsif hwid=01:80:86:10:10 {set kmod = "e1000-82546eb-copper";}
elsif hwid=01:80:86:10:11 {set kmod = "e1000-82545em-fiber";}
elsif hwid=01:80:86:10:12 {set kmod = "e1000-82546eb-fiber";}
elsif hwid=01:80:86:10:13 {set kmod = "e1000-82541ei";}
elsif hwid=01:80:86:10:15 {set kmod = "e1000-82540em-lom";}
elsif hwid=01:80:86:10:16 {set kmod = "e1000-82540ep-lom";}
elsif hwid=01:80:86:10:17 {set kmod = "e1000-82540ep";}
elsif hwid=01:80:86:10:18 {set kmod = "e1000-82541ep";}
elsif hwid=01:80:86:10:19 {set kmod = "e1000-82547ei";}
elsif hwid=01:80:86:10:1d {set kmod = "e1000-82546eb-quad-copper";}
elsif hwid=01:80:86:10:1e {set kmod = "e1000-82540ep-lp";}
elsif hwid=01:80:86:10:26 {set kmod = "e1000-82545gm-copper";}
elsif hwid=01:80:86:10:27 {set kmod = "e1000-82545gm-fiber";}
elsif hwid=01:80:86:10:28 {set kmod = "e1000-82545gm-serdes";}
elsif hwid=01:80:86:10:29 {set kmod = "id1029";}
elsif hwid=01:80:86:10:30 {set kmod = "id1030";}
elsif hwid=01:80:86:10:31 {set kmod = "82801cam";}
elsif hwid=01:80:86:10:32 {set kmod = "eepro100-1032";}
elsif hwid=01:80:86:10:33 {set kmod = "eepro100-1033";}
elsif hwid=01:80:86:10:34 {set kmod = "eepro100-1034";}
elsif hwid=01:80:86:10:35 {set kmod = "eepro100-1035";}
elsif hwid=01:80:86:10:36 {set kmod = "eepro100-1036";}
elsif hwid=01:80:86:10:37 {set kmod = "eepro100-1037";}
elsif hwid=01:80:86:10:38 {set kmod = "id1038";}
elsif hwid=01:80:86:10:39 {set kmod = "82562et";}
elsif hwid=01:80:86:10:3a {set kmod = "id103a";}
elsif hwid=01:80:86:10:3b {set kmod = "82562etb";}
elsif hwid=01:80:86:10:3c {set kmod = "eepro100-103c";}
elsif hwid=01:80:86:10:3d {set kmod = "eepro100-103d";}
elsif hwid=01:80:86:10:3e {set kmod = "eepro100-103e";}
elsif hwid=01:80:86:10:50 {set kmod = "82562ez";}
elsif hwid=01:80:86:10:51 {set kmod = "eepro100-1051";}
elsif hwid=01:80:86:10:51 {set kmod = "prove";}
elsif hwid=01:80:86:10:59 {set kmod = "82551qm";}
elsif hwid=01:80:86:10:75 {set kmod = "e1000-82547gi";}
elsif hwid=01:80:86:10:76 {set kmod = "e1000-82541gi";}
elsif hwid=01:80:86:10:77 {set kmod = "e1000-82541gi-mobile";}
elsif hwid=01:80:86:10:78 {set kmod = "e1000-82541er";}
elsif hwid=01:80:86:10:79 {set kmod = "e1000-82546gb-copper";}
elsif hwid=01:80:86:10:7a {set kmod = "e1000-82546gb-fiber";}
elsif hwid=01:80:86:10:7b {set kmod = "e1000-82546gb-serdes";}
elsif hwid=01:80:86:10:7c {set kmod = "e1000-82541pi";}
elsif hwid=01:80:86:10:96 {set kmod = "e1000_80003es2lan";}
elsif hwid=01:80:86:12:09 {set kmod = "82559er";}
elsif hwid=01:80:86:12:27 {set kmod = "82865";}
elsif hwid=01:80:86:12:28 {set kmod = "82556";}
elsif hwid=01:80:86:12:29 {set kmod = "eepro100";}
elsif hwid=01:80:86:24:49 {set kmod = "82562em";}
elsif hwid=01:80:86:24:59 {set kmod = "82562-1";}
elsif hwid=01:80:86:24:5d {set kmod = "82562-2";}
elsif hwid=01:80:86:52:00 {set kmod = "eepro100-5200";}
elsif hwid=01:80:86:52:01 {set kmod = "eepro100-5201";}
elsif hwid=01:8e:2e:30:00 {set kmod = "ktiet32p2";}
elsif hwid=01:ec:80:ec:00 {set kmod = "f5d6000";}
elsif hwid=01:fe:fe:ef:ef {set kmod = "pnic";}
elsif hwid=01:ff:ff:81:39 {set kmod = "clone-rtl8139";}
else{set kmod = "unknown";}
option etherboot.kmod = kmod;
log(debug,concat ( "bsdp:",binary-to-ascii ( 10, 8, ".", option bsdp.reply_port)));
if exists bsdp.reply_port {
log(debug, "option bsdp.reply_port");
log(debug, option bsdp.reply_port);
}
#log(debug, option vendor-class-identifier);
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
log(debug, "1.pxe");
#option pxelinux.reboottime code 211 = unsigned integer 32;
#site-option-space "pxelinux";
if exists dhcp-parameter-request-list {
option dhcp-parameter-request-list = concat (option dhcp-parameter-request-list,d0,d1,d2,d3,af);
}
if not exists ipxe.http {
}elsif exists dhcp-server-identifier {
option pxelinux.pathprefix = concat("http://", binary-to-ascii(10, 8, ".", option dhcp-server-identifier), "/tftpboot/");
}else{
log(debug, "no server identifier");
option pxelinux.pathprefix "http://$ip/tftpboot/";
}
if (
exists ipxe.http and
exists ipxe.menu and
exists ipxe.nfs and
( ( exists ipxe.pxe and
exists ipxe.bzimage and
exists ipxe.elf and
exists ipxe.comboot and
exists ipxe.iscsi
) or (
exists ipxe.efi
) )
) {
log(debug, "2.menu");
option ipxe.no-pxedhcp 1;
if exists dhcp-server-identifier {
filename = concat("http://", binary-to-ascii ( 10, 8, ".", option dhcp-server-identifier), "/ipxe/boot.ipxe");
} else {
log(debug, "no server identifier");
filename = "boot.ipxe";
}
} elsif not exists client-arch {
log(debug, "2.unk");
#guessing . . .
filename "undionly.kpxe";
} elsif substring(option client-arch,0,0) = option client-arch {
log(debug, "2.null");
#guessing . . .
filename "undionly.kpxe";
eof
print @c;
print <<"eof";
} else {
log(debug, "2.X");
log(debug, option client-arch);
log(debug, binary-to-ascii(10,16,",", option client-arch));
#guessing . . .
#filename "/tftpboot/pxelinux-i386.0";
filename "undionly.kpxe";
#filename "/grub/grub.pxe";
#filename "/grub2/grub.pxe";
}
} elsif substring (option vendor-class-identifier, 0, 9) = "AAPLBSDPC" {
log(debug, "1.bsdp");
log(debug, binary-to-ascii(16, 8, ":", option bsdp.reply_port));
log(debug, binary-to-ascii(16, 8, ":", option bsdp.bsdp_version));
option bsdp.bsdp_version 0x0101;
option bsdp.server_identifier = config-option dhcp-server-identifier;
option bsdp.server_priority 65535;
option dhcp-parameter-request-list 1,3,17,43,60;
#option dhcp-parameter-request-list 1,3,11,17,43,60;
option vendor-class-identifier "AAPLBSDPC";
if (option dhcp-message-type = 1) {
log(debug, "1.bsdp.1");
log(debug, option vendor-class-identifier);
log(debug, binary-to-ascii(16, 8, ":", option bsdp.message_type));
eof
}
our %files;
if(/^#/){$_='';next;}
elsif(/^a[ ]+(.*)$/){push @arch, $1;$_='';}
elsif(s!^d[ ]+(\d+)[ ]+(\d+)[ ]+(\d+|auto)$!
my ($a,$b,$d)=($1,$2,('auto'eq$3?$c:$3));
my $g=join q(:),
grep({$_} split(/(..)/,unpack(q(H*),pack(q(Cxn),($1<<7)+$2,$d))));
"\t\toption bsdp.default_boot_image_id ".$g."; # Image ID (".($d).")";
!e
){$bsdp_default=$_}
elsif(s!^(\d+)[ ]+(\d+)[ ]+(\d+|auto)[ ]+([^ ]*)[ ]+(.*)$!
my ($a,$b,$d,$e,$f)=($1,$2,('auto'eq$3?$c++:$3),$5,$4);
my $tab = "\t"x(5-(length($5)*3+7)/8);
my $g=join q(:), grep({$_} split(/(..)/,unpack(q(H*),pack(q(CxnC/a),($1<<7)+$2,$d,$5)))),"$tab\t# Name (length ".length($5).") '$5'";
$g=~s/^(..:..:..:..):/push @a,$1;$files{$1}=$f;"\t\t\t$1:\t\t\t\t\t# Image ".($a?"":"non-")."install ID $d\n\0\t\t\t\t"/e;
$g!e
){push @b,split /\0/, $_;$_='';}
END{
#my $ip='192.168.0.1';
#my $ip='192.168.219.1';
my $ip='192.0.2.1';
$b[-1]=~s!:(\t+# N)!;$1!;
print "\n\t\toption bsdp.boot_image_list\n";
print @b,"\n";
print <<"eof";
} elsif (option dhcp-message-type = 3) {
log(debug, "1.bsdp.3");
log(debug, binary-to-ascii(16, 8, ":", option bsdp.message_type));
option bsdp.default_boot_image_id 01:00:00:01; # Image ID (1)
option bsdp.boot_image_list
eof
print @b;
print <<"eof";
} elsif (option dhcp-message-type = 8) {
log(debug, "1.bsdp.8");
if option bsdp.message_type = 1 {
log(debug, "1.bsdp.8.1_list");
#log(debug, "bsdp_msgtype_list");
option bsdp.message_type 1; # list
eof
print "\t",$bsdp_default;
print <<"eof";
option bsdp.boot_image_list
eof
print "\t",join "\t",@b;
print <<"eof";
} elsif option bsdp.message_type = 2 {
log(debug, "1.bsdp.8.2_select");
log(debug, option bsdp.selected_boot_image_id);
log(debug, binary-to-ascii(16, 8, " ", option bsdp.selected_boot_image_id));
#log(debug, "bspd_msgtype_select");
option bsdp.message_type 2; # select
eof
print "\t\t if option bsdp.selected_boot_image_id = ".join("
} elsif option bsdp.selected_boot_image_id = ",map {my $a=$_;my $f=$files{$a};my $b=$_." {
option bsdp.selected_boot_image_id ".$_.";
";if('-'eq$f){$b.="#filename \"\";"}elsif($f=~/,/){my %f;@f{@arch,'default'}=split /,/, $f;$b.=(join '', map {"if (substring(option vendor-class-identifier, 9, ".(length($_)+1).") = \"/$_\") {
filename \"$f{$_}\";
} els"} @arch )."e {
filename ".($f{default}?"\"$f{default}\"":'= option vendor-class-identifier').";
}"}else{$b.="filename \"$files{$a}\";"}$b.""} @a)."\n";
print <<"eof";
} else {
log(info, "bspd_selected_unknown_image");
}
} else {
log(debug, "1.bsdp.8.error");
log(info, "bspd_msgtype_failed");
}
} else {
log(debug, "1.bsdp.?");
log(debug, binary-to-ascii(16,8,":", option dhcp-message-type));
log(debug,concat("bsdp:",binary-to-ascii(10,8,".",option bsdp.reply_port)));
}
if substring (option vendor-class-identifier, 9, 4) = "/ppc" {
log(debug, "1.bsdp.p");
option dhcp-parameter-request-list 1,3,6,12,15,17,43,53,54,60;
}
} elsif substring (option vendor-class-identifier, 0, 9) = "Etherboot"{
log(debug, "1.eth");
# We must specify this value for etherboot-magic, or Etherboot will
# ignore all other options.
#
option etherboot.magic E4:45:74:68:00:00; # NOT a mac address
# Bootfile name: derive from etherboot.kmod (calculated below)
# Use boot.nbi if no NIC_DEV_ID option present
# (i.e. if etherboot.kmod doesn't get set)
# Also pass filename back in filename field
#
option bootfile-name = pick-first-value (
concat ("etherboot/",kmod,".nb"),
"boot.nb"
);
filename = config-option bootfile-name;
#option etherboot.kernel-cmdline " boot=live config netboot=nfs nfsroot=$ip:/srv/debian-live quiet";
# Info message (includes client IP address, MAC address, hardware ID string,
# server IP address and name of boot file)
option etherboot.motd-4 = concat (
"Using Etherboot to boot ",
binary-to-ascii ( 10, 8, ".", leased-address ),
" [",
binary-to-ascii ( 16, 8, ":", suffix ( hardware, 6 ) ),
"] [",
pick-first-value ( option etherboot.nic-dev-id, "unknown card" ),
"]", 0d:0a, " from ",
binary-to-ascii ( 10, 8, ".", option dhcp-server-identifier ),
" with file ",
config-option tftp-server-name,
":",
config-option bootfile-name,
" [",
pick-first-value ( kmod, "unknown module" ),
"]", 0d:0a
);
# Legacy site-local option support
# If client does not include an etherboot-encapsulated-options field in its DHCPREQUEST, then
# it will not understand etherboot-encapsulated-options in the DHCPACK and so we must send
# back the options as site-local options (i.e. not encapsulated).
# Note: we need do this only for options that existed prior to the switch to encapsulation.
#
if not exists etherboot-encapsulated-options {
option legacy-etherboot-magic = config-option etherboot.magic;
option legacy-etherboot-kernel-cmdline = config-option etherboot.kernel-cmdline;
option legacy-etherboot-menu-opts = config-option etherboot.menu-opts;
option legacy-etherboot-menu-selection = config-option etherboot.menu-selection;
option legacy-etherboot-motd-1 = config-option etherboot.motd-1;
option legacy-etherboot-motd-2 = config-option etherboot.motd-2;
option legacy-etherboot-motd-3 = config-option etherboot.motd-3;
option legacy-etherboot-motd-4 = config-option etherboot.motd-4;
option legacy-etherboot-motd-5 = config-option etherboot.motd-5;
option legacy-etherboot-motd-6 = config-option etherboot.motd-6;
option legacy-etherboot-motd-7 = config-option etherboot.motd-7;
option legacy-etherboot-motd-8 = config-option etherboot.motd-8;
option legacy-etherboot-image-1 = config-option etherboot.image-1;
option legacy-etherboot-image-2 = config-option etherboot.image-2;
option legacy-etherboot-image-3 = config-option etherboot.image-3;
option legacy-etherboot-image-4 = config-option etherboot.image-4;
option legacy-etherboot-image-5 = config-option etherboot.image-5;
option legacy-etherboot-image-6 = config-option etherboot.image-6;
option legacy-etherboot-image-7 = config-option etherboot.image-7;
option legacy-etherboot-image-8 = config-option etherboot.image-8;
option legacy-etherboot-image-9 = config-option etherboot.image-9;
option legacy-etherboot-image-10 = config-option etherboot.image-10;
option legacy-etherboot-image-11 = config-option etherboot.image-11;
option legacy-etherboot-image-12 = config-option etherboot.image-12;
option legacy-etherboot-image-13 = config-option etherboot.image-13;
option legacy-etherboot-image-14 = config-option etherboot.image-14;
option legacy-etherboot-image-15 = config-option etherboot.image-15;
option legacy-etherboot-image-16 = config-option etherboot.image-16;
}
} elsif(option vendor-class-identifier = "d-i"){
log(debug, "1.d-i");
filename = concat ("http://",binary-to-ascii ( 10, 8, ".", config-option dhcp-server-identifier),"/debian/preseed.cfg");
option test = concat ("http://",binary-to-ascii ( 10, 8, ".", config-option dhcp-server-identifier),"/debian/preseed.cfg");
} elsif substring (option vendor-class-identifier, 0, 7) = "dhcpcd-"{
log(debug, "1.other");
log(debug, option vendor-class-identifier);
} elsif substring (option vendor-class-identifier, 0, 2) = "PC"{
log(debug, "1.pc");
filename "yaboot.pc";
} elsif substring (option vendor-class-identifier, 0, 8) = "MSFT 5.0"{
log(debug, "1.msft");
} elsif substring (option vendor-class-identifier, 0, 5) = "LTSP-"{
log(debug, "1.ltsp");
option root-path = concat ( config-option tftp-server-name, ":/opt/ltsp-4.2/", substring(option vendor-class-identifier, 5, 99));
} elsif exists vendor-class-identifier {
log(debug, "1.unknown");
option bsdp.boot_image_list
eof
print @b;
print <<"eof";
log(debug, option vendor-class-identifier);
#guessing . . .
filename = option vendor-class-identifier;
# hopefuly we'll get a log from the tftp server.
} elsif not exists mac-nc-client-id {
if exists dhcp-message-type {
log(debug, "1.none.1");
#log(debug, binary-to-ascii(16,8, " ", option dhcp-message-type));
#guessing . . .
filename "ipxe.ipxe";
} else {
#log(debug, "1.none.2");
}
} elsif option mac-nc-client-id = "Apple MacNC" {
log(debug, "1.old mac");
option dhcp-max-message-size 576;
option dhcp-parameter-request-list
1, # subnet mask
3, # routers
66, # server-name
220, 221, 230, 232, 233, 234, 235, 236, 237, 238; # mac options
# put global macnc-specific options here...
#option mac-version 0:0:0:0;
filename "yaboot";