恥ずかしい勘違いから生まれた、DHCP6の不要かつ部分的な実装
Révision | 11500c928ed92f1a0ba7b31598088c776de0ab66 (tree) |
---|---|
l'heure | 2021-08-12 21:46:20 |
Auteur | dyknon <dyknon@user...> |
Commiter | dyknon |
Leave option body unparsed if error
@@ -51,9 +51,13 @@ sub new { | ||
51 | 51 | |
52 | 52 | my @ooro = grep{$_->code == DHCP6_OPT_ORO}@{$opts{options}}; |
53 | 53 | die "there are multiple option request options" if(@ooro >= 2); |
54 | - @{$opts{options}} = grep{$_->code != DHCP6_OPT_ORO}@{$opts{options}}; | |
55 | - push @{$opts{request}}, $ooro[0]->all_elems if(@ooro); | |
56 | - push @{$opts{options}}, d6opt_new_option_request(list => @{$opts{request}}); | |
54 | + if(@{$opts{request}}){ | |
55 | + die if(!$ooro[0]->isa(Net::DHCP6::Option::OptionRequest)); | |
56 | + @{$opts{options}} = grep{$_->code != DHCP6_OPT_ORO}@{$opts{options}}; | |
57 | + push @{$opts{request}}, $ooro[0]->all_elems if(@ooro); | |
58 | + push @{$opts{options}}, | |
59 | + d6opt_new_option_request(list => @{$opts{request}}); | |
60 | + } | |
57 | 61 | delete $opts{request}; |
58 | 62 | |
59 | 63 | my $ocid = grep{$_->code == DHCP6_OPT_CLIENTID}@{$opts{options}}; |
@@ -51,8 +51,9 @@ sub parse { | ||
51 | 51 | die "end of buffer" if(length $data != $len); |
52 | 52 | $$buf = substr($$buf, 4 + $len); |
53 | 53 | |
54 | - $class = $class->find_subclass($code); | |
55 | - $class->new(code => $code, data => $data); | |
54 | + my $subclass = $class->find_subclass($code); | |
55 | + eval{$subclass->new(code => $code, data => $data)} | |
56 | + // $class->new(code => $code, data => $data); | |
56 | 57 | } |
57 | 58 | |
58 | 59 | sub register_option { |