aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/securityfs_if.c
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2014-08-20 12:19:41 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-09-07 16:47:33 -0400
commitd126eb2a5053f139e5bc1b37344edd88d32bd033 (patch)
treee8c2493957e6efdeb00fdc0abe96a11a17ed0910 /security/tomoyo/securityfs_if.c
parent0ce2d95d10bc7ecab7fcf1e4bb5d9942625f91e7 (diff)
Add ARM syscall def for get_current_budgetv2015.1
Diffstat (limited to 'security/tomoyo/securityfs_if.c')
0 files changed, 0 insertions, 0 deletions
&id=3df80d9320bcaea72b1b4761a319c79cb3fdaf5f'>3df80d9320bc
3df80d9320bc



ab1e0a13d702
3df80d9320bc


9327f7053e39
3df80d9320bc



6f4e5fff1e4d
868c86bcb5bd
b71d1d426d26

3df80d9320bc
6f4e5fff1e4d


bb29624614c2
6f4e5fff1e4d





3df80d9320bc

6e5714eaf77d
d7f7365f5776
0660e03f6b18

d7f7365f5776


3df80d9320bc

3df80d9320bc
d5fdd6babcfc
3df80d9320bc
b71d1d426d26
3df80d9320bc
e0bcfb0c6a6e
3df80d9320bc



ca12a1a443a5
3df80d9320bc
860239c56bbc

e41b5368e029

860239c56bbc


ca12a1a443a5
671a1c7401c6
d86e0dac2ce4
3df80d9320bc

e41b5368e029

3df80d9320bc



9469c7b4aa21
3df80d9320bc




de0744af1fe2
3df80d9320bc



e0bcfb0c6a6e







3df80d9320bc


3df80d9320bc








3df80d9320bc

4c9483b2fb5d
3df80d9320bc




4c9483b2fb5d




1958b856c1a5

4c9483b2fb5d


68d0c6d34d58

3df80d9320bc

3df80d9320bc


d83d8461f902
3df80d9320bc







3df80d9320bc









45329e71eeb6
3df80d9320bc

45329e71eeb6


3df80d9320bc
547b792cac0a
3df80d9320bc

de0744af1fe2
3df80d9320bc







45329e71eeb6
3df80d9320bc







3df80d9320bc

















e6b4d1136751

3df80d9320bc




20c59de2e6b6
4c9483b2fb5d
3df80d9320bc
fd80eb942ad9
3df80d9320bc
4c9483b2fb5d





1958b856c1a5

4c9483b2fb5d
3df80d9320bc
fd80eb942ad9
3df80d9320bc
4c9483b2fb5d
3df80d9320bc
4c9483b2fb5d
68d0c6d34d58


fd80eb942ad9
68d0c6d34d58
3df80d9320bc



45329e71eeb6
6f4e5fff1e4d


4c9483b2fb5d
b903d324bee2
b9df3cb8cf9a
3df80d9320bc


45329e71eeb6
3df80d9320bc
0cbd782507c5
3df80d9320bc




d99a7bd210a1
3df80d9320bc



cfb6eeb4c860
3df80d9320bc
b71d1d426d26
3df80d9320bc
4c9483b2fb5d
adf30907d638
334527d3511e
adf30907d638
3df80d9320bc
e356d37a096a
3df80d9320bc


45329e71eeb6
3df80d9320bc
0204774191d3
45329e71eeb6
8109b02b5397
3df80d9320bc
0660e03f6b18
e356d37a096a

6f4e5fff1e4d
4c9483b2fb5d


6f4e5fff1e4d
4c9483b2fb5d

1958b856c1a5

4c9483b2fb5d
3df80d9320bc

4c9483b2fb5d
68d0c6d34d58

b903d324bee2
68d0c6d34d58


3df80d9320bc




73c9e02c22e3








3df80d9320bc


0660e03f6b18
3df80d9320bc










671a1c7401c6
3df80d9320bc


3df80d9320bc




9469c7b4aa21
3df80d9320bc







3df80d9320bc



8109b02b5397
3df80d9320bc
3df80d9320bc




4a5409a5a850
3df80d9320bc

4a5409a5a850
3df80d9320bc
8109b02b5397
3df80d9320bc
45329e71eeb6
3df80d9320bc
4a5409a5a850
3df80d9320bc
45329e71eeb6
3df80d9320bc



82709531a800
3df80d9320bc


ac75773c2742

3df80d9320bc
8b8194124814



4237c75c0a35


3df80d9320bc
0660e03f6b18

3df80d9320bc













45329e71eeb6
3df80d9320bc

d83ca5accb25
3df80d9320bc
d83ca5accb25

3df80d9320bc
3df80d9320bc
865e9022d88c
3df80d9320bc

e6b4d1136751
3df80d9320bc








3df80d9320bc










3df80d9320bc







3df80d9320bc
45329e71eeb6
3df80d9320bc


3df80d9320bc





c720c7e8383a
3df80d9320bc
c720c7e8383a
3df80d9320bc







0660e03f6b18
3df80d9320bc










d83d8461f902
3df80d9320bc








3df80d9320bc
20c59de2e6b6
4c9483b2fb5d







1958b856c1a5

4c9483b2fb5d


68d0c6d34d58
3df80d9320bc
45329e71eeb6
3df80d9320bc


093d282321da
3df80d9320bc






8e1ef0a95b87
45329e71eeb6

3df80d9320bc


3df80d9320bc








45329e71eeb6
3df80d9320bc


f6d8bd051c39
3df80d9320bc














0660e03f6b18
3df80d9320bc
45329e71eeb6




3df80d9320bc
45329e71eeb6
3df80d9320bc




d83d8461f902
45329e71eeb6
d83d8461f902

3df80d9320bc


c720c7e8383a

3df80d9320bc
093d282321da



9327f7053e39
3df80d9320bc



de0744af1fe2
093d282321da

3df80d9320bc
de0744af1fe2
45329e71eeb6
3df80d9320bc
3df80d9320bc


























fda9ef5d679b
3df80d9320bc


45329e71eeb6

3df80d9320bc












c9eaf1734183
3df80d9320bc

89e7e57778ec



3df80d9320bc




fd169f15a67b
89e7e57778ec
fd169f15a67b

3df80d9320bc


d83ca5accb25























45329e71eeb6
3df80d9320bc
3df80d9320bc
45329e71eeb6

3df80d9320bc




8109b02b5397
3df80d9320bc

45329e71eeb6
3df80d9320bc






fd169f15a67b
89e7e57778ec
fd169f15a67b

3df80d9320bc


cfb6eeb4c860
3df80d9320bc
45329e71eeb6
3df80d9320bc




e5bbef20e017
3df80d9320bc

3df80d9320bc
6f4e5fff1e4d
3df80d9320bc
6f4e5fff1e4d
3df80d9320bc



6f4e5fff1e4d
0660e03f6b18

59348b19efeb
6f4e5fff1e4d


3df80d9320bc

fde20105f332
3df80d9320bc







8109b02b5397
9a1f27c48065

45329e71eeb6
3df80d9320bc
8109b02b5397
3df80d9320bc
d23c7107bfba


3df80d9320bc
d23c7107bfba
3df80d9320bc
45329e71eeb6
3df80d9320bc
8109b02b5397
3df80d9320bc


d23c7107bfba




3df80d9320bc
6f4e5fff1e4d

8109b02b5397

6f4e5fff1e4d








3df80d9320bc


58a5a7b9555e
3df80d9320bc





8109b02b5397
3df80d9320bc





cfb6eeb4c860
3df80d9320bc
3df80d9320bc
d23c7107bfba
3df80d9320bc





3df80d9320bc

73c9e02c22e3







20c59de2e6b6
4c9483b2fb5d
73c9e02c22e3











4c9483b2fb5d
73c9e02c22e3

4c9483b2fb5d


73c9e02c22e3
4c9483b2fb5d
73c9e02c22e3



































4c9483b2fb5d
73c9e02c22e3

























73c9e02c22e3
c720c7e8383a

73c9e02c22e3






4c9483b2fb5d



1958b856c1a5

4c9483b2fb5d
73c9e02c22e3
4c9483b2fb5d
73c9e02c22e3
4c9483b2fb5d
68d0c6d34d58

73c9e02c22e3
14e50e57aedb
73c9e02c22e3

4c9483b2fb5d
73c9e02c22e3




c720c7e8383a
73c9e02c22e3







c720c7e8383a
73c9e02c22e3




d7f7365f5776


c720c7e8383a

73c9e02c22e3









c720c7e8383a
73c9e02c22e3



3b401a81c0d5
543d9cfeec4d









ab1e0a13d702
3fdadf7d27e3
543d9cfeec4d

3fdadf7d27e3
3df80d9320bc




3b401a81c0d5
543d9cfeec4d









3fdadf7d27e3
543d9cfeec4d

3fdadf7d27e3
3df80d9320bc






72478873571d

3df80d9320bc
72478873571d


3df80d9320bc
72478873571d
3df80d9320bc



7d06b2e053d2
3df80d9320bc
3e0fadc51f2f
7d06b2e053d2
3df80d9320bc

73c9e02c22e3



3df80d9320bc
543d9cfeec4d












ab1e0a13d702
543d9cfeec4d
ab1e0a13d702
543d9cfeec4d




3ab5aee7fe84
543d9cfeec4d

39d8cda76cfb
3fdadf7d27e3
543d9cfeec4d

3fdadf7d27e3
3df80d9320bc

41135cc836a1
45329e71eeb6


3df80d9320bc

5708e868dc51
543d9cfeec4d

















3fdadf7d27e3
543d9cfeec4d

3fdadf7d27e3
3df80d9320bc






d83d8461f902
3df80d9320bc

2c8c1e7297e1
8231bd270df4
d14a0ebda7d3

334527d3511e
d14a0ebda7d3

8231bd270df4

2c8c1e7297e1
8231bd270df4
334527d3511e
8231bd270df4






3df80d9320bc











72478873571d
8231bd270df4


3df80d9320bc

8231bd270df4

72478873571d

3df80d9320bc






8231bd270df4
3df80d9320bc












7131c6c73656

3df80d9320bc


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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211

                      
                                  










                                                                     

                         
                       




                                
                          





                                      
                             
                     
                           


                 
                 
 
                                                                  
 

                                                                 
 



                                                                     
                                      


                                   
                                       



                                  
                                                            
                                                              

                                                                   
 


                                                                                
                                                                           





                                                                              

 
                                                              
 

                                                                            


                                                                              

 
                                                                        
                                                                  
 
                                                                      
                                                                            
                             



                              
                                            
 

                                                           

                                                                


                       
                                              
                                                     
                                                                      

                         

                                                                



                                             
                                             




                                   
                                                                  



                                        







                                                                       


                                        








                                                                          

                                                             
                                          




                                                                       




                                                               

                                                         


                                                                             

                                                                

                                         


                                      
                                                                    







                                                                     









                                                                      
                                

                                 


                                                                               
                   
                                         

                                                     
                                                                          







                                                         
                                                                    







                                                                 

















                                                     

                                                                           




                                                          
                                        
                          
                     
                              
 





                                                     

                                                
                                                               
 
                      
 
                                                    
 
                                                            


                                   
                          
         



                                                    
 


                                                                           
                                                             
                                                               
                                         


         
                                          
                                                    
                         




                                                              
                                                           



                                                   
                                                                          
 
                                     
                            
                          
                                                       
                                                  
                              
 
                                                          


                                             
                       
 
                                                 
                        
                       
 
                                 

                                                                                
 


                                                   
 

                                          

                                                   
                                                                 

                                                                     
                                                             

                                      
                                                     


                                                    




                       








                                                            


                                                                        
                                                  










                                                                        
                                                                      


                                                                             




                                                      
                                              







                                                                     



                                             
                                                                        
                                                   




                                                     
                                                                      

                                                 
                                                                         
                          
         
          
                                                   
           
                                                         
                                             
                          



                                                                         
                                                         


                          

                                                   
 



                                              


                                                     
                               

                                                                













                                                                   
          

                                       
                                                                      
          

                                                            
           
                                            
                                                        

                                     
                                                 








                                                                   










                                                                       







                                               
                                                                     
                                  


                                                    





                                                             
                                                                           
 
                                                                           







                                                                 
                                                              










                                                                                            
                                                                        








                                   
                          
                                                







                                                             

                                                        


                                                                     
                                
                                 
         


                                                        
                                 






                                                                              
                                                

                                                                       


                                            








                                                            
                              


                                  
                                 














                                                                          
                                                     
 




                                                                              
           
                          




                                                            
                                              
                               

                                                                            


                                           

                                                                   
 



                                                 
                                  



                     
                                                                  

                         
    
                                                              
                                          
                                                    


























                                                                
                               


                             

                                                                              












                                                                
                                                             

                          



                                                                              




                                                                           
                              
                                                                              

                                             


                         























                                                                                
                                          
                                                            
 

                                     




                                                                          
                                

                                                             
                                            






                                                                     
                      
                                                                      

                                     


                 
                                        
        
                            




                                     
                                           

                                  
                        
                    
 
                                         



                                     
                                                                              

                                                              
                                                                    


                                

                           
                                                        







                                                                           
                                                                        

                                                                  
          
                  
                                
           


                                                                       
                                    
         
 
          
                  
                                           


                                                                            




                                                                                
 

                                                          

                                                                             








                                                                                


                                                         
                                                   





                                                           
                                





                                                                            
                                                
         
 
           





                        

 







                                                                   
                                                       
                          











                                          
                                     

                          


                                                                         
                                                        
                                                                       



































                                                                          
                                       

























                                                                                
                 

                                                                             






                                           



                                                               

                                         
                                                             
 
                                                        
 
                                                           

                                   
                             
         

                            
                                   




                                                      
                                              







                                                              
                                           




                                                      


                                                                          

                                                                        









                                        
                             



                              
                                                                    









                                                         
                                                     
                    

                                                    
      




                                    
                                                                    









                                                         
                    

                                                    
      






                                                          

                                                                   
 


                                                            
                                                              
         



                   
                                                 
 
                              
                               

 



                                                             
                                    












                                               
                                         
                                             
                                               




                                                       
                                                 

                                                      
                                            
                    

                                                    
      

  
                                                       


                                                                   

  
                                                

















                                                    
                    

                                                           
      






                                              
                                            

  
                                                       
 

                                        
 

                                                                   

 
                                                        
 
                                                   






                                               











                                                                  
 


                                                   

                   

                     

                                                            






                                        
                                               












                                                                              

                                                


                                                                       
/*
 *	DCCP over IPv6
 *	Linux INET6 implementation
 *
 *	Based on net/dccp6/ipv6.c
 *
 *	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
 *
 *	This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version
 *      2 of the License, or (at your option) any later version.
 */

#include <linux/module.h>
#include <linux/random.h>
#include <linux/slab.h>
#include <linux/xfrm.h>

#include <net/addrconf.h>
#include <net/inet_common.h>
#include <net/inet_hashtables.h>
#include <net/inet_sock.h>
#include <net/inet6_connection_sock.h>
#include <net/inet6_hashtables.h>
#include <net/ip6_route.h>
#include <net/ipv6.h>
#include <net/protocol.h>
#include <net/transp_v6.h>
#include <net/ip6_checksum.h>
#include <net/xfrm.h>
#include <net/secure_seq.h>

#include "dccp.h"
#include "ipv6.h"
#include "feat.h"

/* The per-net dccp.v6_ctl_sk is used for sending RSTs and ACKs */

static const struct inet_connection_sock_af_ops dccp_ipv6_mapped;
static const struct inet_connection_sock_af_ops dccp_ipv6_af_ops;

static void dccp_v6_hash(struct sock *sk)
{
	if (sk->sk_state != DCCP_CLOSED) {
		if (inet_csk(sk)->icsk_af_ops == &dccp_ipv6_mapped) {
			inet_hash(sk);
			return;
		}
		local_bh_disable();
		__inet6_hash(sk, NULL);
		local_bh_enable();
	}
}

/* add pseudo-header to DCCP checksum stored in skb->csum */
static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb,
				      const struct in6_addr *saddr,
				      const struct in6_addr *daddr)
{
	return csum_ipv6_magic(saddr, daddr, skb->len, IPPROTO_DCCP, skb->csum);
}

static inline void dccp_v6_send_check(struct sock *sk, struct sk_buff *skb)
{
	struct ipv6_pinfo *np = inet6_sk(sk);
	struct dccp_hdr *dh = dccp_hdr(skb);

	dccp_csum_outgoing(skb);
	dh->dccph_checksum = dccp_v6_csum_finish(skb, &np->saddr, &np->daddr);
}

static inline __u64 dccp_v6_init_sequence(struct sk_buff *skb)
{
	return secure_dccpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
					     ipv6_hdr(skb)->saddr.s6_addr32,
					     dccp_hdr(skb)->dccph_dport,
					     dccp_hdr(skb)->dccph_sport     );

}

static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
			u8 type, u8 code, int offset, __be32 info)
{
	const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data;
	const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset);
	struct dccp_sock *dp;
	struct ipv6_pinfo *np;
	struct sock *sk;
	int err;
	__u64 seq;
	struct net *net = dev_net(skb->dev);

	if (skb->len < offset + sizeof(*dh) ||
	    skb->len < offset + __dccp_basic_hdr_len(dh)) {
		ICMP6_INC_STATS_BH(net, __in6_dev_get(skb->dev),
				   ICMP6_MIB_INERRORS);
		return;
	}

	sk = inet6_lookup(net, &dccp_hashinfo,
			&hdr->daddr, dh->dccph_dport,
			&hdr->saddr, dh->dccph_sport, inet6_iif(skb));

	if (sk == NULL) {
		ICMP6_INC_STATS_BH(net, __in6_dev_get(skb->dev),
				   ICMP6_MIB_INERRORS);
		return;
	}

	if (sk->sk_state == DCCP_TIME_WAIT) {
		inet_twsk_put(inet_twsk(sk));
		return;
	}

	bh_lock_sock(sk);
	if (sock_owned_by_user(sk))
		NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);

	if (sk->sk_state == DCCP_CLOSED)
		goto out;

	dp = dccp_sk(sk);
	seq = dccp_hdr_seq(dh);
	if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
	    !between48(seq, dp->dccps_awl, dp->dccps_awh)) {
		NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
		goto out;
	}

	np = inet6_sk(sk);

	if (type == ICMPV6_PKT_TOOBIG) {
		struct dst_entry *dst = NULL;

		if (sock_owned_by_user(sk))
			goto out;
		if ((1 << sk->sk_state) & (DCCPF_LISTEN | DCCPF_CLOSED))
			goto out;

		/* icmp should have updated the destination cache entry */
		dst = __sk_dst_check(sk, np->dst_cookie);
		if (dst == NULL) {
			struct inet_sock *inet = inet_sk(sk);
			struct flowi6 fl6;

			/* BUGGG_FUTURE: Again, it is not clear how
			   to handle rthdr case. Ignore this complexity
			   for now.
			 */
			memset(&fl6, 0, sizeof(fl6));
			fl6.flowi6_proto = IPPROTO_DCCP;
			ipv6_addr_copy(&fl6.daddr, &np->daddr);
			ipv6_addr_copy(&fl6.saddr, &np->saddr);
			fl6.flowi6_oif = sk->sk_bound_dev_if;
			fl6.fl6_dport = inet->inet_dport;
			fl6.fl6_sport = inet->inet_sport;
			security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));

			dst = ip6_dst_lookup_flow(sk, &fl6, NULL, false);
			if (IS_ERR(dst)) {
				sk->sk_err_soft = -PTR_ERR(dst);
				goto out;
			}
		} else
			dst_hold(dst);

		if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst)) {
			dccp_sync_mss(sk, dst_mtu(dst));
		} /* else let the usual retransmit timer handle it */
		dst_release(dst);
		goto out;
	}

	icmpv6_err_convert(type, code, &err);

	/* Might be for an request_sock */
	switch (sk->sk_state) {
		struct request_sock *req, **prev;
	case DCCP_LISTEN:
		if (sock_owned_by_user(sk))
			goto out;

		req = inet6_csk_search_req(sk, &prev, dh->dccph_dport,
					   &hdr->daddr, &hdr->saddr,
					   inet6_iif(skb));
		if (req == NULL)
			goto out;

		/*
		 * ICMPs are not backlogged, hence we cannot get an established
		 * socket here.
		 */
		WARN_ON(req->sk != NULL);

		if (seq != dccp_rsk(req)->dreq_iss) {
			NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
			goto out;
		}

		inet_csk_reqsk_queue_drop(sk, req, prev);
		goto out;

	case DCCP_REQUESTING:
	case DCCP_RESPOND:  /* Cannot happen.
			       It can, it SYNs are crossed. --ANK */
		if (!sock_owned_by_user(sk)) {
			DCCP_INC_STATS_BH(DCCP_MIB_ATTEMPTFAILS);
			sk->sk_err = err;
			/*
			 * Wake people up to see the error
			 * (see connect in sock.c)
			 */
			sk->sk_error_report(sk);
			dccp_done(sk);
		} else
			sk->sk_err_soft = err;
		goto out;
	}

	if (!sock_owned_by_user(sk) && np->recverr) {
		sk->sk_err = err;
		sk->sk_error_report(sk);
	} else
		sk->sk_err_soft = err;

out:
	bh_unlock_sock(sk);
	sock_put(sk);
}


static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
				 struct request_values *rv_unused)
{
	struct inet6_request_sock *ireq6 = inet6_rsk(req);
	struct ipv6_pinfo *np = inet6_sk(sk);
	struct sk_buff *skb;
	struct ipv6_txoptions *opt = NULL;
	struct in6_addr *final_p, final;
	struct flowi6 fl6;
	int err = -1;
	struct dst_entry *dst;

	memset(&fl6, 0, sizeof(fl6));
	fl6.flowi6_proto = IPPROTO_DCCP;
	ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
	ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
	fl6.flowlabel = 0;
	fl6.flowi6_oif = ireq6->iif;
	fl6.fl6_dport = inet_rsk(req)->rmt_port;
	fl6.fl6_sport = inet_rsk(req)->loc_port;
	security_req_classify_flow(req, flowi6_to_flowi(&fl6));

	opt = np->opt;

	final_p = fl6_update_dst(&fl6, opt, &final);

	dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
	if (IS_ERR(dst)) {
		err = PTR_ERR(dst);
		dst = NULL;
		goto done;
	}

	skb = dccp_make_response(sk, dst, req);
	if (skb != NULL) {
		struct dccp_hdr *dh = dccp_hdr(skb);

		dh->dccph_checksum = dccp_v6_csum_finish(skb,
							 &ireq6->loc_addr,
							 &ireq6->rmt_addr);
		ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
		err = ip6_xmit(sk, skb, &fl6, opt, np->tclass);
		err = net_xmit_eval(err);
	}

done:
	if (opt != NULL && opt != np->opt)
		sock_kfree_s(sk, opt, opt->tot_len);
	dst_release(dst);
	return err;
}

static void dccp_v6_reqsk_destructor(struct request_sock *req)
{
	dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg);
	if (inet6_rsk(req)->pktopts != NULL)
		kfree_skb(inet6_rsk(req)->pktopts);
}

static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
{
	const struct ipv6hdr *rxip6h;
	struct sk_buff *skb;
	struct flowi6 fl6;
	struct net *net = dev_net(skb_dst(rxskb)->dev);
	struct sock *ctl_sk = net->dccp.v6_ctl_sk;
	struct dst_entry *dst;

	if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET)
		return;

	if (!ipv6_unicast_destination(rxskb))
		return;

	skb = dccp_ctl_make_reset(ctl_sk, rxskb);
	if (skb == NULL)
		return;

	rxip6h = ipv6_hdr(rxskb);
	dccp_hdr(skb)->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr,
							    &rxip6h->daddr);

	memset(&fl6, 0, sizeof(fl6));
	ipv6_addr_copy(&fl6.daddr, &rxip6h->saddr);
	ipv6_addr_copy(&fl6.saddr, &rxip6h->daddr);

	fl6.flowi6_proto = IPPROTO_DCCP;
	fl6.flowi6_oif = inet6_iif(rxskb);
	fl6.fl6_dport = dccp_hdr(skb)->dccph_dport;
	fl6.fl6_sport = dccp_hdr(skb)->dccph_sport;
	security_skb_classify_flow(rxskb, flowi6_to_flowi(&fl6));

	/* sk = NULL, but it is safe for now. RST socket required. */
	dst = ip6_dst_lookup_flow(ctl_sk, &fl6, NULL, false);
	if (!IS_ERR(dst)) {
		skb_dst_set(skb, dst);
		ip6_xmit(ctl_sk, skb, &fl6, NULL, 0);
		DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS);
		DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS);
		return;
	}

	kfree_skb(skb);
}

static struct request_sock_ops dccp6_request_sock_ops = {
	.family		= AF_INET6,
	.obj_size	= sizeof(struct dccp6_request_sock),
	.rtx_syn_ack	= dccp_v6_send_response,
	.send_ack	= dccp_reqsk_send_ack,
	.destructor	= dccp_v6_reqsk_destructor,
	.send_reset	= dccp_v6_ctl_send_reset,
};

static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
{
	const struct dccp_hdr *dh = dccp_hdr(skb);
	const struct ipv6hdr *iph = ipv6_hdr(skb);
	struct sock *nsk;
	struct request_sock **prev;
	/* Find possible connection requests. */
	struct request_sock *req = inet6_csk_search_req(sk, &prev,
							dh->dccph_sport,
							&iph->saddr,
							&iph->daddr,
							inet6_iif(skb));
	if (req != NULL)
		return dccp_check_req(sk, skb, req, prev);

	nsk = __inet6_lookup_established(sock_net(sk), &dccp_hashinfo,
					 &iph->saddr, dh->dccph_sport,
					 &iph->daddr, ntohs(dh->dccph_dport),
					 inet6_iif(skb));
	if (nsk != NULL) {
		if (nsk->sk_state != DCCP_TIME_WAIT) {
			bh_lock_sock(nsk);
			return nsk;
		}
		inet_twsk_put(inet_twsk(nsk));
		return NULL;
	}

	return sk;
}

static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
{
	struct request_sock *req;
	struct dccp_request_sock *dreq;
	struct inet6_request_sock *ireq6;
	struct ipv6_pinfo *np = inet6_sk(sk);
	const __be32 service = dccp_hdr_request(skb)->dccph_req_service;
	struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);

	if (skb->protocol == htons(ETH_P_IP))
		return dccp_v4_conn_request(sk, skb);

	if (!ipv6_unicast_destination(skb))
		return 0;	/* discard, don't send a reset here */

	if (dccp_bad_service_code(sk, service)) {
		dcb->dccpd_reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE;
		goto drop;
	}
	/*
	 * There are no SYN attacks on IPv6, yet...
	 */
	dcb->dccpd_reset_code = DCCP_RESET_CODE_TOO_BUSY;
	if (inet_csk_reqsk_queue_is_full(sk))
		goto drop;

	if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1)
		goto drop;

	req = inet6_reqsk_alloc(&dccp6_request_sock_ops);
	if (req == NULL)
		goto drop;

	if (dccp_reqsk_init(req, dccp_sk(sk), skb))
		goto drop_and_free;

	dreq = dccp_rsk(req);
	if (dccp_parse_options(sk, dreq, skb))
		goto drop_and_free;

	if (security_inet_conn_request(sk, skb, req))
		goto drop_and_free;

	ireq6 = inet6_rsk(req);
	ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr);
	ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr);

	if (ipv6_opt_accepted(sk, skb) ||
	    np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
	    np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {
		atomic_inc(&skb->users);
		ireq6->pktopts = skb;
	}
	ireq6->iif = sk->sk_bound_dev_if;

	/* So that link locals have meaning */
	if (!sk->sk_bound_dev_if &&
	    ipv6_addr_type(&ireq6->rmt_addr) & IPV6_ADDR_LINKLOCAL)
		ireq6->iif = inet6_iif(skb);

	/*
	 * Step 3: Process LISTEN state
	 *
	 *   Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie
	 *
	 *   In fact we defer setting S.GSR, S.SWL, S.SWH to
	 *   dccp_create_openreq_child.
	 */
	dreq->dreq_isr	   = dcb->dccpd_seq;
	dreq->dreq_iss	   = dccp_v6_init_sequence(skb);
	dreq->dreq_service = service;

	if (dccp_v6_send_response(sk, req, NULL))
		goto drop_and_free;

	inet6_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT);
	return 0;

drop_and_free:
	reqsk_free(req);
drop:
	DCCP_INC_STATS_BH(DCCP_MIB_ATTEMPTFAILS);
	return -1;
}

static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
					      struct sk_buff *skb,
					      struct request_sock *req,
					      struct dst_entry *dst)
{
	struct inet6_request_sock *ireq6 = inet6_rsk(req);
	struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
	struct inet_sock *newinet;
	struct dccp6_sock *newdp6;
	struct sock *newsk;
	struct ipv6_txoptions *opt;

	if (skb->protocol == htons(ETH_P_IP)) {
		/*
		 *	v6 mapped
		 */
		newsk = dccp_v4_request_recv_sock(sk, skb, req, dst);
		if (newsk == NULL)
			return NULL;

		newdp6 = (struct dccp6_sock *)newsk;
		newinet = inet_sk(newsk);
		newinet->pinet6 = &newdp6->inet6;
		newnp = inet6_sk(newsk);

		memcpy(newnp, np, sizeof(struct ipv6_pinfo));

		ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr);

		ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr);

		ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr);

		inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped;
		newsk->sk_backlog_rcv = dccp_v4_do_rcv;
		newnp->pktoptions  = NULL;
		newnp->opt	   = NULL;
		newnp->mcast_oif   = inet6_iif(skb);
		newnp->mcast_hops  = ipv6_hdr(skb)->hop_limit;

		/*
		 * No need to charge this sock to the relevant IPv6 refcnt debug socks count
		 * here, dccp_create_openreq_child now does this for us, see the comment in
		 * that function for the gory details. -acme
		 */

		/* It is tricky place. Until this moment IPv4 tcp
		   worked with IPv6 icsk.icsk_af_ops.
		   Sync it now.
		 */
		dccp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie);

		return newsk;
	}

	opt = np->opt;

	if (sk_acceptq_is_full(sk))
		goto out_overflow;

	if (dst == NULL) {
		struct in6_addr *final_p, final;
		struct flowi6 fl6;

		memset(&fl6, 0, sizeof(fl6));
		fl6.flowi6_proto = IPPROTO_DCCP;
		ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr);
		final_p = fl6_update_dst(&fl6, opt, &final);
		ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr);
		fl6.flowi6_oif = sk->sk_bound_dev_if;
		fl6.fl6_dport = inet_rsk(req)->rmt_port;
		fl6.fl6_sport = inet_rsk(req)->loc_port;
		security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));

		dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
		if (IS_ERR(dst))
			goto out;
	}

	newsk = dccp_create_openreq_child(sk, req, skb);
	if (newsk == NULL)
		goto out_nonewsk;

	/*
	 * No need to charge this sock to the relevant IPv6 refcnt debug socks
	 * count here, dccp_create_openreq_child now does this for us, see the
	 * comment in that function for the gory details. -acme
	 */

	__ip6_dst_store(newsk, dst, NULL, NULL);
	newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM |