+
+ /*Check option length*/
+ length=*(opt+1);
+ if(length > optlen){
+ dbgprintf(0, "Warning: Option would extend into packet data\n");
+ return 0;
+ }
+ if(length < 2){
+ dbgprintf(0, "Warning: Bad Option!\n");
+ return 0;
+ }
+
+ /*Ack Vector Option*/
+ if(*opt==38 || *opt==39){
+ if(B->type==UNKNOWN){
+ B->type=CCID2;
+ if(pkt->print_id){
+ dbgprintf(1,"Half-connection from %s:%i to %s:%i probably using CCID 2\n",
+ pkt->print_id(buf1,100,pkt->dest_id,pkt->id_len),ntohs(B->port),
+ pkt->print_id(buf2,100,pkt->src_id,pkt->id_len), ntohs(A->port));
+ }else{
+ dbgprintf(1,"Half-connection from port %i to %i probably using CCID 2\n",
+ ntohs(B->port),ntohs(A->port));
+ }
+ }
+ }
+
+ /*NDP Count Option*/
+ if(*opt==37){
+ if(B->type==UNKNOWN){
+ B->type=CCID3;
+ if(pkt->print_id){
+ dbgprintf(1,"Half-connection from %s:%i to %s:%i probably using CCID 3\n",
+ pkt->print_id(buf1,100,pkt->dest_id,pkt->id_len),ntohs(B->port),
+ pkt->print_id(buf2,100,pkt->src_id,pkt->id_len), ntohs(A->port));
+ }else{
+ dbgprintf(1,"Half-connection from port %i to %i probably using CCID 3\n",
+ ntohs(B->port),ntohs(A->port));
+ }
+ }
+ }
+
+ /*Feature negotation*/
+ if(*opt==32){
+ /*Change L*/
+ if(!process_feature(opt+2,length-2,FALSE,TRUE,pkt,A,B)){
+ return 0;
+ }
+ }
+ if(*opt==33){
+ /*Confirm L*/
+ if(!process_feature(opt+2,length-2,TRUE,TRUE,pkt,A,B)){
+ return 0;
+ }
+ }
+ if(*opt==34){
+ /*Change R*/
+ if(!process_feature(opt+2,length-2,FALSE,FALSE,pkt,A,B)){
+ return 0;
+ }
+ }
+ if(*opt==35){
+ /*Confirm R*/
+ if(!process_feature(opt+2,length-2,TRUE,FALSE,pkt,A,B)){
+ return 0;
+ }
+ }
+
+ optlen-=length;
+ opt+=length;