aboutsummaryrefslogtreecommitdiffstats
path: root/po/nl.po
blob: 247f7f1b5ea24ca85ed4d1fa1d23f19794a13c22 (plain)
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
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
# Dutch translation of initscripts.
# Copyright (C) 2003-2009 The Free Software Foundation, Inc.
#
# Gregory Petit <thunderbirds@pandora.be>, 2003.
# Tino Meinen <a.t.meinen@chello.nl>, 2003, 2004.
# Peter van Egdom <p.van.egdom@gmail.com>, 2003-2009.
# -------------------------------------------------
# 'Netwerking' of 'Networking'?
#
msgid ""
msgstr ""
"Project-Id-Version: initscripts\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: (null)\n"
"PO-Revision-Date: 2009-03-20 22:20+0100\n"
"Last-Translator: Peter van Egdom <p.van.egdom@gmail.com>\n"
"Language-Team: Dutch <fedora-trans-list@redhat.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: /etc/rc.d/init.d/openais:30
msgid "Stopping OpenAIS ($prog): "
msgstr "Stoppen van OpenAIS ($prog): "

#: /etc/rc.d/init.d/ez-ipupdate:76
msgid "Reloading $prog for $ez_name: "
msgstr "Herladen van $prog voor $ez_name: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:283
msgid "Forwarding control parameter isn't valid '$fw_control' (arg 1)"
msgstr "Forwarding controle parameter is niet geldig '$fw_control' (arg 1)"

#: /etc/rc.d/init.d/incrond:29
msgid "Stopping incrond: "
msgstr "Stoppen van incrond: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1428
msgid "No parameters given to setup a default route"
msgstr "Geen parameters opgegeven om een default route in te stellen"

#: /etc/rc.d/init.d/dhcpd:141 /etc/rc.d/init.d/dhcrelay:119
msgid "Usage: $0 {start|stop|restart|condrestart|configtest|status}"
msgstr "Gebruik: $0 {start|stop|restart|condrestart|configtest|status}"

#: /etc/rc.d/init.d/ups:59
msgid "Starting UPS monitor (slave): "
msgstr "Starten van UPS-monitor (slave): "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:119
msgid "CRITICAL "
msgstr "KRITIEK "

#: /etc/rc.d/init.d/lirc:83
msgid "Stopping infrared remote control mouse daemon ($prog2): "
msgstr "Stoppen van infrared remote control mouse daemon ($prog2): "

#: /etc/rc.d/init.d/cyrus-imapd:116
msgid "$BASENAME exporting databases"
msgstr "$BASENAME exporteert databases"

#: /etc/ppp/ip-up.ipv6to4:123 /etc/sysconfig/network-scripts/ifup-ipv6:233
msgid ""
"Warning: configured MTU '$IPV6TO4_MTU' for 6to4 exceeds maximum limit of "
"'$tunnelmtu', ignored"
msgstr ""
"Waarschuwing: MTU '$IPV6TO4_MTU' geconfigureerd voor 6to4, overschrijdt de "
"limiet van '$tunnelmty'; genegeerd"

#: /etc/rc.d/init.d/tclhttpd:51
msgid "$base dead but pid file exists"
msgstr "$base afgesloten, maar pid-bestand bestaat"

#: /etc/sysconfig/network-scripts/ifup:90
msgid "Could not set 802.1Q VLAN parameters."
msgstr "Niet in staat om de 802.1Q VLAN parameters in te stellen."

#: /etc/sysconfig/network-scripts/ifup:100
#: /etc/sysconfig/network-scripts/ifup-eth:72
#: /etc/sysconfig/network-scripts/ifup-ib:52
msgid ""
"$alias device ${DEVICE} does not seem to be present, delaying initialization."
msgstr ""
"$alias netwerkkaart ${DEVICE} is blijkbaar niet aanwezig, initialisatie "
"uitgesteld."

#: /etc/rc.d/init.d/amd:97 /etc/rc.d/init.d/bgpd:64 /etc/rc.d/init.d/btseed:70
#: /etc/rc.d/init.d/bttrack:71 /etc/rc.d/init.d/dropbear:122
#: /etc/rc.d/init.d/irda:71 /etc/rc.d/init.d/mldonkey:71
#: /etc/rc.d/init.d/mon:78 /etc/rc.d/init.d/monit:81
#: /etc/rc.d/init.d/partimaged:88 /etc/rc.d/init.d/ripd:63
#: /etc/rc.d/init.d/ripngd:63 /etc/rc.d/init.d/tcsd:136
#: /etc/rc.d/init.d/vblade:91 /etc/rc.d/init.d/zebra:63
msgid "Usage: $0 {start|stop|restart|reload|condrestart|status}"
msgstr "Gebruik: $0 {start|stop|restart|reload|condrestart|status}"

#: /etc/rc.d/init.d/pcscd:55
msgid "Stopping PC/SC smart card daemon ($prog): "
msgstr "Stoppen van PC/SC smart card daemon ($prog): "

#: /etc/rc.d/init.d/gpm:47
msgid "Starting console mouse services: "
msgstr "Starten van console-muis services: "

#: /etc/rc.d/init.d/rdisc:46
msgid "Shutting down router discovery services: "
msgstr "Stoppen van router discovery services: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:956
msgid "Missing parameter 'global IPv4 address' (arg 2)"
msgstr "Parameter 'global IPv4-address' (arg 2) ontbreekt"

#: /etc/rc.d/init.d/crossfire:33 /etc/rc.d/init.d/liquidwar-server:34
#: /etc/rc.d/init.d/wesnothd:45 /etc/rc.d/init.d/xpilot-ng-server:33
msgid "$prog already running"
msgstr "$prog reeds gestart"

#: /etc/rc.d/init.d/ser2net:41
msgid "Reloading ser2net"
msgstr "Herladen van ser2net"

#: /etc/rc.d/init.d/dictd:39
msgid "no dictionaries installed"
msgstr "geen woordenboeken geïnstalleerd"

#: /etc/sysconfig/network-scripts/ifup-ppp:77
msgid "/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist"
msgstr "/etc/sysconfig/network-scripts/chat-${DEVNAME} bestaat niet"

#: /etc/rc.d/init.d/monotone:73
msgid "to"
msgstr ""

#: /etc/rc.d/init.d/iptables:277
msgid "${IPTABLES}: Firewall is not running."
msgstr "${IPTABLES}: Firewall is niet gestart."

#: /etc/rc.d/init.d/iptables:291
msgid "${IPTABLES}: Firewall is not configured. "
msgstr "${IPTABLES}: Firewall is niet geconfigureerd. "

#: /etc/rc.d/init.d/util-vserver:60
msgid "Setting path to vshelper"
msgstr "Instellen van pad naar vshelper"

#: /etc/rc.d/init.d/netfs:114
msgid "Unmounting CIFS filesystems: "
msgstr "Afkoppelen van CIFS-bestandssystemen: "

#: /etc/rc.d/init.d/functions:337
msgid "Usage: pidfileofproc {program}"
msgstr "Gebruik: pidfileofproc {programma}"

#: /etc/rc.d/init.d/vncserver:64
msgid "vncserver start"
msgstr "vncserver start"

#: /etc/rc.d/init.d/netconsole:76
msgid "Server address not specified in /etc/sysconfig/netconsole"
msgstr "Server-adres niet opgegeven in /etc/sysconfig/netconsole"

#: /etc/rc.d/init.d/atop:74 /etc/rc.d/init.d/audio-entropyd:52
#: /etc/rc.d/init.d/krb5kdc:75 /etc/rc.d/init.d/newscache:80
#: /etc/rc.d/init.d/squidGuard:171
msgid "Usage: $0 {start|stop|status|reload|restart|condrestart}"
msgstr "Gebruik: $0 {start|stop|status|reload|restart|condrestart}"

#: /etc/rc.d/init.d/rpcsvcgssd:40
msgid "Starting RPC svcgssd: "
msgstr "Starten van RPC-svcgssd: "

#: /etc/rc.d/init.d/systemtap:597
msgid "$s compilation failed "
msgstr ""

#: /etc/rc.d/init.d/ajaxterm:27 /etc/rc.d/init.d/amd:36
#: /etc/rc.d/init.d/aprsd:32 /etc/rc.d/init.d/arpwatch:38
#: /etc/rc.d/init.d/atd:36 /etc/rc.d/init.d/atop:19 /etc/rc.d/init.d/auditd:53
#: /etc/rc.d/init.d/auth2:26 /etc/rc.d/init.d/autofs:79
#: /etc/rc.d/init.d/autogroup:39 /etc/rc.d/init.d/autohome:39
#: /etc/rc.d/init.d/beanstalkd:33 /etc/rc.d/init.d/boa:36
#: /etc/rc.d/init.d/bootparamd:38 /etc/rc.d/init.d/bro:86
#: /etc/rc.d/init.d/canna:37 /etc/rc.d/init.d/cfexecd:22
#: /etc/rc.d/init.d/cfservd:26 /etc/rc.d/init.d/chronyd:84
#: /etc/rc.d/init.d/clamav-milter:23 /etc/rc.d/init.d/clamd-wrapper:43
#: /etc/rc.d/init.d/coda-client:25 /etc/rc.d/init.d/codasrv:21
#: /etc/rc.d/init.d/collectd:25 /etc/rc.d/init.d/collectl:32
#: /etc/rc.d/init.d/couchdb:37 /etc/rc.d/init.d/cpuspeed:74
#: /etc/rc.d/init.d/crond:46 /etc/rc.d/init.d/ctrlproxy:41
#: /etc/rc.d/init.d/cups:53 /etc/rc.d/init.d/cwdaemon:32
#: /etc/rc.d/init.d/dbmail-imapd:36 /etc/rc.d/init.d/dbmail-lmtpd:37
#: /etc/rc.d/init.d/dbmail-pop3d:37 /etc/rc.d/init.d/dbmail-timsieved:38
#: /etc/rc.d/init.d/dc_client:33 /etc/rc.d/init.d/dc_server:29
#: /etc/rc.d/init.d/ddclient:28 /etc/rc.d/init.d/dhcp6r:44
#: /etc/rc.d/init.d/dhcp6s:56 /etc/rc.d/init.d/dhcpd:81
#: /etc/rc.d/init.d/dhcp-fwd:40 /etc/rc.d/init.d/dhcrelay:54
#: /etc/rc.d/init.d/dictd:34 /etc/rc.d/init.d/distccd:42
#: /etc/rc.d/init.d/dovecot:46 /etc/rc.d/init.d/dropbear:69
#: /etc/rc.d/init.d/fcron_watch_config:32 /etc/rc.d/init.d/flow-capture:42
#: /etc/rc.d/init.d/fnfxd:26 /etc/rc.d/init.d/fyre-cluster:31
#: /etc/rc.d/init.d/glusterfsd:27 /etc/rc.d/init.d/gmediaserver:59
#: /etc/rc.d/init.d/haproxy:40 /etc/rc.d/init.d/honeyd:38
#: /etc/rc.d/init.d/httpd:54 /etc/rc.d/init.d/ibmasm:19
#: /etc/rc.d/init.d/inadyn:42 /etc/rc.d/init.d/ip-sentinel:27
#: /etc/rc.d/init.d/ircd:33 /etc/rc.d/init.d/irda:23
#: /etc/rc.d/init.d/irqbalance:46 /etc/rc.d/init.d/iscsi:50
#: /etc/rc.d/init.d/iscsid:37 /etc/rc.d/init.d/jetty:59
#: /etc/rc.d/init.d/kadmin:43 /etc/rc.d/init.d/keepalived:31
#: /etc/rc.d/init.d/kojid:32 /etc/rc.d/init.d/kojira:32
#: /etc/rc.d/init.d/kprop:26 /etc/rc.d/init.d/krb524:37
#: /etc/rc.d/init.d/krb5kdc:29 /etc/rc.d/init.d/LCDd:42
#: /etc/rc.d/init.d/lcdproc:42 /etc/rc.d/init.d/ldap:180
#: /etc/rc.d/init.d/lighttpd:41 /etc/rc.d/init.d/mailgraph:39
#: /etc/rc.d/init.d/mailman:86 /etc/rc.d/init.d/mcstrans:44
#: /etc/rc.d/init.d/mdmonitor:50 /etc/rc.d/init.d/memcached:37
#: /etc/rc.d/init.d/milter-greylist:25 /etc/rc.d/init.d/milter-regex:30
#: /etc/rc.d/init.d/monit:29 /etc/rc.d/init.d/mydns:24
#: /etc/rc.d/init.d/mysqld:78 /etc/rc.d/init.d/mysqld:81
#: /etc/rc.d/init.d/mysqld:84 /etc/rc.d/init.d/ndbd:53
#: /etc/rc.d/init.d/ndbd:55 /etc/rc.d/init.d/ndb_mgmd:58
#: /etc/rc.d/init.d/ndb_mgmd:60 /etc/rc.d/init.d/nessusd:38
#: /etc/rc.d/init.d/nginx:34 /etc/rc.d/init.d/ngircd:25
#: /etc/rc.d/init.d/npcd:34 /etc/rc.d/init.d/nscd:41 /etc/rc.d/init.d/ntop:33
#: /etc/rc.d/init.d/ntpd:44 /etc/rc.d/init.d/nuauth:64
#: /etc/rc.d/init.d/nufw:62 /etc/rc.d/init.d/nxtvepgd:34
#: /etc/rc.d/init.d/oddjobd:35 /etc/rc.d/init.d/oidentd:31
#: /etc/rc.d/init.d/openhpid:100 /etc/rc.d/init.d/openhpid:105
#: /etc/rc.d/init.d/openhpid:110 /etc/rc.d/init.d/openhpid:120
#: /etc/rc.d/init.d/openser:22 /etc/rc.d/init.d/pads:35
#: /etc/rc.d/init.d/pads:39 /etc/rc.d/init.d/plague-builder:32
#: /etc/rc.d/init.d/plague-server:33 /etc/rc.d/init.d/poker-bot:34
#: /etc/rc.d/init.d/poker-server:34 /etc/rc.d/init.d/portreserve:48
#: /etc/rc.d/init.d/postgrey:34 /etc/rc.d/init.d/prelude-correlator:32
#: /etc/rc.d/init.d/prelude-correlator:36 /etc/rc.d/init.d/prelude-manager:17
#: /etc/rc.d/init.d/prelude-manager:21 /etc/rc.d/init.d/proftpd:46
#: /etc/rc.d/init.d/psad:50 /etc/rc.d/init.d/pure-ftpd:32
#: /etc/rc.d/init.d/racoon:21 /etc/rc.d/init.d/radvd:46
#: /etc/rc.d/init.d/rarpd:42 /etc/rc.d/init.d/ratbox-services:25
#: /etc/rc.d/init.d/rbldnsd:84 /etc/rc.d/init.d/rinetd:25
#: /etc/rc.d/init.d/ris-linuxd:44 /etc/rc.d/init.d/roundup:27
#: /etc/rc.d/init.d/rpcbind:45 /etc/rc.d/init.d/rtpproxy:21
#: /etc/rc.d/init.d/rwalld:39 /etc/rc.d/init.d/saslauthd:40
#: /etc/rc.d/init.d/scanbuttond:32 /etc/rc.d/init.d/sendmail:60
#: /etc/rc.d/init.d/sensord:22 /etc/rc.d/init.d/ser:36
#: /etc/rc.d/init.d/sge_execd:53 /etc/rc.d/init.d/sip-redirect:31
#: /etc/rc.d/init.d/smartd:52 /etc/rc.d/init.d/smsd:21
#: /etc/rc.d/init.d/snmpd:40 /etc/rc.d/init.d/snmptrapd:42
#: /etc/rc.d/init.d/spamassassin:41 /etc/rc.d/init.d/spampd:29
#: /etc/rc.d/init.d/squid:65 /etc/rc.d/init.d/squid:77
#: /etc/rc.d/init.d/squidGuard:71 /etc/rc.d/init.d/ssbd:30
#: /etc/rc.d/init.d/sshd:127 /etc/rc.d/init.d/syslog-ng:35
#: /etc/rc.d/init.d/systemtap:478 /etc/rc.d/init.d/tclhttpd:143
#: /etc/rc.d/init.d/tcsd:90 /etc/rc.d/init.d/thebridge:28
#: /etc/rc.d/init.d/thttpd:30 /etc/rc.d/init.d/tinyerp-server:47
#: /etc/rc.d/init.d/tinyproxy:36 /etc/rc.d/init.d/tor:31
#: /etc/rc.d/init.d/trytond:48 /etc/rc.d/init.d/tuned:34
#: /etc/rc.d/init.d/ulogd:34 /etc/rc.d/init.d/update:28
#: /etc/rc.d/init.d/update:36 /etc/rc.d/init.d/upnpd:35
#: /etc/rc.d/init.d/ups:45 /etc/rc.d/init.d/ushare:28
#: /etc/rc.d/init.d/vdradmind:27 /etc/rc.d/init.d/vncserver:36
#: /etc/rc.d/init.d/vtund:36 /etc/rc.d/init.d/wdaemon:41
#: /etc/rc.d/init.d/xfs:57 /etc/rc.d/init.d/xinetd:56
#: /etc/rc.d/init.d/zfs-fuse:58 /etc/rc.d/init.d/zoneminder:47
msgid "Starting $prog: "
msgstr "Starten van $prog: "

#: /etc/rc.d/init.d/ypbind:66 /etc/rc.d/init.d/ypbind:71
msgid "domain is '$NISDOMAIN' "
msgstr "domein is '$NISDOMAIN' "

#: /etc/rc.d/init.d/cgred:67
#, fuzzy
msgid "Starting CGroup Rules Engine Daemon..."
msgstr "Starten van auto nice daemon:"

#: /etc/rc.d/init.d/shorewall:36 /etc/rc.d/init.d/shorewall6:36
#: /etc/rc.d/init.d/shorewall6-lite:36 /etc/rc.d/init.d/shorewall-lite:36
msgid "Starting Shorewall: "
msgstr "Starten van Shorewall: "

#: /etc/rc.d/init.d/kadmin:38
msgid "Error. This appears to be a slave server, found kpropd.acl"
msgstr ""
"Fout. Dit lijkt een slave-server te zijn, bestand kpropd.acl is gevonden"

#: /etc/rc.d/init.d/ebtables:87
msgid "Saving $desc ($prog): "
msgstr "Opslaan van $desc ($prog): "

#: /etc/sysconfig/network-scripts/ifup-sit:63
msgid "Missing remote IPv4 address of tunnel, configuration is not valid"
msgstr "Remote IPv4-adres van tunnel ontbreekt, configuratie is niet geldig"

#: /etc/rc.d/init.d/systemtap:514
msgid "$prog startup"
msgstr "$prog start op"

#: /etc/rc.d/init.d/preload:57
msgid "Starting preload daemon: "
msgstr "Starten van preload daemon: "

#: /etc/rc.d/init.d/condor:49
msgid "Stopping Condor daemons: "
msgstr "Stoppen van Condor daemons: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1517
msgid "Unsupported mechanism '$mechanism' for sending trigger to radvd"
msgstr ""
"Niet-ondersteund mechanisme '$mechanism' voor het verzenden van de 'trigger' "
"naar radvd"

#: /etc/ppp/ip-up.ipv6to4:189 /etc/sysconfig/network-scripts/ifup-ipv6:299
msgid "radvd control enabled, but config is not complete"
msgstr "radvd controle aangezet, maar de configuratie is niet volledig"

#: /etc/rc.d/init.d/named:173
msgid "Reloading "
msgstr "Herladen "

#: /etc/rc.d/init.d/messagebus:48
msgid "Stopping system message bus: "
msgstr "Stoppen van system message bus: "

#: /etc/rc.d/init.d/cfenvd:27
msgid "Starting GNU cfengine environmental history daemon: "
msgstr "Starten van GNU cfengine environmental history daemon: "

#: /etc/rc.d/init.d/privoxy:129
msgid "Usage: $PRIVOXY_PRG {start|stop|reload|restart|condrestart|status|top}"
msgstr ""
"Gebruik: $PRIVOXY_PRG {start|stop|reload|restart|condrestart|status|top}"

#: /etc/rc.d/init.d/nsca:55
msgid "Reloading nsca: "
msgstr "Herladen van nsca: "

#: /etc/rc.d/init.d/yum-cron:29
msgid "Disabling nightly yum update: "
msgstr "Uitzetten van nachtelijke yum update: "

#: /etc/rc.d/init.d/arptables_jf:192
msgid "Usage: $0 {start|stop|restart|condrestart|status|panic|save}"
msgstr "Gebruik: $0 {start|stop|restart|condrestart|status|panic|save}"

#: /etc/rc.d/init.d/ups:68
msgid "Stopping UPS monitor: "
msgstr "Stoppen van UPS-monitor: "

#: /etc/rc.d/init.d/smokeping:71
msgid ""
"Usage: $0 {start|stop|status|restart|force-reload|reload|condrestart|try-"
"restart}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|force-reload|reload|condrestart|try-"
"restart}"

#: /etc/rc.d/rc.sysinit:83
msgid "*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required."
msgstr ""
"*** Waarschuwing -- SELinux ${SELINUXTYPE} policy relabel-actie is vereist."

#: /etc/rc.d/init.d/arptables_jf:117
msgid "Removing user defined chains:"
msgstr "Verwijderen van door de gebruiker gedefinieerde regels:"

#: /etc/rc.d/init.d/sec:34
msgid "Starting $prog instance "
msgstr "Starten van $prog instantie "

#: /etc/rc.d/init.d/yum-cron:60
msgid "Nightly yum update is disabled."
msgstr "Nachtelijke yum update is uitgezet."

#: /etc/sysconfig/network-scripts/ifup-sl:47
msgid "/etc/sysconfig/network-scripts/dip-$DEVICE does not exist for $DEVICE"
msgstr "/etc/sysconfig/network-scripts/dip-$DEVICE bestaat niet voor $DEVICE"

#: /etc/rc.d/init.d/rwhod:52
msgid "Stopping rwho services: "
msgstr "Stoppen van rwho services: "

#: /etc/rc.d/init.d/ypbind:131
msgid "Shutting down NIS service: "
msgstr "Stoppen van NIS-service: "

#: /etc/rc.d/init.d/vncserver:22
msgid "VNC server"
msgstr "VNC server"

#: /etc/rc.d/init.d/arptables_jf:65
msgid "Flushing all current rules and user defined chains:"
msgstr "Wissen van alle huidige en door de gebruiker gedefinieerde regels:"

#: /etc/rc.d/init.d/bwbar:67 /etc/rc.d/init.d/fail2ban:87
#: /etc/rc.d/init.d/netplugd:56
msgid "Usage: $0 {start|stop|status|restart}"
msgstr "Gebruik: $0 {start|stop|status|restart}"

#: /etc/rc.d/init.d/wine:47
msgid "Wine binary format handlers are registered."
msgstr "Wine binair formaat verwerkers zijn geregistreerd."

#: /etc/rc.d/init.d/icecast:45
msgid "Reloading icecast: "
msgstr "Herladen van icecast: "

#: /etc/rc.d/init.d/openvpn:179
msgid "Shutting down openvpn: "
msgstr "Stoppen van openvpn: "

#: /etc/rc.d/init.d/puppetmaster:126
msgid ""
"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|"
"genconfig}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|reload|force-reload|condrestart|"
"genconfig}"

#: /etc/rc.d/rc.sysinit:258
msgid "\t\tWelcome to "
msgstr "\t\tWelkom bij "

#: /etc/rc.d/init.d/mon:35 /etc/rc.d/init.d/partimaged:45
msgid "Shutting down $desc ($prog): "
msgstr "Stoppen van $desc ($prog): "

#: /etc/rc.d/init.d/rsyslog:45 /etc/rc.d/init.d/sysklogd:54
msgid "Shutting down system logger: "
msgstr "Stoppen van systeemlogger: "

#: /etc/rc.d/init.d/maradns:75
#, fuzzy
msgid "Starting all MaraDNS processes: "
msgstr "Starten van NFS-services: "

#: /etc/rc.d/init.d/smartd:119
msgid ""
"Usage: $0 {start|stop|reload|force-reload|report|restart|try-restart|status}"
msgstr ""
"Gebruik: $0 {start|stop|reload|force-reload|report|restart|try-restart|"
"status}"

#: /etc/rc.d/init.d/avahi-daemon:102 /etc/rc.d/init.d/avahi-dnsconfd:99
#: /etc/rc.d/init.d/haldaemon:71 /etc/rc.d/init.d/ibmasm:95
#: /etc/rc.d/init.d/innd:131 /etc/rc.d/init.d/ipa_kpasswd:79
#: /etc/rc.d/init.d/ipa_webgui:75 /etc/rc.d/init.d/kprop:63
#: /etc/rc.d/init.d/krb524:73 /etc/rc.d/init.d/milter-greylist:83
#: /etc/rc.d/init.d/nasd:83 /etc/rc.d/init.d/netconsole:36
#: /etc/rc.d/init.d/NetworkManager:101 /etc/rc.d/init.d/ohmd:86
#: /etc/rc.d/init.d/sqlgrey:65 /etc/rc.d/init.d/sysklogd:118
#: /etc/rc.d/init.d/tinyerp-server:122 /etc/rc.d/init.d/xenner:163
#: /etc/rc.d/init.d/zvbid:62
msgid "Usage: $0 {start|stop|status|restart|condrestart}"
msgstr "Gebruik: $0 {start|stop|status|restart|condrestart}"

#: /etc/rc.d/init.d/ohmd:48
#, fuzzy
msgid "Stopping Open Hardware Manager: "
msgstr "Stoppen van xend daemon: "

#: /etc/rc.d/init.d/ldap:143 /etc/rc.d/init.d/ldap:149
msgid "Checking configuration files for $prog: "
msgstr "Controleren van configuratiebestanden voor $prog: "

#: /etc/rc.d/init.d/halt:55
msgid "$0: call me as 'halt' or 'reboot' please!"
msgstr "$0: roep me op als 'halt' of 'reboot' aub!"

#: /etc/rc.d/init.d/ypbind:64
msgid "Setting NIS domain: "
msgstr "Instellen van NIS-domein: "

#: /etc/rc.d/init.d/isdn:252
msgid "$NAME is attached to $DEVICE"
msgstr "$NAME is gekoppeld aan $DEVICE"

#: /etc/rc.d/init.d/ypbind:195
msgid ""
"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|"
"status}"
msgstr ""
"Gebruik: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|"
"status}"

#: /etc/rc.d/init.d/corosync:20
#, fuzzy
msgid "Starting Corosync Cluster Engine ($prog): "
msgstr "Starten van $desc ($prog): "

#: /etc/rc.d/init.d/systemtap:64
msgid "\t-r kernelrelease: specify kernel release version"
msgstr ""

#: /etc/rc.d/init.d/aprsd:45 /etc/rc.d/init.d/cwdaemon:42
#: /etc/rc.d/init.d/dhcp6r:53 /etc/rc.d/init.d/dhcp6s:65
#: /etc/rc.d/init.d/dhcpd:96 /etc/rc.d/init.d/dhcrelay:69
#: /etc/rc.d/init.d/dictd:55 /etc/rc.d/init.d/fnfxd:37
#: /etc/rc.d/init.d/inadyn:51 /etc/rc.d/init.d/irda:34
#: /etc/rc.d/init.d/LCDd:50 /etc/rc.d/init.d/lcdproc:50
#: /etc/rc.d/init.d/mailman:100 /etc/rc.d/init.d/monit:38
#: /etc/rc.d/init.d/ntpd:53 /etc/rc.d/init.d/oddjobd:54
#: /etc/rc.d/init.d/proftpd:54 /etc/rc.d/init.d/sendmail:111
#: /etc/rc.d/init.d/smartd:62 /etc/rc.d/init.d/ssbd:40
#: /etc/rc.d/init.d/thebridge:38 /etc/rc.d/init.d/vblade:51
#: /etc/rc.d/init.d/vncserver:72 /etc/rc.d/init.d/vsftpd:57
#: /etc/rc.d/init.d/xfs:76
msgid "Shutting down $prog: "
msgstr "Stoppen van $prog: "

#: /etc/rc.d/init.d/acpid:79
msgid "Reloading acpi daemon:"
msgstr "Herladen van acpi-daemon:"

#: /etc/rc.d/init.d/cyrus-imapd:87
msgid "$BASENAME importing databases"
msgstr "$BASENAME importeert databases"

#: /etc/rc.d/init.d/greylistd:20
msgid "Starting greylistd: "
msgstr "Starten van greylistd: "

#: /etc/rc.d/init.d/NetworkManager:68
msgid "Stopping NetworkManager daemon: "
msgstr "Stoppen van NetworkManager daemon: "

#: /etc/rc.d/init.d/capi:79 /etc/rc.d/init.d/fb-server:76
#: /etc/rc.d/init.d/greylistd:69 /etc/rc.d/init.d/isdn:281
#: /etc/rc.d/init.d/isnsd:74 /etc/rc.d/init.d/tgtd:86
msgid "Usage: $0 {start|stop|restart|status|condrestart}"
msgstr "Gebruik: $0 {start|stop|restart|status|condrestart}"

#: /etc/rc.d/init.d/smokeping:33
msgid "Starting smokeping: "
msgstr "Starten van smokeping: "

#: /etc/rc.d/init.d/mldonkey:40
#, fuzzy
msgid "Stopping Mldonkey (mlnet): "
msgstr "Stoppen van oki4daemon: "

#: /etc/rc.d/init.d/wdaemon:35
msgid "Loading uinput module: "
msgstr "Laden van uinput module: "

#: /etc/rc.d/init.d/puppet:36
msgid "Starting puppet: "
msgstr "Starten van puppet: "

#: /etc/rc.d/init.d/cyphesis:37
msgid "PostgreSQL server is not running."
msgstr "PostgreSQL server is niet gestart."

#: /etc/rc.d/init.d/halt:71
msgid "Sending all processes the TERM signal..."
msgstr "Verzenden van TERM signaal naar alle processen..."

#: /etc/rc.d/init.d/auditd:112
msgid "Rotating logs: "
msgstr "Roteren van logbestanden "

#: /etc/rc.d/init.d/clamd-wrapper:10
msgid "*** the clamav-server can be configured"
msgstr "*** de clamav-server kan worden geconfigureerd"

#: /etc/rc.d/init.d/restorecond:41
msgid "Starting restorecond: "
msgstr "Starten van restorecond: "

#: /etc/rc.d/init.d/xenstored:43
msgid "Starting xenstored daemon: "
msgstr "Starten van xenstored daemon: "

#: /etc/rc.d/init.d/sqlgrey:25
msgid "Shutting down SQLgrey: "
msgstr "Stoppen van SQLgrey: "

#: /etc/rc.d/init.d/vprocunhide:53
msgid "/proc entries are not fixed"
msgstr "/proc items zijn niet gerepareerd"

#: /etc/rc.d/init.d/ipmi:229 /etc/rc.d/init.d/ipmi:235
msgid "Starting ipmi_watchdog driver: "
msgstr "Starten van ipmi_watchdog driver: "

#: /etc/rc.d/init.d/libvirtd:63
msgid "Stopping $SERVICE daemon: "
msgstr "Stoppen van $SERVICE daemon: "

#: /etc/rc.d/init.d/named:74
msgid "Starting named: "
msgstr "Starten van named: "

#: /etc/rc.d/init.d/nfs:121
msgid "Shutting down NFS daemon: "
msgstr "Stoppen van de NFS-daemon: "

#: /etc/rc.d/init.d/iscsid:65 /etc/rc.d/init.d/iscsid:66
msgid "Not stopping $prog: iscsi sessions still active"
msgstr ""

#: /etc/rc.d/init.d/condor:65
msgid "Reloading Condor daemons: "
msgstr "Herladen van Condor daemons: "

#: /etc/rc.d/init.d/tclhttpd:46
msgid "$base (pid $pid) is running..."
msgstr "$base (pid $pid) is gestart..."

#: /etc/rc.d/init.d/postfix:80
msgid "Shutting down postfix: "
msgstr "Stoppen van postfix: "

#: /etc/rc.d/init.d/innd:95
msgid "Reloading INN Service: "
msgstr "Herladen van INN-service: "

#: /etc/rc.d/init.d/arptables_jf:106
msgid "Flushing all chains:"
msgstr "Alle regels wissen:"

#: /etc/rc.d/init.d/mysqld:49
msgid "Initializing MySQL database: "
msgstr "Initialiseren van MySQL database: "

#: /etc/rc.d/init.d/ip6tables:179
msgid "${IP6TABLES}: ${_IPV} is disabled."
msgstr "${IP6TABLES}: ${_IPV} is uitgezet."

#: /etc/rc.d/init.d/incrond:21
msgid "Starting incrond: "
msgstr "Starten van incrond: "

#: /etc/rc.d/init.d/capi:26
msgid "Starting capi4linux:"
msgstr "Starten van capi4linux:"

#: /etc/rc.d/init.d/aiccu:117 /etc/rc.d/init.d/exim:90
#: /etc/rc.d/init.d/nmb:110 /etc/rc.d/init.d/smb:110
#: /etc/rc.d/init.d/winbind:98
msgid "Usage: $0 {start|stop|restart|reload|status|condrestart}"
msgstr "Gebruik: $0 {start|stop|restart|reload|status|condrestart}"

#: /etc/rc.d/init.d/halt:34
#, fuzzy
msgid "Stopping disk encryption for $dst"
msgstr "Stoppen van disk-encryptie: "

#: /etc/rc.d/init.d/xend:59
msgid "Reloading xend daemon: "
msgstr "Herladen van xend daemon: "

#: /etc/rc.d/init.d/functions:131
msgid "Detaching loopback device $dev: "
msgstr "Ontkoppelen van loopback-apparaat $dev: "

#: /etc/rc.d/init.d/spamass-milter:108
msgid "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
msgstr "Gebruik: $0 {start|stop|restart|try-restart|force-reload|status}"

#: /etc/rc.d/init.d/greylistd:35
msgid "Shutting down greylistd: "
msgstr "Stoppen van greylistd: "

#: /etc/rc.d/init.d/perlbal:29
msgid "Stopping Perlbal: "
msgstr "Stoppen van Perlbal: "

#: /etc/rc.d/init.d/dkms_autoinstaller:149 /etc/rc.d/init.d/firstboot:78
msgid "Usage: $0 {start|stop}"
msgstr "Gebruik: $0 {start|stop}"

#: /etc/rc.d/init.d/ebtables:42 /etc/rc.d/init.d/mon:26
#: /etc/rc.d/init.d/partimaged:36
msgid "Starting $desc ($prog): "
msgstr "Starten van $desc ($prog): "

#: /etc/rc.d/init.d/shorewall:50 /etc/rc.d/init.d/shorewall6:50
#: /etc/rc.d/init.d/shorewall6-lite:50 /etc/rc.d/init.d/shorewall-lite:50
msgid "Stopping Shorewall: "
msgstr "Stoppen van Shorewall: "

#: /etc/rc.d/init.d/cachefilesd:82
msgid "Usage: $0 {start|stop|restart|condstart|condrestart|status}"
msgstr "Gebruik: $0 {start|stop|restart|condstart|condrestart|status}"

#: /etc/rc.d/init.d/fsniper:49 /etc/rc.d/init.d/radvd:70
msgid "Reloading $PROG: "
msgstr "Herladen van $PROG: "

#: /etc/rc.d/init.d/microcode_ctl:40
msgid "$0: CPU microcode data file not present ($DATAFILE)"
msgstr "$0: CPU-microcode datafile niet aanwezig ($DATAFILE)"

#: /etc/sysconfig/network-scripts/ifup:81
msgid "PHYSDEV should be set for device ${DEVICE}"
msgstr "PHYSDEV dient ingesteld te zijn voor apparaat ${DEVICE}"

#: /etc/rc.d/init.d/condor:200
msgid "$0: error: $prog is not running"
msgstr "$0: fout: $prog is niet gestart"

#: /etc/rc.d/init.d/systemtap:66
msgid "\t-y \t\t: answer yes for all questions."
msgstr ""

#: /etc/rc.d/init.d/puppet:66
msgid "Generate configuration puppet: "
msgstr "Genereren van puppet configuratie: "

#: /etc/rc.d/init.d/ctdb:200
#, fuzzy
msgid "Checking for ctdbd service: "
msgstr "Controleren van SMART-apparaten: "

#: /etc/rc.d/init.d/ulogd:77
msgid "restarting $prog..."
msgstr "herstarten van $prog..."

#: /etc/rc.d/init.d/psacct:22
msgid "Starting process accounting: "
msgstr "Starten van processenbeheer: "

#: /etc/rc.d/init.d/ypxfrd:22
msgid "Starting YP map server: "
msgstr "Starten van YP map server: "

#: /etc/rc.d/init.d/ulogd:53
msgid "$prog is already stopped."
msgstr "$prog is reeds gestopt."

#: /etc/rc.d/init.d/monotone:205 /etc/rc.d/init.d/monotone:206
msgid "database check"
msgstr "database check"

#: /etc/rc.d/init.d/vdr:81
msgid "Restarting Video Disk Recorder ($prog): "
msgstr "Herstarten van Video Disk Recorder ($prog): "

#: /etc/rc.d/init.d/ip6tables:246
msgid "${IP6TABLES}: Saving firewall rules to $IP6TABLES_DATA: "
msgstr "${IP6TABLES}: Opslaan van firewall regels naar $IP6TABLES_DATA: "

#: /etc/rc.d/init.d/glacier2router:71 /etc/rc.d/init.d/icegridnode:72
#: /etc/rc.d/init.d/icegridregistry:72
msgid "Shutting down $progbase: "
msgstr "Stoppen van $progbase: "

#: /etc/sysconfig/network-scripts/ifup-ippp:374
#: /etc/sysconfig/network-scripts/ifup-isdn:374
msgid ""
"Warning: ipppd (kernel 2.4.x and below) doesn't support IPv6 using "
"encapsulation 'syncppp'"
msgstr ""
"Waarschuwing: ipppd (kernel 2.4.x en lager) ondersteunt geen IPv6 gebruik "
"makend van encapsulatie 'syncppp'"

#: /etc/rc.d/init.d/gpm:58
msgid "(no mouse is configured)"
msgstr "(er is geen muis geconfigureerd)"

#: /etc/rc.d/rc.sysinit:84
msgid "*** Relabeling could take a very long time, depending on file"
msgstr "*** Opnieuw labelen kan erg lang duren, afhankelijk van bestand"

#: /etc/rc.d/init.d/honeyd:46
msgid "Starting $prog2: "
msgstr "Starten van $prog2: "

#: /etc/rc.d/init.d/pgpool:100
msgid "Sending switchover request to $NAME "
msgstr "Verzenden van switchover verzoek aan $NAME "

#: /etc/rc.d/init.d/gkrellmd:70 /etc/rc.d/init.d/hddtemp:79
#: /etc/rc.d/init.d/vdr:96
msgid "Service $prog does not support the reload action: "
msgstr "Service $prog heeft geen ondersteuning voor de reload actie: "

#: /etc/rc.d/init.d/syslog-ng:58
msgid "Reloading syslog-ng.conf file: "
msgstr "Herladen van syslog-ng.conf bestand: "

#: /etc/sysconfig/network-scripts/ifup-ppp:145
msgid "pppd started for ${DEVNAME} on ${MODEMPORT} at ${LINESPEED}"
msgstr "pppd gestart voor ${DEVNAME} op ${MODEMPORT} met ${LINESPEED}"

#: /etc/rc.d/init.d/apmd:59
msgid "Shutting down APM daemon: "
msgstr "Stoppen van APM-daemon: "

#: /etc/rc.d/init.d/crossfire:98 /etc/rc.d/init.d/ctrlproxy:108
#: /etc/rc.d/init.d/ddclient:77 /etc/rc.d/init.d/distccd:108
#: /etc/rc.d/init.d/flow-capture:109 /etc/rc.d/init.d/gnokii-smsd:73
#: /etc/rc.d/init.d/haproxy:107 /etc/rc.d/init.d/iceccd:126
#: /etc/rc.d/init.d/icecc-scheduler:109 /etc/rc.d/init.d/liquidwar-server:93
#: /etc/rc.d/init.d/lirc:131 /etc/rc.d/init.d/moomps:70
#: /etc/rc.d/init.d/named:214 /etc/rc.d/init.d/nessusd:86
#: /etc/rc.d/init.d/openct:85 /etc/rc.d/init.d/pcscd:82
#: /etc/rc.d/init.d/plague-builder:98 /etc/rc.d/init.d/plague-server:99
#: /etc/rc.d/init.d/rinetd:81 /etc/rc.d/init.d/sgemaster:386
#: /etc/rc.d/init.d/syslog-ng:87 /etc/rc.d/init.d/tetrinetx:100
#: /etc/rc.d/init.d/wesnothd:104 /etc/rc.d/init.d/wpa_supplicant:87
#: /etc/rc.d/init.d/xpilot-ng-server:100
msgid "Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|try-restart|reload|force-reload}"

#: /etc/rc.d/init.d/systemtap:65
msgid "\t-R \t\t: recursively dependency checking"
msgstr ""

#: /etc/rc.d/init.d/avahi-daemon:35
msgid "Starting Avahi daemon... "
msgstr "Starten van Avahi daemon... "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:922
msgid "Given address '$addr' is not a valid IPv4 one (arg 1)"
msgstr "Opgegeven adres '$addr' is geen geldig IPv4-adres (arg 1)"

#: /etc/rc.d/init.d/cyrus-imapd:105
msgid "Shutting down $BASENAME: "
msgstr "Stoppen van $BASENAME: "

#: /etc/rc.d/init.d/pound:29
msgid "Stopping Pound: "
msgstr "Stoppen van Pound: "

#: /etc/rc.d/init.d/netfs:121
msgid "Configured NFS mountpoints: "
msgstr "Geconfigureerde NFS-koppelpunten: "

#: /etc/rc.d/init.d/pound:21
msgid "Starting Pound: "
msgstr "Starten van Pound: "

#: /etc/rc.d/init.d/chronyd:154
msgid ""
"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-"
"reload|cyclelogs|online|offline}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-"
"reload|cyclelogs|online|offline}"

#: /etc/rc.d/init.d/halt:118
msgid "Unmounting pipe file systems: "
msgstr "Afkoppelen van pipe bestandssystemen: "

# vertaling ok?
#: /etc/rc.d/rc:40
msgid "Entering interactive startup"
msgstr "Beginnen met interactief opstarten"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1094
msgid "Missing parameter 'IPv4-tunnel address' (arg 2)"
msgstr "Parameter 'IPv4-tunnel address' (arg 2) ontbreekt"

#: /etc/rc.d/init.d/mcstrans:108
msgid "Usage: $0 {start|stop|status|restart|condrestart|reload|rotate}"
msgstr "Gebruik: $0 {start|stop|status|restart|condrestart|reload|rotate}"

#: /etc/rc.d/init.d/xfs:143
msgid "Usage: $prog {start|stop|status|restart|reload|condrestart}"
msgstr "Gebruik: $prog {start|stop|status|restart|reload|condrestart}"

#: /etc/rc.d/init.d/icecc-scheduler:32
msgid "Starting distributed compiler scheduler: "
msgstr "Starten van distributed compiler scheduler: "

#: /etc/rc.d/init.d/systemtap:160
msgid "parse error"
msgstr ""

# "character device" hier onvertaald gelaten.
#: /etc/rc.d/init.d/microcode_ctl:58
msgid "$0: $DEVICE not a character device?"
msgstr "$0: $DEVICE geen character device?"

#: /etc/rc.d/init.d/modclusterd:99 /etc/rc.d/init.d/ricci:180
msgid "Starting $ID: "
msgstr "Starten van $ID: "

#: /etc/sysconfig/network-scripts/ifup-aliases:340
msgid "error in $FILE: IPADDR_START and IPADDR_END don't agree"
msgstr "fout in $FILE: IPADDR_START en IPADDR_END komen niet overeen"

#: /etc/rc.d/init.d/nfs:194
msgid "Usage: nfs {start|stop|status|restart|reload|condrestart|condstop}"
msgstr "Gebruik: nfs {start|stop|status|restart|reload|condrestart|condstop}"

#: /etc/rc.d/init.d/restorecond:85
msgid "Usage: $0 {start|stop|restart|reload|condrestart}"
msgstr "Gebruik: $0 {start|stop|restart|reload|condrestart}"

#: /etc/rc.d/init.d/netfs:157
msgid "Active network block devices: "
msgstr "Actieve netwerk block devices: "

#: /etc/sysconfig/network-scripts/ifup-ppp:59
msgid "adsl-start does not exist or is not executable for ${DEVICE}"
msgstr "adsl-start bestaat niet of is niet uitvoerbaar voor ${DEVICE}"

#: /etc/rc.d/init.d/isdn:189
msgid "Shutting down $prog"
msgstr "Stoppen van $prog"

#: /etc/rc.d/init.d/rsyslog:37 /etc/rc.d/init.d/sysklogd:40
msgid "Starting system logger: "
msgstr "Starten van systeemlogger: "

#: /etc/rc.d/init.d/tofmipd:88
msgid "Usage: $progname {start|stop|restart|condrestart|status}"
msgstr "Gebruik: $progname {start|stop|restart|condrestart|status}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:324
#: /etc/sysconfig/network-scripts/network-functions-ipv6:379
msgid "Missing parameter 'IPv6-network' (arg 1)"
msgstr "Parameter 'IPv6-network' (arg 1) ontbreekt"

#: /etc/sysconfig/network-scripts/ifup-ipv6:117
msgid ""
"Global IPv6 forwarding is disabled in configuration, but not currently "
"disabled in kernel"
msgstr ""
"Globale IPv6-forwarding is uitgezet in de configuratie, maar is niet "
"uitgezet in de kernel"

#: /etc/rc.d/init.d/iptables:131
msgid "${IPTABLES}: Setting chains to policy $policy: "
msgstr "${IPTABLES}: Instellen van regels naar beleid $policy: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:302
msgid ""
"IPv6 forwarding per device cannot be controlled via sysctl - use netfilter6 "
"instead"
msgstr ""
"IPv6 forwarding per apparaat kan niet worden bestuurd via sysctl - gebruik "
"hiervoor netfilter6"

#: /etc/rc.d/init.d/honeyd:94
msgid "Reloading $prog2: "
msgstr "Herladen van $prog2: "

#: /etc/rc.d/init.d/netconsole:100
msgid "Disabling netconsole"
msgstr "Uitzetten van netconsole"

#: /etc/rc.d/init.d/httpd:76
msgid "not reloading due to configuration syntax error"
msgstr "niet herladen in verband met een configuratie syntaxisfout"

#: /etc/rc.d/init.d/vblade:29
msgid "$4 (e$2.$3@$1) [pid $pid]"
msgstr "$4 (e$2.$3@$1) [pid $pid]"

#: /etc/rc.d/init.d/auditd:120
msgid "Resuming logging: "
msgstr "Hervatten van logging: "

#: /etc/rc.d/init.d/network:262
msgid "Shutting down loopback interface: "
msgstr "Stoppen van loopback interface: "

#: /etc/rc.d/init.d/icecast:22
msgid "Starting icecast streaming daemon: "
msgstr "Starten van icecast streaming daemon: "

#: /etc/rc.d/init.d/certmaster:90
#, fuzzy
msgid "Stopping certmaster daemon: "
msgstr "Stoppen van xenstored daemon: "

#: /etc/rc.d/init.d/gkrellmd:41
msgid "Stopping GNU Krell Monitors server ($prog): "
msgstr "Stoppen van GNU Krell Monitors server ($prog): "

#: /etc/rc.d/init.d/wine:78
msgid "Usage: $prog {start|stop|status|restart|try-restart}"
msgstr "Gebruik: $prog {start|stop|status|restart|try-restart}"

#: /etc/rc.d/rc.sysinit:85
msgid "*** system size and speed of hard drives."
msgstr "*** systeemgrootte en de snelheid van harde schijven."

#: /etc/rc.d/init.d/sysklogd:44
msgid "Starting kernel logger: "
msgstr "Starten van kernel logger: "

#: /etc/rc.d/init.d/util-vserver:77
msgid "Killing all running contexts"
msgstr "Stoppen van alle actieve contexten"

#: /etc/event.d/rc1:27
msgid "Telling INIT to go to single user mode."
msgstr "Aangeven aan INIT om naar single user mode over te gaan."

#: /etc/rc.d/init.d/sagator:31
msgid "Starting $name: "
msgstr "Starten van $name: "

#: /etc/rc.d/init.d/systemtap:503 /etc/rc.d/init.d/systemtap:543
msgid "Failed to sort dependency"
msgstr ""

#: /etc/sysconfig/network-scripts/ifup:30
#: /etc/sysconfig/network-scripts/ifup:38
msgid "Usage: ifup <device name>"
msgstr "Gebruik: ifup <apparaatnaam>"

#: /etc/rc.d/init.d/bcfg2:118
msgid "1"
msgstr "1"

#: /etc/rc.d/init.d/halt:156
msgid "$message"
msgstr "$message"

#: /etc/rc.d/init.d/ip6tables:351
msgid "Usage: ${IP6TABLES} {start|stop|restart|condrestart|status|panic|save}"
msgstr ""
"Gebruik: ${IP6TABLES} {start|stop|restart|condrestart|status|panic|save}"

#: /etc/rc.d/init.d/ipa_kpasswd:46 /etc/rc.d/init.d/ipa_webgui:42
msgid "Shutting down $NAME: "
msgstr "Stoppen van $NAME: "

#: /etc/rc.d/init.d/functions:126
msgid "Unmounting loopback filesystems (retry):"
msgstr "Afkoppelen van loopback-bestandssystemen (opnieuw):"

#: /etc/sysconfig/network-scripts/ifdown:15
#: /etc/sysconfig/network-scripts/ifdown:22
msgid "usage: ifdown <device name>"
msgstr "Gebruik: ifdown <apparaatnaam>"

#: /etc/rc.d/init.d/smokeping:40
msgid "Stopping smokeping: "
msgstr "Stoppen van smokeping: "

#: /etc/rc.d/init.d/maradns-zoneserver:80
#, fuzzy
msgid "Stopping MaraDNS-Zoneserver: "
msgstr "Stoppen van monotone server: "

#: /etc/ppp/ip-up.ipv6to4:186
msgid "Error occured while calculating the IPv6to4 prefix"
msgstr "Fout tijdens het berekenen van de IPv6to4 prefix"

#: /etc/rc.d/init.d/openvpn:112
msgid "Starting openvpn: "
msgstr "Starten van openvpn: "

#: /etc/rc.d/init.d/postfix:91
msgid "$prog reload"
msgstr "$prog herladen"

#: /etc/rc.d/init.d/mogilefsd:28 /etc/rc.d/init.d/mogstored:28
msgid "Stopping MogileFS tracker daemon: "
msgstr "Stoppen van MogileFS tracker daemon: "

#: /etc/rc.d/init.d/unbound:49
msgid "Starting unbound: "
msgstr "Starten van unbound: "

#: /etc/rc.d/init.d/ypbind:80
msgid "Starting NIS service: "
msgstr "Starten van NIS-service: "

#: /etc/rc.d/init.d/systemtap:511
msgid "Failed to run \"$s\". ($ret)"
msgstr ""

#: /etc/rc.d/init.d/glacier2router:46 /etc/rc.d/init.d/glacier2router:49
#: /etc/rc.d/init.d/icegridnode:47 /etc/rc.d/init.d/icegridnode:50
#: /etc/rc.d/init.d/icegridregistry:47 /etc/rc.d/init.d/icegridregistry:50
msgid "Starting $progbase: "
msgstr "Starten van $progbase: "

#: /etc/rc.d/init.d/xttpd:36
msgid "PORT environment is not set."
msgstr "PORT-omgeving is niet ingesteld."

#: /etc/rc.d/init.d/pure-ftpd:81
msgid "Usage: pure-ftpd {start|stop|restart|reload|condrestart|status}"
msgstr "Gebruik: pure-ftpd {start|stop|restart|reload|condrestart|status}"

#: /etc/rc.d/init.d/xenner:100
msgid "Stopping xenner daemons"
msgstr "Stoppen van xenner daemons"

#: /etc/rc.d/init.d/halt:109
msgid "Turning off quotas: "
msgstr "Uitzetten van quotas: "

#: /etc/rc.d/init.d/iptables:183
msgid "${IPTABLES}: Applying firewall rules: "
msgstr "${IPTABLES}: Toepassen van firewall regels: "

#: /etc/rc.d/init.d/named:76
msgid "named: already running"
msgstr "named: reeds gestart"

#: /etc/rc.d/init.d/netfs:41
msgid "Mounting NFS filesystems: "
msgstr "Aankoppelen van NFS-bestandssystemen: "

#: /etc/rc.d/init.d/NetworkManager:51
msgid "Starting NetworkManager daemon: "
msgstr "Starten van NetworkManager daemon: "

#: /etc/rc.d/rc.sysinit:68
msgid "*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required. "
msgstr ""
"*** Waarschuwing -- SELinux ${SELINUXTYPE} policy relabel-actie is vereist. "

#: /etc/rc.d/init.d/fb-server:42
msgid "Stopping Frozen Bubble server(s): "
msgstr "Stoppen van Frozen Bubble server(s): "

#: /etc/rc.d/init.d/rebootmgr:11 /etc/rc.d/init.d/util-vserver:10
#: /etc/rc.d/init.d/vprocunhide:10 /etc/rc.d/init.d/vservers-legacy:8
msgid ""
"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would "
"be expected); aborting..."
msgstr ""
"Kan util-vserver installatie niet vinden (het bestand '$UTIL_VSERVER_VARS' "
"wordt verwacht); afbreken..."

#: /etc/rc.d/init.d/puppet:98
msgid ""
"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|once|"
"genconfig}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|reload|force-reload|condrestart|once|"
"genconfig}"

#: /etc/sysconfig/network-scripts/ifup-ipv6:296
msgid "Error occurred while calculating the IPv6to4 prefix"
msgstr "Fout tijdens het berekenen van de IPv6to4 prefix"

#: /etc/rc.d/init.d/arptables_jf:186 /etc/rc.d/init.d/arptables_jf:187
msgid "Saving current rules to $ARPTABLES_CONFIG"
msgstr "Opslaan van huidige regels naar $ARPTABLES_CONFIG"

#: /etc/rc.d/init.d/tgtd:42
msgid "Stopping SCSI target daemon: "
msgstr "Stoppen van SCSI target daemon: "

#: /etc/rc.d/init.d/named:180
msgid "$named reload"
msgstr "$named herladen"

#: /etc/rc.d/init.d/maradns-zoneserver:69
#, fuzzy
msgid "Starting all MaraDNS-Zoneserver processes: "
msgstr "Starten van YP server services: "

# vertaling ok?
#: /etc/rc.d/rc:42
msgid "Entering non-interactive startup"
msgstr "Beginnen met niet-interactief opstarten"

#: /etc/rc.d/init.d/vdr:42
msgid "Error: no valid $cfg found."
msgstr "Fout: geen geldige $cfg gevonden."

#: /etc/rc.d/init.d/netfs:125
msgid "Configured SMB mountpoints: "
msgstr "Geconfigureerde SMB-koppelpunten: "

#: /etc/sysconfig/network-scripts/ifup-aliases:67
msgid "usage: ifup-aliases <net-device> [<parent-config>]\n"
msgstr "Gebruik: ifup-aliases <netwerkkaart> [<parent-config>]\n"

#: /etc/rc.d/init.d/xenconsoled:83
msgid "Reloading xenconsoled daemon: "
msgstr "Herladen van xenconsoled daemon: "

#: /etc/rc.d/init.d/bttrack:33
msgid "Starting BitTorrent tracker: "
msgstr "Starten van BitTorrent tracker: "

#: /etc/rc.d/init.d/systemtap:580
#, fuzzy
msgid "Compiling $prog: "
msgstr "Stoppen van $prog: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:150
msgid "ERROR: [ipv6_log] Cannot log to channel '$channel'"
msgstr "FOUT: [ipv6_log] Kan geen log aanmaken naar kanaal '$channel'"

#: /etc/sysconfig/network-scripts/ifup-eth:209
#: /etc/sysconfig/network-scripts/ifup-ib:179
msgid " done."
msgstr " voltooid."

#: /etc/rc.d/init.d/abrt:52
#, fuzzy
msgid "Stopping abrt daemon: "
msgstr "Stoppen van acpi-daemon: "

#: /etc/rc.d/init.d/kadmin:57 /etc/rc.d/init.d/krb5kdc:43
msgid "Reopening $prog log file: "
msgstr "Heropenen van $prog log bestand: "

#: /etc/rc.d/init.d/iptables:351
msgid "Usage: ${IPTABLES} {start|stop|restart|condrestart|status|panic|save}"
msgstr ""
"Gebruik: ${IPTABLES} {start|stop|restart|condrestart|status|panic|save}"

#: /etc/rc.d/init.d/atop:47
msgid "Reloading atop daemon configuration: "
msgstr "Herladen van atop daemon configuratie: "

#: /etc/rc.d/init.d/callweaver:22
msgid "Stopping CallWeaver: "
msgstr "Stoppen van CallWeaver: "

#: /etc/rc.d/init.d/nmb:66 /etc/rc.d/init.d/smb:66 /etc/rc.d/init.d/winbind:57
msgid "Reloading smb.conf file: "
msgstr "Herladen van smb.conf bestand: "

#: /etc/rc.d/init.d/capi:36
msgid "Stopping capi4linux:"
msgstr "Stoppen van capi4linux:"

#: /etc/rc.d/init.d/ups:79
msgid "Shutting down upsdrvctl: "
msgstr "Stoppen van upsdrvctl: "

#: /etc/sysconfig/network-scripts/ifup-tunnel:49
msgid "Invalid tunnel type $TYPE"
msgstr "Ongeldig soort tunnel $TYPE"

#: /etc/rc.d/init.d/ebtables:143
msgid "Usage $0 {start|stop|restart|condrestart|save|status}"
msgstr "Gebruik: $0 {start|stop|restart|condrestart|save|status}"

#: /etc/rc.d/init.d/innd:78
msgid "Stopping INNFeed service: "
msgstr "Stoppen van INNFeed service: "

#: /etc/sysconfig/network-scripts/ifup-eth:51
#: /etc/sysconfig/network-scripts/ifup-ib:42
msgid "Device ${DEVICE} has different MAC address than expected, ignoring."
msgstr ""
"Netwerkkaart ${DEVICE} heeft een ander MAC-adres dan verwacht, negeren."

#: /etc/rc.d/init.d/psacct:56
msgid "Process accounting is enabled."
msgstr "Processenbeheer is aangezet."

#: /etc/rc.d/init.d/rpcgssd:88
msgid "Stopping RPC gssd: "
msgstr "Stoppen van RPC-gssd: "

#: /etc/sysconfig/network-scripts/ifup-eth:197
#: /etc/sysconfig/network-scripts/ifup-ib:167
msgid "Determining IP information for ${DEVICE}..."
msgstr "Bepalen van IP-informatie voor ${DEVICE}..."

#: /etc/rc.d/init.d/pgbouncer:85 /etc/rc.d/init.d/pgpool:86
#: /etc/rc.d/init.d/postgresql:198 /etc/rc.d/init.d/sepostgresql:99
msgid "Stopping ${NAME} service: "
msgstr "Stoppen van ${NAME} service: "

#: /etc/rc.d/init.d/monotone:73
msgid "Moving"
msgstr ""

#: /etc/rc.d/init.d/cyrus-imapd:89
msgid ""
"$BASENAME error importing databases, check ${CONFIGDIRECTORY}/rpm/db_import."
"log"
msgstr ""
"$BASENAME fout bij het importeren van databases, controleer "
"${CONFIGDIRECTORY}/rpm/db_import.log"

#: /etc/rc.d/init.d/xenconsoled:58
msgid "Starting xenconsoled daemon: "
msgstr "Starten van xenconsoled daemon: "

#: /etc/rc.d/init.d/avahi-daemon:43 /etc/rc.d/init.d/avahi-daemon:45
#: /etc/rc.d/init.d/avahi-dnsconfd:40 /etc/rc.d/init.d/avahi-dnsconfd:42
#: /etc/rc.d/init.d/avahi-dnsconfd:62 /etc/rc.d/init.d/functions:251
#: /etc/rc.d/init.d/greylistd:28
msgid "$base startup"
msgstr "$base is gestart"

#: /etc/rc.d/init.d/sshd:58 /etc/rc.d/init.d/sshd:61
msgid "RSA1 key generation"
msgstr "RSA1-sleutel genereren"

#: /etc/rc.d/init.d/iptables:179
msgid "${IPTABLES}: ${_IPV} is disabled."
msgstr "${IPTABLES}: ${_IPV} is uitgezet."

#: /etc/rc.d/init.d/systemtap:622
msgid "failed to clean cache $s.ko"
msgstr ""

#: /etc/rc.d/init.d/cyphesis:90
msgid "Starting cyphesis: "
msgstr "Starten van cyphesis: "

#: /etc/rc.d/init.d/isdn:246
msgid "$0: Link is down"
msgstr "$0: Link is uitgevallen"

#: /etc/rc.d/init.d/psacct:58
msgid "Process accounting is disabled."
msgstr "Processenbeheer is uitgezet."

#: /etc/rc.d/init.d/ircd:88 /etc/rc.d/init.d/ratbox-services:79
msgid "Usage: $0 {start|stop|restart|condrestart|reload|rehash|status}"
msgstr "Gebruik: $0 {start|stop|restart|condrestart|reload|rehash|status}"

#: /etc/rc.d/init.d/xend:43
msgid "Stopping xend daemon: "
msgstr "Stoppen van xend daemon: "

#: /etc/rc.d/init.d/ejabberd:31
msgid "Starting ejabberd: "
msgstr "Starten van ejabberd: "

#: /etc/sysconfig/network-scripts/ifup:37
msgid "$0: configuration for ${1} not found."
msgstr "$0: configuratie voor ${1} niet gevonden."

#: /etc/rc.d/init.d/auditd:104 /etc/rc.d/init.d/mcstrans:72
#: /etc/rc.d/init.d/sec:53 /etc/rc.d/init.d/xinetd:96
msgid "Reloading configuration: "
msgstr "Herladen van configuratie: "

#: /etc/rc.d/init.d/codasrv:27 /etc/rc.d/init.d/codasrv:28
msgid "found CRASH file, srv not started"
msgstr "CRASH bestand gevonden, srv niet gestart"

#: /etc/rc.d/init.d/monotone:155
msgid "Server key already installed"
msgstr ""

#: /etc/sysconfig/network-scripts/network-functions-ipv6:113
msgid "ERROR    "
msgstr "FOUT    "

#: /etc/rc.d/init.d/innd:40
msgid "Please run makehistory and/or makedbz before starting innd."
msgstr ""
"Gelieve makehistory en/of makedbz op te starten alvorens innd op te starten."

#: /etc/rc.d/rc.sysinit:676
msgid "Enabling local filesystem quotas: "
msgstr "Aanzetten van lokale bestandssysteemquota's: "

#: /etc/rc.d/init.d/netfs:153
msgid "Active NCP mountpoints: "
msgstr "Actieve NCP-koppelpunten: "

#: /etc/rc.d/init.d/systemtap:571
msgid "$s is stopped"
msgstr "$s is gestopt"

#: /etc/rc.d/init.d/exim:53
msgid "Shutting down exim: "
msgstr "Stoppen van exim: "

#: /etc/rc.d/init.d/ajaxterm:71
msgid "Usage: $prog {start|stop|restart|condrestart}"
msgstr "Gebruik: $prog {start|stop|restart|condrestart}"

#: /etc/rc.d/init.d/condor:169
msgid "$0: error: program not installed"
msgstr "$0: fout: programma niet geïnstalleerd"

#: /etc/rc.d/init.d/iptables:220
msgid "${IPTABLES}: Unloading modules: "
msgstr "${IPTABLES}: Verwijderen van modules: "

#: /etc/rc.d/init.d/pdns-recursor:29
msgid "Stopping pdns-recursor: "
msgstr "Stoppen van pdns-recursor: "

#: /sbin/service:64
msgid "${SERVICE}: unrecognized service"
msgstr "${SERVICE}: onbekende service"

#: /etc/rc.d/init.d/ypbind:74 /etc/rc.d/init.d/ypbind:75
msgid "domain not found"
msgstr "domein niet gevonden"

#: /etc/rc.d/init.d/qpidd:74
msgid "$0: reload not supported"
msgstr "$0: reload niet ondersteund"

#: /etc/rc.d/init.d/named:128
msgid "Stopping named: "
msgstr "Stoppen van named: "

#: /etc/rc.d/init.d/atd:50 /etc/rc.d/init.d/crond:60
#: /etc/rc.d/init.d/dropbear:82 /etc/rc.d/init.d/iscsi:74
#: /etc/rc.d/init.d/iscsi:79 /etc/rc.d/init.d/speech-dispatcherd:32
#: /etc/rc.d/init.d/sshd:141 /etc/rc.d/init.d/tcsd:105
msgid "Stopping $prog"
msgstr "Stoppen van $prog"

#: /etc/rc.d/init.d/honeyd:120 /etc/rc.d/init.d/icecast:54
#: /etc/rc.d/init.d/psacct:69 /etc/rc.d/init.d/rdisc:87
#: /etc/rc.d/init.d/ulogd:95
msgid "Usage: $0 {start|stop|status|restart|reload}"
msgstr "Gebruik: $0 {start|stop|status|restart|reload}"

#: /etc/rc.d/init.d/functions:522
msgid "yY"
msgstr "jJ"

#: /etc/rc.d/init.d/puppet:53
msgid "Restarting puppet: "
msgstr "Herstarten van puppet: "

#: /etc/sysconfig/network-scripts/ifup-aliases:259
#: /etc/sysconfig/network-scripts/ifup-aliases:270
msgid "error in ifcfg-${parent_device}: files"
msgstr "fout in ifcfg-${parent_device}: bestanden"

#: /etc/rc.d/init.d/avahi-daemon:88
msgid "Avahi daemon is not running"
msgstr "Avahi daemon is niet gestart"

#: /etc/rc.d/init.d/nfs:125
msgid "Shutting down NFS quotas: "
msgstr "Stoppen van NFS-quotas: "

#: /etc/rc.d/init.d/functions:187 /etc/rc.d/init.d/functions:223
msgid "$0: Usage: daemon [+/-nicelevel] {program}"
msgstr "$0: Gebruik: daemon [+/-nicelevel] {programma}"

#: /etc/rc.d/init.d/functions:410
msgid "${base} dead but subsys locked"
msgstr "${base} afgesloten, maar subsysteem is vergrendeld"

#: /etc/rc.d/init.d/ibmasm:21 /etc/rc.d/init.d/mcstrans:46
msgid "$prog: already running"
msgstr "$prog: reeds gestart"

#: /etc/rc.d/init.d/rstatd:37
msgid "Starting rstat services: "
msgstr "Starten van rstat services: "

#: /etc/rc.d/init.d/netfs:129
msgid "Configured CIFS mountpoints: "
msgstr "Geconfigureerde CIFS-koppelpunten: "

#: /etc/rc.d/init.d/atd:108 /etc/rc.d/init.d/auth2:92
#: /etc/rc.d/init.d/beanstalkd:106 /etc/rc.d/init.d/bro:184
#: /etc/rc.d/init.d/clamav-milter:90 /etc/rc.d/init.d/coda-client:86
#: /etc/rc.d/init.d/codasrv:93 /etc/rc.d/init.d/collectl:98
#: /etc/rc.d/init.d/couchdb:107 /etc/rc.d/init.d/crond:126
#: /etc/rc.d/init.d/fcron_watch_config:99 /etc/rc.d/init.d/fsniper:94
#: /etc/rc.d/init.d/gmediaserver:121 /etc/rc.d/init.d/imapproxy:101
#: /etc/rc.d/init.d/kojid:81 /etc/rc.d/init.d/kojira:81
#: /etc/rc.d/init.d/npcd:100 /etc/rc.d/init.d/nuauth:133
#: /etc/rc.d/init.d/nufw:129 /etc/rc.d/init.d/nxtvepgd:101
#: /etc/rc.d/init.d/poker-bot:102 /etc/rc.d/init.d/poker-server:105
#: /etc/rc.d/init.d/saslauthd:106 /etc/rc.d/init.d/speech-dispatcherd:90
#: /etc/rc.d/init.d/tinyproxy:102 /etc/rc.d/init.d/trytond:113
#: /etc/rc.d/init.d/tuned:98 /etc/rc.d/init.d/unbound:113
#: /etc/rc.d/init.d/update:127 /etc/rc.d/init.d/vtund:107
#: /etc/rc.d/init.d/zfs-fuse:197
msgid ""
"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-"
"reload}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-"
"reload}"

#: /etc/rc.d/init.d/openais:20
#, fuzzy
msgid "Starting OpenAIS ($prog): "
msgstr "Starten van OpenAIS daemon ($prog): "

#: /etc/rc.d/init.d/unbound:42
msgid "Generating unbound control key and certificate: "
msgstr ""

#: /etc/rc.d/init.d/vncserver:61
msgid "vncserver startup"
msgstr "vncserver is gestart"

#: /etc/sysconfig/network-scripts/init.ipv6-global:180
msgid "Usage: $0 {start|stop|reload|restart|showsysctl}"
msgstr "Gebruik: $0 {start|stop|reload|restart|showsysctl}"

#: /etc/sysconfig/network-scripts/ifup-aliases:128
#: /etc/sysconfig/network-scripts/network-functions:74
msgid "Missing config file $PARENTCONFIG."
msgstr "Configuratiebestand $PARENTCONFIG ontbreekt."

#: /etc/rc.d/init.d/network:267
msgid "Disabling IPv4 packet forwarding: "
msgstr "Uitzetten van IPv4 pakket forwarding: "

#: /etc/rc.d/init.d/innd:63
msgid "Stopping INND service (the hard way): "
msgstr "Stoppen van INND-service (de harde manier): "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1365
msgid "Given IPv6 default gateway '$address' is not in proper format"
msgstr ""
"Opgegeven IPv6 standaard gateway '$address' staat niet in het juiste formaat"

#: /etc/rc.d/init.d/tclhttpd:57
msgid "$base dead but subsys locked"
msgstr "$base afgesloten, maar subsysteem is vergrendeld"

#: /etc/sysconfig/network-scripts/ifup-sit:71
msgid "Device '$DEVICE' is already up, please shutdown first"
msgstr "Netwerkkaart '$DEVICE' is reeds gestart, schakel deze eerst uit"

#: /etc/rc.d/init.d/argus:38
msgid "Shutting down argus: "
msgstr "Stoppen van argus: "

#: /etc/rc.d/init.d/cgred:81
#, fuzzy
msgid "Stopping CGroup Rules Engine Daemon..."
msgstr "Stoppen van xenner daemons"

#: /etc/rc.d/init.d/haldaemon:35
msgid "Stopping HAL daemon: "
msgstr "Stoppen van HAL-daemon: "

#: /etc/rc.d/init.d/avahi-daemon:88
msgid "Avahi daemon is running"
msgstr "Avahi daemon is gestart"

#: /etc/rc.d/init.d/ulogd:39
msgid "$prog is already running."
msgstr "$prog is reeds gestart."

#: /etc/rc.d/rc.sysinit:70
msgid "*** problems. Dropping you to a shell; the system will reboot"
msgstr "*** problemen. U komt terecht in een shell, het systeem wordt herstart"

#: /etc/rc.d/init.d/arptables_jf:59
msgid "Starting arptables_jf"
msgstr "Starten van arptables_jf"

#: /etc/rc.d/init.d/rpcgssd:44
msgid "Starting RPC gssd: "
msgstr "Starten van RPC-gssd: "

#: /etc/rc.d/init.d/nfs:175
msgid "reload"
msgstr "herladen"

#: /etc/rc.d/init.d/mldonkey:32
#, fuzzy
msgid "Starting Mldonkey (mlnet): "
msgstr "Starten van oki4daemon: "

#: /etc/rc.d/init.d/netfs:57 /etc/rc.d/rc.sysinit:372
msgid "Setting up Logical Volume Management:"
msgstr "Instellen van Logical Volume Management:"

#: /etc/rc.d/init.d/uuidd:42
msgid "Stopping uuidd: "
msgstr "Stoppen van uuidd: "

#: /etc/rc.d/init.d/ladvd:47
msgid "Starting ladvd: "
msgstr "Starten van ladvd: "

#: /etc/rc.d/init.d/netfs:145
msgid "Active SMB mountpoints: "
msgstr "Actieve SMB-koppelpunten: "

#: /etc/rc.d/init.d/rpcidmapd:43
msgid "Starting RPC idmapd: "
msgstr "Starten van RPC-idmapd: "

#: /etc/rc.d/init.d/wine:24
msgid "Binary handler for Windows applications already registered"
msgstr "Binaire verwerker voor Windows applicaties reeds geregistreerd"

#: /etc/rc.d/init.d/systemtap:570
#, fuzzy
msgid "$s$pid is running..."
msgstr "($pid) is gestart..."

#: /etc/rc.d/init.d/privoxy:67
msgid "Starting $PRIVOXY_PRG: "
msgstr "Starten van $PRIVOXY_PRG: "

#: /etc/rc.d/init.d/vprocunhide:23
msgid "Fixing /proc entries visibility"
msgstr "Regelen van zichtbaarheid /proc items"

#: /etc/rc.d/init.d/innd:85
msgid "Stopping INN actived service: "
msgstr "Stoppen van INN actived service: "

#: /etc/rc.d/init.d/ipmi:445
msgid "Stopping all ${MODULE_NAME} drivers: "
msgstr "Stoppen van alle ${MODULE_NAME} drivers: "

#: /etc/rc.d/init.d/tgtd:51
msgid "Targets still in use. Cannot shutdown service."
msgstr "Doelen nog steeds in gebruik. Kan service niet afsluiten."

#: /etc/rc.d/init.d/tor:88
msgid "Usage: $0 {start|stop|force-reload|reload|try-restart|status}"
msgstr "Gebruik: $0 {start|stop|force-reload|reload|try-restart|status}"

#: /etc/sysconfig/network-scripts/ifup-aliases:187
msgid "error in $FILE: already seen device $parent_device:$DEVNUM in $devseen"
msgstr ""
"fout in $FILE: reeds netwerkkaart $parent_device:$DEVNUM gezien in $devseen"

#: /etc/rc.d/init.d/sysklogd:51
msgid "Shutting down kernel logger: "
msgstr "Stoppen van kernel logger: "

#: /etc/rc.d/init.d/tor:67
msgid "program is not running"
msgstr "programma is niet gestart"

#: /etc/rc.d/rc.sysinit:142
msgid "Key file for $dst not found, skipping"
msgstr "Sleutelbestand voor $dst niet gevonden, wordt overgeslagen"

#: /etc/rc.d/init.d/ups:52
msgid "Starting UPS monitor (master): "
msgstr "Starten van UPS-monitor (master): "

#: /etc/rc.d/init.d/btseed:47
msgid "Shutting down BitTorrent seed client: "
msgstr "Stoppen van BitTorrent seed client: "

#: /etc/sysconfig/network-scripts/ifup:115
#: /etc/sysconfig/network-scripts/ifup:116
msgid "ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}"
msgstr ""
"FOUT: kon vlan ${VID} niet als ${DEVICE} toevoegen op apparaat ${PHYSDEV}"

#: /etc/rc.d/init.d/halt:46
msgid "Halting system..."
msgstr "Afsluiten van het systeem..."

#: /etc/rc.d/init.d/avahi-daemon:62
msgid "Reloading Avahi daemon... "
msgstr "Herladen van Avahi daemon... "

#: /etc/rc.d/init.d/iptables:31
msgid "${IPTABLES}: /sbin/$IPTABLES does not exist."
msgstr "${IPTABLES}: /sbin/$IPTABLES bestaat niet."

#: /etc/rc.d/init.d/lirc:65
msgid "Starting infrared remote control daemon ($prog): "
msgstr "Starten van infrared remote control daemon ($prog): "

#: /etc/rc.d/init.d/condor:212
msgid "$prog status is unknown"
msgstr "$prog status is onbekend"

#: /etc/rc.d/init.d/ip6tables:291
msgid "${IP6TABLES}: Firewall is not configured. "
msgstr "${IP6TABLES}: Firewall is niet geconfigureerd. "

#: /etc/rc.d/init.d/canna:89 /etc/rc.d/init.d/condor:224
#: /etc/rc.d/init.d/dhcp6r:91 /etc/rc.d/init.d/dhcp6s:103
#: /etc/rc.d/init.d/fnfxd:67 /etc/rc.d/init.d/rbldnsd:191
#: /etc/rc.d/init.d/ups:136
msgid "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}"
msgstr ""
"Gebruik: $0 {start|stop|restart|try-restart|reload|force-reload|status}"

#: /etc/rc.d/init.d/smolt:68
msgid "Monthly smolt check-in is disabled."
msgstr "Maandelijkse smolt check-in is uitgezet."

#: /etc/rc.d/init.d/postfix:111
msgid "$prog check"
msgstr "$prog check"

#: /etc/rc.d/init.d/corosync:56 /etc/rc.d/init.d/dictd:94
#: /etc/rc.d/init.d/openais:57
msgid ""
"Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|"
"status}"
msgstr ""
"Gebruik: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|"
"status}"

#: /etc/rc.d/init.d/tclhttpd:37
msgid "Usage: status {program}"
msgstr "Gebruik: status {programma}"

#: /etc/rc.d/init.d/amd:94
msgid "Reloading $prog:"
msgstr "Herladen van $prog:"

#: /etc/rc.d/init.d/ypbind:90
msgid "Binding NIS service: "
msgstr "Binden van NIS-service: "

#: /etc/rc.d/init.d/pyicq-t:12
msgid "Starting ICQ transport: "
msgstr "Starten van ICQ-transport: "

#: /etc/rc.d/init.d/kdump:375
msgid "Usage: $0 {start|stop|status|restart|propagate}"
msgstr "Gebruik: $0 {start|stop|status|restart|propagate}"

#: /etc/rc.d/init.d/multipathd:35
msgid "Stopping $prog daemon: "
msgstr "Stoppen van $prog daemon: "

#: /etc/rc.d/init.d/ypbind:152
#, fuzzy
msgid "Reloading NIS service: "
msgstr "Herladen van INN-service: "

#: /etc/sysconfig/network-scripts/ifup-ipv6:283
msgid ""
"Using 6to4 and RADVD IPv6 forwarding usually should be enabled, but it isn't"
msgstr ""
"Bij het gebruik van 6to4 en RADVD moet IPv6-forwarding normaal gezien "
"aangezet zijn, maar het is het niet"

#: /etc/rc.d/init.d/thttpd:55
msgid "Stopping $prog gracefully: "
msgstr "Stoppen van $prog: "

#: /etc/rc.d/init.d/libvirtd:53
msgid "Starting $SERVICE daemon: "
msgstr "Starten van $SERVICE daemon: "

#: /etc/rc.d/init.d/amd:65
msgid "amd shutdown"
msgstr "amd is gestopt"

#: /etc/rc.d/init.d/blktapctrl:48
msgid "Stoping xen blktapctrl daemon: "
msgstr "Stoppen van xen blktapctrl daemon: "

#: /etc/rc.d/init.d/rusersd:53
msgid "Stopping rusers services: "
msgstr "Stoppen van rusers services: "

#: /etc/rc.d/init.d/dropbear:36 /etc/rc.d/init.d/dropbear:39
#: /etc/rc.d/init.d/sshd:77 /etc/rc.d/init.d/sshd:80
msgid "RSA key generation"
msgstr "RSA-sleutel genereren"

#: /etc/rc.d/init.d/moodle:39
msgid "Disabling Moodle cron job: "
msgstr "Uitzetten van Moodle cron job: "

#: /etc/rc.d/init.d/vtund:59
#, fuzzy
msgid "Reloading config for $prog: "
msgstr "Herladen van $prog: "

#: /etc/rc.d/init.d/messagebus:36
msgid "Starting system message bus: "
msgstr "Starten van system message bus: "

#: /etc/rc.d/init.d/ladvd:57
#, fuzzy
msgid "Shutting down ladvd: "
msgstr "Stoppen van pand: "

#: /etc/rc.d/init.d/privoxy:82
msgid "Stopping $PRIVOXY_PRG: "
msgstr "Stoppen van $PRIVOXY_PRG: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1114
msgid ""
"Given remote address '$addressipv4tunnel' on tunnel device '$device' is "
"already configured on device '$devnew'"
msgstr ""
"Opgegeven adres '$addressipv4tunnel' op tunnel-apparaat '$device' is reeds "
"geconfigureerd op apparaat '$devnew'"

#: /etc/rc.d/init.d/iceccd:32
msgid "Starting distributed compiler daemon: "
msgstr "Starten van distributed compiler daemon: "

#: /etc/rc.d/init.d/qemu:54
msgid "Unregistering binary handler for qemu applications"
msgstr "De-registreren van binaire verwerker voor qemu applicaties"

#: /etc/sysconfig/network-scripts/ifup-sl:44
msgid "/etc/sysconfig/network-scripts/dip-$DEVICE does not exist"
msgstr "/etc/sysconfig/network-scripts/dip-$DEVICE bestaat niet"

#: /etc/rc.d/init.d/tetrinetx:34
msgid "Starting $display_name: "
msgstr "Starten van $display_name: "

#: /etc/rc.d/init.d/oki4daemon:55
msgid "Reloading oki4daemon: "
msgstr "Herladen van oki4daemon: "

#: /etc/rc.d/init.d/zvbid:23
msgid "Starting vbi proxy daemon: "
msgstr "Starten van vbi proxy daemon: "

#: /etc/sysconfig/network-scripts/ifdown-sit:40
#: /etc/sysconfig/network-scripts/ifup-sit:58
msgid ""
"Device '$DEVICE' isn't supported here, use IPV6_AUTOTUNNEL setting and "
"restart (IPv6) networking"
msgstr ""
"Netwerkkaart '$DEVICE' wordt hier niet ondersteund, gebruik de "
"IPV6_AUTOTUNNEL instelling en herstart het (IPv6) netwerk"

#: /etc/rc.d/init.d/yum-cron:22
msgid "Enabling nightly yum update: "
msgstr "Aanzetten van nachtelijke yum update: "

#: /etc/rc.d/init.d/apt:75 /etc/rc.d/init.d/denyhosts:173
#: /etc/rc.d/init.d/incrond:58 /etc/rc.d/init.d/memcached:83
#: /etc/rc.d/init.d/mogilefsd:57 /etc/rc.d/init.d/mogstored:57
#: /etc/rc.d/init.d/pdns-recursor:58 /etc/rc.d/init.d/perlbal:58
#: /etc/rc.d/init.d/pound:58 /etc/rc.d/init.d/rwalld:90
#: /etc/rc.d/init.d/rwhod:90 /etc/rc.d/init.d/smolt:73
#: /etc/rc.d/init.d/supervisord:59 /etc/rc.d/init.d/uuidd:71
#: /etc/rc.d/init.d/yum-cron:65 /etc/rc.d/init.d/yum-updatesd:71
msgid "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|reload|force-reload|condrestart}"

#: /etc/rc.d/init.d/postfix:90
msgid "Reloading postfix: "
msgstr "Herladen van postfix: "

#: /etc/rc.d/init.d/autofs:128
msgid "Reloading maps"
msgstr "Herladen van maps"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:867
msgid "Missing parameter 'IPv4 address' (arg 1)"
msgstr "Parameter 'IPv4-address' (arg 1) ontbreekt"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1538
msgid "Pidfile '$pidfile' is empty, cannot send trigger to radvd"
msgstr ""
"Pid-bestand '$pidfile' is leeg, kan de 'trigger' niet naar radvd sturen"

#: /etc/rc.d/init.d/openct:34
msgid "Initializing OpenCT smart card terminals: "
msgstr "Initialiseren van OpenCT smart card terminals: "

#: /etc/rc.d/init.d/hddtemp:36
msgid "Unconfigured: $prog, see /etc/sysconfig/hddtemp: "
msgstr "Niet-geconfigureerd: $prog, zie /etc/sysconfig/hddtemp: "

#: /etc/rc.d/init.d/netplugd:30
msgid "Starting network plug daemon: "
msgstr "Starten van network plug daemon: "

#: /etc/rc.d/init.d/iptables:246
msgid "${IPTABLES}: Saving firewall rules to $IPTABLES_DATA: "
msgstr "${IPTABLES}: Opslaan van firewall regels naar $IPTABLES_DATA: "

#: /etc/rc.d/init.d/network:288
msgid "Currently active devices:"
msgstr "Actieve netwerkkaarten op dit moment:"

#: /etc/rc.d/init.d/NetworkManager:46
msgid "Setting network parameters... "
msgstr "Instellen van netwerkparameters... "

#: /etc/rc.d/init.d/iceccd:66
msgid "Stopping distributed compiler daemon: "
msgstr "Stoppen van distributed compiler daemon: "

#: /etc/rc.d/init.d/condor:40
msgid "Starting Condor daemons: "
msgstr "Starten van Condor daemons: "

#: /etc/rc.d/init.d/util-vserver:99
msgid "Path to vshelper has been set"
msgstr "Pad naar vshelper is ingesteld"

#: /etc/rc.d/init.d/lighttpd:91 /etc/rc.d/init.d/oddjobd:102
#: /etc/rc.d/init.d/postgrey:81
msgid "Usage: $0 {start|stop|restart|condrestart|reload|status}"
msgstr "Gebruik: $0 {start|stop|restart|condrestart|reload|status}"

#: /etc/rc.d/init.d/sec:85
msgid "Usage: $0 {start|stop|reload|restart|dump|status}"
msgstr "Gebruik: $0 {start|stop|reload|restart|dump|status}"

#: /etc/rc.d/init.d/wesnothd:65
msgid "Stopping Wesnoth game server: "
msgstr "Stoppen van Wesnoth game server: "

#: /etc/rc.d/init.d/xenstored:53
msgid "Stopping xenstored daemon: "
msgstr "Stoppen van xenstored daemon: "

#: /etc/rc.d/init.d/rpcsvcgssd:86
msgid "Shutting down RPC svcgssd: "
msgstr "Stoppen van RPC-svcgssd: "

#: /etc/rc.d/init.d/smartd:81
msgid "Checking SMART devices now: "
msgstr "Controleren van SMART-apparaten: "

#: /etc/rc.d/init.d/monotone:216
msgid "Importing packets to monotone database: "
msgstr "Importeren van packets naar monotone database: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:707
#: /etc/sysconfig/network-scripts/network-functions-ipv6:761
msgid "Parameter '$modequiet' for 'quiet' mode is not valid (arg 2)"
msgstr "Parameter '$modequiet' voor 'quiet' modus is ongeldig (arg 2)"

#: /etc/rc.d/init.d/tinyerp-server:86
msgid "$prog is running..."
msgstr "$prog is gestart..."

#: /etc/sysconfig/network-scripts/ifup-ippp:55
#: /etc/sysconfig/network-scripts/ifup-isdn:55
msgid "$*"
msgstr "$*"

#: /etc/rc.d/init.d/puppetmaster:56
msgid "Manifest does not exist: $PUPPETMASTER_MANIFEST"
msgstr "Manifest bestaat niet: $PUPPETMASTER_MANIFEST"

#: /etc/rc.d/init.d/mldonkey:64
msgid "Mldonkey (mlnet) is stopped"
msgstr "Mldonkey (mlnet) is gestopt"

#: /etc/rc.d/init.d/bgpd:34 /etc/rc.d/init.d/cachefilesd:43
#: /etc/rc.d/init.d/fsniper:28 /etc/rc.d/init.d/ospf6d:33
#: /etc/rc.d/init.d/ospfd:33 /etc/rc.d/init.d/radvd:47
#: /etc/rc.d/init.d/remotetrx:26 /etc/rc.d/init.d/ripd:33
#: /etc/rc.d/init.d/ripngd:33 /etc/rc.d/init.d/svxlink:26
#: /etc/rc.d/init.d/xttpd:27 /etc/rc.d/init.d/zebra:30
msgid "Starting $PROG: "
msgstr "Starten van $PROG: "

#: /etc/rc.d/init.d/dc_client:74 /etc/rc.d/init.d/dc_server:70
#: /etc/rc.d/init.d/openser:62 /etc/rc.d/init.d/rtpproxy:67
#: /etc/rc.d/init.d/ser:93
msgid "Usage: $prog {start|stop|restart|condrestart|status|help}"
msgstr "Gebruik: $prog {start|stop|restart|condrestart|status|help}"

#: /etc/rc.d/init.d/icecast:30
msgid "Shutting down icecast streaming daemon: "
msgstr "Stoppen van icecast streaming daemon: "

#: /etc/sysconfig/network-scripts/ifup-aliases:344
msgid "error in $FILE: IPADDR_START greater than IPADDR_END"
msgstr "fout in $FILE: IPADDR_START groter dan IPADDR_END"

#: /etc/rc.d/init.d/netfs:86 /etc/rc.d/rc.sysinit:597
msgid "(Repair filesystem)"
msgstr "(Herstel bestandssysteem)"

#: /etc/rc.d/init.d/thttpd:84
msgid "Usage: thttpd {start|stop|status|restart|condrestart|nicestop}"
msgstr "Gebruik: thttpd {start|stop|status|restart|condrestart|nicestop}"

#: /etc/rc.d/init.d/httpd:77
msgid "not reloading $httpd due to configuration syntax error"
msgstr "niet herladen van $httpd in verband met een configuratie syntaxisfout"

#: /etc/rc.d/init.d/netbsd-iscsi:57 /etc/rc.d/init.d/nighthttpd:49
msgid "Stopping $SERVICE:"
msgstr "Stoppen van $SERVICE:"

#: /etc/rc.d/init.d/lirc:71
msgid "Starting infrared remote control mouse daemon ($prog2): "
msgstr "Starten van infrared remote control mouse daemon ($prog2): "

#: /etc/rc.d/init.d/ypserv:30
msgid "Setting NIS domain name $NISDOMAIN: "
msgstr "Instellen van NIS-domeinnaam $NISDOMAIN: "

#: /etc/rc.d/init.d/fb-server:25
msgid "Starting Frozen Bubble server(s): "
msgstr "Starten van Frozen Bubble server(s): "

#: /etc/rc.d/init.d/and:36
msgid "Starting auto nice daemon:"
msgstr "Starten van auto nice daemon:"

#: /etc/rc.d/init.d/monotone:200
msgid "Checking database format in"
msgstr "Controleren van database-formaat in"

#: /etc/rc.d/init.d/cyrus-imapd:82
msgid "Importing $BASENAME databases: "
msgstr "Importeren van $BASENAME databases: "

#: /etc/rc.d/init.d/imapproxy:43
msgid "Shutting down up-imapproxy daemon: "
msgstr "Stoppen van up-imapproxy daemon: "

#: /etc/rc.d/init.d/tcsd:88
msgid "Loading drivers"
msgstr "Laden van stuurprogramma's"

#: /etc/rc.d/init.d/sshd:222
msgid ""
"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|"
"status}"
msgstr ""
"Gebruik: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|"
"status}"

#: /etc/rc.d/init.d/systemtap:62
msgid "Options:"
msgstr "Opties:"

#: /etc/rc.d/init.d/monotone:219 /etc/rc.d/init.d/monotone:220
msgid "packet import"
msgstr "importeren van packet"

#: /etc/rc.d/init.d/avahi-dnsconfd:85
msgid "Avahi DNS daemon is not running"
msgstr "Avahi DNS-daemon is niet gestart"

#: /etc/rc.d/init.d/cyphesis:106
msgid "Populating cyphesis world: "
msgstr "Bevolken van cyphesis wereld: "

#: /etc/rc.d/init.d/monotone:156
msgid "To lose old key remove file"
msgstr ""

#: /etc/rc.d/init.d/tor:65
msgid "program is dead and /var/run pid file exists"
msgstr "programma is afgesloten en /var/run pid-bestand bestaat"

#: /etc/sysconfig/network-scripts/ifup-sl:32
msgid "/usr/sbin/dip does not exist or is not executable"
msgstr "/usr/sbin/dip bestaat niet of is niet uitvoerbaar"

#: /etc/rc.d/init.d/bluetooth:21
msgid "Starting Bluetooth services:"
msgstr "Starten van Bluetooth services:"

#: /etc/rc.d/init.d/clamd-wrapper:9
msgid "*** Please see /usr/share/doc/clamav-server-*/README how"
msgstr "*** Zie /usr/share/doc/clamav-server-*/README"

#: /etc/rc.d/init.d/systemtap:63
msgid "\t-c configfile\t: specify config file"
msgstr ""

#: /etc/rc.d/init.d/btseed:34
msgid "Starting BitTorrent seed client: "
msgstr "Starten van BitTorrent seed client: "

#: /etc/rc.d/init.d/rsyslog:96
msgid "Usage: $0 {start|stop|restart|reload|force-reload|condrestart}"
msgstr "Gebruik: $0 {start|stop|restart|reload|force-reload|condrestart}"

#: /etc/rc.d/init.d/qemu:98
msgid "Usage: $prog {start|stop|status|restart|condrestart}"
msgstr "Gebruik: $prog {start|stop|status|restart|condrestart}"

#: /etc/rc.d/init.d/clvmd:145 /etc/rc.d/init.d/kannel:118
#: /etc/rc.d/init.d/olpc-configure:292
msgid "Usage: $0 {start|stop|restart|status}"
msgstr "Gebruik: $0 {start|stop|restart|status}"

#: /etc/rc.d/init.d/innd:56
msgid "Stopping INND service (gently): "
msgstr "Stoppen van INND-service (zachtjes): "

#: /etc/rc.d/init.d/rpcidmapd:72
msgid "Stopping RPC idmapd: "
msgstr "Stoppen van RPC-idmapd: "

# user is niet in het bezit van file
#: /etc/rc.d/init.d/ldap:127 /etc/rc.d/init.d/ldap:133
msgid "$file is not readable by \"$user\""
msgstr "$file is niet leesbaar door \"$user\""

#: /etc/rc.d/init.d/icecc-scheduler:49
msgid "Stopping distributed compiler scheduler: "
msgstr "Stoppen van distributed compiler scheduler: "

#: /etc/rc.d/init.d/avahi-daemon:55 /etc/rc.d/init.d/avahi-dnsconfd:52
#: /etc/rc.d/init.d/functions:303 /etc/rc.d/init.d/functions:319
#: /etc/rc.d/init.d/tclhttpd:116 /etc/rc.d/init.d/tclhttpd:127
msgid "$base shutdown"
msgstr "$base is gestopt"

#: /etc/rc.d/init.d/honeyd:70
msgid "Stopping $prog2: "
msgstr "Stoppen van $prog2: "

#: /etc/rc.d/init.d/postgresql:164
msgid "An old version of the database format was found."
msgstr "Een oude formaat versie van de database was gevonden."

#: /etc/rc.d/init.d/pcscd:47
msgid "Starting PC/SC smart card daemon ($prog): "
msgstr "Starten van PC/SC smart card daemon ($prog): "

#: /etc/rc.d/init.d/ngircd:74
msgid "Usage: $prog {start|stop|restart|reload|condrestart|status|help}"
msgstr "Gebruik: $prog {start|stop|restart|reload|condrestart|status|help}"

#: /etc/rc.d/init.d/netconsole:112
msgid "netconsole module not loaded"
msgstr "netconsole module is niet geladen"

#: /etc/rc.d/init.d/qpidd:66
msgid "Stopping Qpid AMQP daemon: "
msgstr "Stoppen van Qpid AMQP daemon: "

#: /etc/rc.d/init.d/ip6tables:31
msgid "${IP6TABLES}: /sbin/$IP6TABLES does not exist."
msgstr "${IP6TABLES}: /sbin/$IP6TABLES bestaat niet."

#: /etc/rc.d/init.d/nfslock:128
msgid "Usage: $0 {start|stop|status|restart|probe|condrestart|condstop}"
msgstr "Gebruik: $0 {start|stop|status|restart|probe|condrestart|condstop}"

#: /etc/rc.d/init.d/mt-daapd:19
msgid "Starting DAAP server: "
msgstr "Starten van DAAP server: "

#: /etc/rc.d/init.d/mogilefsd:20 /etc/rc.d/init.d/mogstored:20
msgid "Starting MogileFS tracker daemon: "
msgstr "Starten van MogileFS tracker daemon: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1483
msgid "No reason given for sending trigger to radvd"
msgstr "Geen reden opgegeven voor het verzenden van de 'trigger' naar radvd"

#: /etc/rc.d/init.d/apt:70
msgid "Nightly apt update is disabled."
msgstr "Nachtelijke apt update is uitgezet."

#: /etc/rc.d/init.d/openct:44
msgid "Stopping OpenCT smart card terminals: "
msgstr "Stoppen van OpenCT smart card terminals: "

#: /etc/rc.d/init.d/funcd:76
#, fuzzy
msgid "Starting func daemon: "
msgstr "Starten van xend daemon: "

#: /etc/rc.d/init.d/arptables_jf:90
msgid "Applying arptables firewall rules: "
msgstr "Toepassen van arptables firewall regels: "

#: /etc/sysconfig/network-scripts/ifdown-tunnel:36
#: /etc/sysconfig/network-scripts/ifup-tunnel:56
msgid "Device '$DEVICE' isn't supported as a valid GRE device name."
msgstr ""
"Apparaat '$DEVICE' is niet als een geldige GRE-apparaatnaam ondersteund."

#: /etc/rc.d/init.d/microcode_ctl:96
msgid "Usage: $0 {start|stop|restart}"
msgstr "Gebruik: $0 {start|stop|restart}"

#: /etc/rc.d/init.d/cyrus-imapd:111
msgid "Exporting $BASENAME databases: "
msgstr "Exporteren van $BASENAME databases: "

#: /etc/rc.d/init.d/rwhod:39
msgid "Starting rwho services: "
msgstr "Starten van rwho services: "

#: /etc/rc.d/init.d/acpid:60
msgid "Stopping acpi daemon: "
msgstr "Stoppen van acpi-daemon: "

#: /etc/rc.d/init.d/functions:123
msgid "Unmounting loopback filesystems: "
msgstr "Afkoppelen van loopback-bestandssystemen: "

#: /etc/rc.d/init.d/ipmi:548
msgid "          stop-all|status-all}"
msgstr "          stop-all|status-all}"

#: /etc/rc.d/init.d/ip6tables:98
msgid "${IP6TABLES}: Flushing firewall rules: "
msgstr "${IP6TABLES}: Wissen van firewall regels: "

#: /etc/rc.d/init.d/util-vserver:64
msgid "Loading default device map"
msgstr "Laden van standaard device map"

#: /etc/rc.d/init.d/condor:209
msgid "$prog dead but pid file exists"
msgstr "$prog afgesloten, maar pid-bestand bestaat nog"

#: /etc/rc.d/init.d/tclhttpd:60
msgid "$base is stopped"
msgstr "$base is gestopt"

#: /etc/sysconfig/network-scripts/ifup-aliases:182
msgid "error in $FILE: already seen ipaddr $IPADDR in $ipseen"
msgstr "fout in $FILE: $IPADDR reeds gezien in $ipseen"

#: /etc/rc.d/init.d/shorewall:66 /etc/rc.d/init.d/shorewall6:66
#: /etc/rc.d/init.d/shorewall6-lite:66 /etc/rc.d/init.d/shorewall-lite:66
#, fuzzy
msgid "Restarting Shorewall: "
msgstr "Herstarten van $prog: "

#: /etc/sysconfig/network-scripts/ifup-sl:35
msgid "/usr/sbin/dip does not exist or is not executable for $DEVICE"
msgstr "/usr/sbin/dip bestaat niet of is niet uitvoerbaar voor $DEVICE"

#: /etc/rc.d/init.d/gpm:91
msgid "Shutting down console mouse services: "
msgstr "Stoppen van console mouse services: "

#: /etc/rc.d/init.d/util-vserver:102
msgid "Path to vshelper has not been set"
msgstr "Pad naar vshelper is niet ingesteld"

#: /etc/rc.d/init.d/ser2net:37
msgid "Reloading ser2net: "
msgstr "Herladen van ser2net: "

#: /etc/rc.d/init.d/tog-pegasus:80
msgid "Shutting down CIM server: "
msgstr "Stoppen van CIM-server: "

#: /etc/rc.d/init.d/gkrellmd:28
msgid "Starting GNU Krell Monitors server ($prog): "
msgstr "Starten van GNU Krell Monitors server ($prog): "

#: /etc/rc.d/init.d/nfslock:80
msgid "Stopping NFS statd: "
msgstr "Stoppen van NFS-statd: "

#: /etc/rc.d/init.d/monotone:159
msgid "Generating RSA key for server $MONOTONE_KEYID"
msgstr "Genereren van RSA-sleutel voor server $MONOTONE_KEYID"

#: /etc/rc.d/init.d/spamass-milter:52
msgid "Starting ${desc} (${prog}): "
msgstr "Starten van ${desc} (${prog}): "

#: /etc/rc.d/init.d/tog-pegasus:97
msgid "CIM server ($pid) is running"
msgstr "CIM-server ($pid) is gestart"

#: /etc/rc.d/init.d/iscsi:56 /etc/rc.d/init.d/iscsi:61
#: /etc/rc.d/init.d/isdn:178 /etc/rc.d/init.d/isdn:181
#: /etc/rc.d/init.d/speech-dispatcherd:23
msgid "Starting $prog"
msgstr "Starten van $prog"

#: /etc/rc.d/init.d/pdns-recursor:21
msgid "Starting pdns-recursor: "
msgstr "Starten van pdns-recursor: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1371
msgid ""
"Given IPv6 default gateway '$address' has scope '$device_scope' defined, "
"given default gateway device '$device' will be not used"
msgstr ""
"Opgegeven IPv6 standaard gateway '$address' heeft een gedefinieerd bereik "
"'$device_scope', opgegeven standaard gateway-apparaat '$device' zal niet "
"worden gebruikt"

#: /etc/rc.d/init.d/crossfire:31
msgid "Starting Crossfire game server: "
msgstr "Starten van Crossfire game server: "

#: /etc/sysconfig/network-scripts/ifup-aliases:192
msgid "error in $FILE: didn't specify device or ipaddr"
msgstr "fout in $FILE: geen netwerkkaart of IP-adres opgegeven"

#: /etc/rc.d/init.d/wine:37
msgid "Unregistering binary handler for Windows applications: "
msgstr "De-registreren van binaire verwerker voor Windows applicaties: "

#: /etc/rc.d/init.d/telescoped:38
#, fuzzy
msgid "Shutting down telescope daemon: "
msgstr "Stoppen van auto nice daemon:"

#: /etc/rc.d/rc.sysinit:214
msgid "$dst: LUKS requires non-random key, skipping"
msgstr "$dst: LUKS vereist niet-willekeurige sleutel, wordt overgeslagen"

#: /usr/sbin/sys-unconfig:6
msgid "Usage: sys-unconfig"
msgstr "Gebruik: sys-unconfig"

#: /etc/rc.d/init.d/smolt:65
msgid "Monthly smolt check-in is enabled."
msgstr "Maandelijkse smolt check-in is aangezet."

#: /etc/ppp/ip-up.ipv6to4:87 /etc/sysconfig/network-scripts/ifup-ipv6:205
msgid "Given IPv4 address '$ipv4addr' is not globally usable"
msgstr "Opgegeven IPv4-adres '$ipv4addr' is niet globaal bruikbaar"

#: /etc/rc.d/init.d/monotone:192 /etc/rc.d/init.d/monotone:193
msgid "move passphrase file"
msgstr "verplaats passphrase-bestand"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1134
msgid "Tunnel device '$device' bringing up didn't work"
msgstr "Aanzetten van tunnel-apparaat '$device' is mislukt"

#: /etc/rc.d/init.d/keepalived:73
#, fuzzy
msgid "Service $prog not running."
msgstr "$prog is niet gestart"

#: /etc/rc.d/init.d/sgemaster:298
msgid "Starting sge_shadowd: "
msgstr "Starten van sge_shadowd: "

#: /etc/rc.d/init.d/monotone:138
msgid "Initializing database"
msgstr "Initialiseren van database"

#: /etc/rc.d/init.d/aiccu:75 /etc/rc.d/init.d/nmb:52 /etc/rc.d/init.d/smb:52
#: /etc/rc.d/init.d/winbind:43
msgid "Shutting down $KIND services: "
msgstr "Stoppen van $KIND services: "

#: /etc/rc.d/init.d/ocspd:64
#, fuzzy
msgid "Shutting down ${prog}: "
msgstr "Stoppen van $prog: "

#: /etc/rc.d/init.d/rarpd:91
msgid "Usage: $0 {start|stop|restart|condrestart|reload|status|force-reload}"
msgstr ""
"Gebruik: $0 {start|stop|restart|condrestart|reload|status|force-reload}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:181
msgid "Kernel is not compiled with IPv6 support"
msgstr "Kernel is niet gecompileerd met ondersteuning voor IPv6"

#: /etc/rc.d/init.d/fsniper:36 /etc/rc.d/init.d/radvd:54
#: /etc/rc.d/init.d/xttpd:56
msgid "Stopping $PROG: "
msgstr "Stoppen van $PROG: "

#: /etc/rc.d/init.d/arptables_jf:127
msgid "Resetting built-in chains to the default ACCEPT policy:"
msgstr ""
"Herinstellen van de ingebouwde regels naar het standaard ACCEPT beleid:"

#: /etc/rc.d/init.d/vdr:63
msgid "Stopping Video Disk Recorder ($prog): "
msgstr "Stoppen van Video Disk Recorder ($prog): "

#: /etc/rc.d/init.d/functions:520
msgid "Start service $1 (Y)es/(N)o/(C)ontinue? [Y] "
msgstr "Start service $1 (J)a/(N)ee/(D)oorgaan? [J] "

#: /etc/rc.d/init.d/systemtap:485
msgid "no scripts exist."
msgstr ""

#: /etc/rc.d/init.d/radiusd:56
msgid "Reloading RADIUS server: "
msgstr "Herladen van RADIUS server: "

#: /etc/rc.d/init.d/systemtap:606
#, fuzzy
msgid "Cleaning up $prog: "
msgstr "Starten van $prog: "

#: /etc/rc.d/init.d/bttrack:47
msgid "Shutting down BitTorrent tracker: "
msgstr "Stoppen van BitTorrent tracker: "

#: /etc/rc.d/rc.sysinit:567
msgid "Checking filesystems"
msgstr "Controleren van bestandssystemen"

#: /etc/rc.d/init.d/netconsole:91
msgid "Initializing netconsole"
msgstr "Initialiseren van netconsole"

#: /etc/rc.d/init.d/functions:261
msgid "Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]"
msgstr ""
"Gebruik: killproc [-p pid-bestand] [ -d vertraging] {programma} [-signaal]"

#: /etc/rc.d/init.d/nsd:43
msgid "Starting nsd:"
msgstr "Starten van nsd:"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1422
msgid "Given IPv6 default device '$device' doesn't exist or isn't up"
msgstr ""
"Opgegeven IPv6 standaardapparaat '$device' bestaat niet of staat niet aan"

#: /etc/rc.d/init.d/multipathd:27
msgid "Starting $prog daemon: "
msgstr "Starten van $prog daemon: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1234
msgid "Unsupported selection '$selection' specified (arg 2)"
msgstr "Niet-ondersteunde selectie '$selection' opgegeven (arg 2)"

#: /etc/rc.d/init.d/radiusd:37
msgid "Starting RADIUS server: "
msgstr "Starten van RADIUS server: "

#: /etc/rc.d/init.d/netfs:83 /etc/rc.d/rc.sysinit:594
msgid "*** Dropping you to a shell; the system will reboot"
msgstr "*** U komt terecht in een shell, het systeem wordt herstart"

#: /etc/rc.d/init.d/supervisord:22
msgid "Starting supervisord: "
msgstr "Starten van supervisord: "

#: /etc/rc.d/init.d/condor:211 /etc/rc.d/init.d/tinyerp-server:88
#: /etc/rc.d/init.d/tinyerp-server:91
msgid "$prog is stopped"
msgstr "$prog is gestopt"

#: /etc/rc.d/init.d/httpd:115
msgid ""
"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|"
"graceful|help|configtest}"
msgstr ""
"Gebruik: $prog {start|stop|restart|condrestart|reload|status|fullstatus|"
"graceful|help|configtest}"

#: /etc/rc.d/init.d/pgbouncer:44 /etc/rc.d/init.d/pgpool:66
#: /etc/rc.d/init.d/postgresql:128 /etc/rc.d/init.d/sepostgresql:46
msgid "Starting ${NAME} service: "
msgstr "Starten van ${NAME} service: "

#: /etc/rc.d/init.d/maradns:86
#, fuzzy
msgid "Stopping MaraDNS: "
msgstr "Stoppen van Perlbal: "

#: /etc/rc.d/rc.sysinit:187
msgid "$dst: no value for size option, skipping"
msgstr "$dst: geen waarde voor grootte-optie, wordt overgeslagen"

#: /etc/ppp/ip-down.ipv6to4:35 /etc/ppp/ip-up.ipv6to4:41
msgid ""
"Argument 1 is empty but should contain interface name - skip IPv6to4 "
"initialization"
msgstr ""
"Argument 1 is leeg maar zou de naam van de interface moeten bevatten - de "
"IPv6to4 initialisatie wordt overgeslagen"

#: /etc/rc.d/init.d/vdr:43
msgid "Use \"scandvb -o vdr\" from the dvb-apps package to create one."
msgstr ""
"Gebruik \"scandvb -o vdr\" uit het dvb-apps pakket om er een aan te maken."

#: /etc/rc.d/init.d/netfs:149
msgid "Active CIFS mountpoints: "
msgstr "Actieve CIFS-koppelpunten: "

#: /etc/rc.d/init.d/dropbear:51 /etc/rc.d/init.d/dropbear:54
msgid "DSS key generation"
msgstr "DSS-sleutel genereren"

#: /etc/rc.d/init.d/nscd:59 /etc/rc.d/init.d/nscd:61
msgid "$prog shutdown"
msgstr "$prog is gestopt"

#: /etc/rc.d/init.d/sshd:70
msgid "Generating SSH2 RSA host key: "
msgstr "Genereren van SSH2 RSA host-sleutel: "

#: /etc/sysconfig/network-scripts/ifup-eth:264
#: /etc/sysconfig/network-scripts/ifup-ib:235
msgid "Error adding address ${IPADDR} for ${DEVICE}."
msgstr "Fout bij toekennen adres ${IPADDR} aan ${DEVICE}."

#: /etc/rc.d/init.d/ipmi:245
msgid "Stopping ipmi_watchdog driver: "
msgstr "Stoppen van ipmi_watchdog driver: "

#: /etc/rc.d/init.d/innd:44
msgid "Starting INND system: "
msgstr "Starten van INND-systeem: "

#: /etc/rc.d/init.d/rbldnsd:143
msgid "is stopped"
msgstr "is gestopt"

#: /etc/rc.d/init.d/snake-server:32
#, fuzzy
msgid "Starting snake-server:"
msgstr "Starten van Wesnoth game server: "

#: /etc/rc.d/init.d/arptables_jf:159 /etc/rc.d/init.d/ip6tables:303
#: /etc/rc.d/init.d/iptables:303
msgid "Table: $table"
msgstr "Tabel: $table"

#: /etc/rc.d/init.d/util-vserver:57
msgid "Creating required directories"
msgstr "Aanmaken van vereiste directories"

#: /etc/rc.d/init.d/avahi-dnsconfd:59
msgid "Reloading Avahi DNS daemon... "
msgstr "Herladen van Avahi DNS-daemon... "

#: /etc/rc.d/init.d/ctdb:98
#, fuzzy
msgid "Starting ctdbd service: "
msgstr "Starten van NIS-service: "

#: /etc/rc.d/init.d/apt:67
msgid "Nightly apt update is enabled."
msgstr "Nachtelijke apt update is aangezet."

#: /etc/rc.d/init.d/cfenvd:35
msgid "Stopping GNU cfengine environmental history daemon: "
msgstr "Stoppen van GNU cfengine environmental history daemon: "

#: /etc/rc.d/init.d/postgresql:238 /etc/rc.d/init.d/sepostgresql:151
msgid "Initializing database: "
msgstr "Initialiseren van database: "

#: /etc/rc.d/init.d/abrt:39
#, fuzzy
msgid "Starting abrt daemon: "
msgstr "Starten van acpi-daemon: "

#: /etc/rc.d/init.d/cyphesis:49
msgid "Creating PostgreSQL account: "
msgstr "Aanmaken van PostgreSQL account: "

#: /etc/rc.d/init.d/nginx:107
msgid ""
"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-"
"reload|configtest}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-"
"reload|configtest}"

#: /etc/rc.d/init.d/nfs:172 /etc/rc.d/init.d/nfslock:111
msgid "restart"
msgstr "herstart"

#: /etc/rc.d/init.d/exim:43
msgid "Starting exim: "
msgstr "Starten van exim: "

#: /etc/rc.d/init.d/network:85
msgid "Setting 802.1Q VLAN parameters: "
msgstr "Instellen van 802.1Q VLAN-parameters: "

#: /etc/rc.d/init.d/pgpool:165
msgid ""
"Usage: $0 {start|stop|switch|status|restart|condrestart|condstop|reload|"
"force-reload}"
msgstr ""
"Gebruik: $0 {start|stop|switch|status|restart|condrestart|condstop|reload|"
"force-reload}"

#: /etc/rc.d/init.d/systemtap:572
msgid "$s is dead, but another script is running."
msgstr ""

#: /etc/sysconfig/network-scripts/ifup-eth:259
#: /etc/sysconfig/network-scripts/ifup-ib:230
msgid "Error, some other host already uses address ${IPADDR}."
msgstr "Fout, een andere host gebruikt reeds adres ${IPADDR}."

#: /etc/rc.d/init.d/nfs:141 /etc/rc.d/init.d/nfs:143
msgid "Shutting down NFS services: "
msgstr "Stoppen van NFS-services: "

#: /etc/rc.d/init.d/monotone:119
msgid "Stopping monotone server: "
msgstr "Stoppen van monotone server: "

#: /etc/rc.d/init.d/netfs:133
msgid "Configured NCP mountpoints: "
msgstr "Geconfigureerde NCP-koppelpunten: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:682
msgid "Cannot delete IPv6 address '$address' on dev '$device'"
msgstr "Kan IPv6-adres '$address' niet verwijderen op apparaat '$device'"

#: /etc/rc.d/init.d/ups:39
msgid "Starting UPS driver controller: "
msgstr "Starten van UPS-driver controller: "

#: /etc/rc.d/init.d/puppetmaster:88
msgid "Generate configuration puppetmaster: "
msgstr "Genereren van puppetmaster configuratie: "

#: /etc/sysconfig/network-scripts/ifdown-eth:53
#: /etc/sysconfig/network-scripts/ifdown-eth:59
msgid ""
"Device ${DEVICE} has MAC address ${FOUNDMACADDR}, instead of configured "
"address ${HWADDR}. Ignoring."
msgstr ""
"Netwerkkaart ${DEVICE} heeft MAC-adres ${FOUNDMACADDR}, in plaats van "
"geconfigureerd adres ${HWADDR}. Negeren."

#: /etc/rc.d/init.d/functions:432
msgid "FAILED"
msgstr "MISLUKT"

#: /etc/rc.d/rc.sysinit:180
msgid "$dst: no value for cipher option, skipping"
msgstr "$dst: geen waarde voor cipher-optie, wordt overgeslagen"

#: /etc/rc.d/init.d/avahi-daemon:52
msgid "Shutting down Avahi daemon: "
msgstr "Stoppen van Avahi daemon: "

#: /etc/rc.d/init.d/aiccu:65 /etc/rc.d/init.d/nmb:41 /etc/rc.d/init.d/smb:41
#: /etc/rc.d/init.d/winbind:32
msgid "Starting $KIND services: "
msgstr "Starten van $KIND services: "

#: /etc/sysconfig/network-scripts/ifup-aliases:172
msgid "error in $FILE: invalid alias number"
msgstr "fout in $FILE: ongeldig alias-nummer"

#: /etc/rc.d/init.d/cyrus-imapd:118
msgid ""
"$BASENAME error exporting databases, check ${CONFIGDIRECTORY}/rpm/db_export."
"log"
msgstr ""
"$BASENAME fout bij het exporteren van databases, controleer "
"${CONFIGDIRECTORY}/rpm/db_export.log"

#: /etc/rc.d/init.d/tor:64
msgid "$prog is running"
msgstr "$prog is gestart"

#: /etc/rc.d/init.d/vblade:35
msgid "Starting up $prog: "
msgstr "Starten van $prog: "

#: /etc/rc.d/init.d/libvirtd:81
msgid "Reloading $SERVICE configuration: "
msgstr "Herladen van $SERVICE configuratie: "

#: /etc/rc.d/init.d/iptables:98
msgid "${IPTABLES}: Flushing firewall rules: "
msgstr "${IPTABLES}: Wissen van firewall regels: "

#: /etc/rc.d/init.d/certmaster:123 /etc/rc.d/init.d/cgred:124
#: /etc/rc.d/init.d/cobblerd:109 /etc/rc.d/init.d/funcd:126
#: /etc/rc.d/init.d/libvirtd:105 /etc/rc.d/init.d/messagebus:89
#: /etc/rc.d/init.d/multipathd:78 /etc/rc.d/init.d/mydns:72
#: /etc/rc.d/init.d/preload:108 /etc/rc.d/init.d/smsd:88
#: /etc/rc.d/init.d/snmpd:111 /etc/rc.d/init.d/snmptrapd:100
#: /etc/rc.d/init.d/xinetd:146
msgid "Usage: $0 {start|stop|status|restart|condrestart|reload}"
msgstr "Gebruik: $0 {start|stop|status|restart|condrestart|reload}"

#: /etc/rc.d/init.d/clamd-wrapper:8
msgid "*** $0 can not be called in this way"
msgstr "*** $0 kan niet worden aangeroepen op deze manier"

#: /etc/rc.d/init.d/netconsole:109
msgid "netconsole module loaded"
msgstr "netconsole module is geladen"

#: /etc/rc.d/init.d/denyhosts:93
msgid "Denyhosts already running."
msgstr "Denyhosts reeds gestart."

#: /etc/rc.d/init.d/tor:69
msgid "status $rc of $prog"
msgstr "status $rc van $prog"

#: /etc/ppp/ip-up.ipv6to4:138 /etc/sysconfig/network-scripts/ifup-ipv6:247
msgid "Warning: interface 'tun6to4' does not support 'IPV6_DEFAULTGW', ignored"
msgstr ""
"Opgelet: interface 'tun6to4' ondersteund geen 'IPV6_DEFAULTGW'; genegeerd"

#: /etc/sysconfig/network-scripts/ifup-eth:74
#: /etc/sysconfig/network-scripts/ifup-ib:54
msgid "Device ${DEVICE} does not seem to be present, delaying initialization."
msgstr ""
"Apparaat ${DEVICE} is blijkbaar niet aanwezig, initialisatie uitgesteld."

#: /etc/rc.d/init.d/moodle:32
msgid "Enabling Moodle cron job: "
msgstr "Aanzetten van Moodle cron job: "

#: /etc/rc.d/init.d/cyrus-imapd:94
msgid "Starting $BASENAME: "
msgstr "Starten van $BASENAME: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:769
msgid "Given IPv4 address '$testipv4addr_valid' has no proper format"
msgstr ""
"Opgegeven IPv4-adres '$testipv4addr_valid' staat niet in het juiste formaat"

#: /etc/rc.d/init.d/NetworkManager:57
msgid "Waiting for network..."
msgstr "Wachten op het netwerk..."

#: /etc/rc.d/init.d/network:272
msgid "Disabling IPv4 automatic defragmentation: "
msgstr "Uitzetten van IPv4 automatische defragmentatie: "

#: /etc/rc.d/init.d/xttpd:29
msgid "$DAEMON is not set."
msgstr "$DAEMON is niet ingesteld."

#: /etc/rc.d/init.d/network:69
msgid "Bringing up loopback interface: "
msgstr "Starten van loopback interface: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:357
msgid "Unknown error"
msgstr "Onbekende fout"

#: /etc/rc.d/init.d/puppetmaster:41
msgid "Starting puppetmaster: "
msgstr "Starten van puppetmaster: "

#: /etc/rc.d/init.d/rbldnsd:136
msgid "dead but pid file exists"
msgstr "afgesloten, maar pid-bestand bestaat nog"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:507
msgid "Tunnel device 'sit0' is still up"
msgstr "Tunnel-apparaat 'sit0' staat nog aan"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:122
msgid "INFO     "
msgstr "INFO     "

#: /etc/rc.d/init.d/lirc:108
msgid "Reloading infrared remote control daemon ($prog): "
msgstr "Herladen van infrared remote control daemon ($prog): "

#: /etc/rc.d/init.d/monotone:188
msgid "Moving old server passphrase file to new location: "
msgstr "Verplaatsen van oud server passphrase-bestand naar nieuwe lokatie: "

#: /etc/rc.d/init.d/fail2ban:44
msgid "Stopping fail2ban: "
msgstr "Stoppen van fail2ban: "

#: /etc/rc.d/init.d/ip6tables:220
msgid "${IP6TABLES}: Unloading modules: "
msgstr "${IP6TABLES}: Verwijderen van modules: "

#: /etc/rc.d/init.d/rbldnsd:140
msgid "dead but subsys locked"
msgstr "afgesloten, maar subsysteem is vergrendeld"

#: /etc/rc.d/init.d/postfix:99
msgid "$prog abort"
msgstr "$prog afbreken"

#: /etc/rc.d/init.d/nfs:118
msgid "Shutting down NFS mountd: "
msgstr "Stoppen van NFS-mountd: "

#: /etc/rc.d/init.d/halt:160
msgid "On the next boot fsck will be forced."
msgstr "Bij het opnieuw opstarten zal fsck uitgevoerd worden."

#: /etc/rc.d/init.d/smolt:37
msgid "Disabling monthly Smolt update: "
msgstr "Uitzetten van maandelijkse Smolt update: "

#: /etc/rc.d/init.d/functions:454
msgid "WARNING"
msgstr "WAARSCHUWING"

#: /etc/rc.d/init.d/denyhosts:80
msgid "denyhosts cron service is disabled."
msgstr "denyhosts cron service is uitgezet."

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1328
msgid "Given IPv6 MTU '$ipv6_mtu' is out of range"
msgstr "Opgegeven IPv6-MTU '$ipv6_mtu' valt buiten het bereik"

#: /etc/rc.d/init.d/coda-client:79 /etc/rc.d/init.d/codasrv:79
msgid "$1 not available"
msgstr "$1 niet beschikbaar"

#: /etc/rc.d/init.d/sendmail:104
msgid "Shutting down sm-client: "
msgstr "Stoppen van sm-client: "

#: /etc/rc.d/init.d/certmaster:73
#, fuzzy
msgid "Starting certmaster daemon: "
msgstr "Starten van xenstored daemon: "

#: /etc/rc.d/init.d/gnokii-smsd:45
msgid "Stopping Gnokii SMS daemon ($prog): "
msgstr "Stoppen van Gnokii SMS-daemon ($prog): "

#: /etc/rc.d/init.d/amavisd:35
msgid "Starting ${prog_base}:"
msgstr "Starten van ${prog_base}:"

#: /etc/rc.d/init.d/openhpi-subagent:70
msgid "Starting up HPI SNMP sub-agent daemon: "
msgstr "Starten van HPI SNMP sub-agent daemon: "

#: /etc/rc.d/init.d/ctdb:241
msgid "Usage: $0 {start|stop|restart|status|cron|condrestart}"
msgstr "Gebruik: $0 {start|stop|restart|status|cron|condrestart}"

#: /etc/rc.d/init.d/wine:26
msgid "Registering binary handler for Windows applications: "
msgstr "Registreren van binaire verwerker voor Windows applicaties: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:192
msgid ""
"Utility 'ip' (package: iproute) doesn't exist or isn't executable - stop"
msgstr ""
"Programma 'ip' (pakket: iproute) bestaat niet of is niet uitvoerbaar - stop"

#: /etc/rc.d/init.d/gnokii-smsd:36
msgid "Starting Gnokii SMS daemon ($prog): "
msgstr "Starten van Gnokii SMS-daemon ($prog): "

#: /etc/rc.d/init.d/squid:174
msgid "Usage: $0 {start|stop|status|reload|restart|condrestart|probe}"
msgstr "Gebruik: $0 {start|stop|status|reload|restart|condrestart|probe}"

#: /etc/rc.d/init.d/cyrus-imapd:178
msgid ""
"Usage: $BASENAME {start|stop|restart|reload|condrestart|status|quickstart|"
"quickstop}"
msgstr ""
"Gebruik: $BASENAME {start|stop|restart|reload|condrestart|status|quickstart|"
"quickstop}"

#: /etc/rc.d/init.d/functions:421
msgid "  OK  "
msgstr "  OK  "

#: /etc/rc.d/init.d/network:285
msgid "Configured devices:"
msgstr "Geconfigureerde netwerkkaarten:"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:719
msgid "Given IPv6 address '$testipv6addr_valid' is not valid"
msgstr "Opgegeven IPv6-adres '$testipv6addr_valid' is niet geldig"

#: /etc/rc.d/init.d/radiusd:45
msgid "Stopping RADIUS server: "
msgstr "Stoppen van RADIUS server: "

#: /etc/rc.d/init.d/preload:67
msgid "Stopping preload daemon: "
msgstr "Stoppen van preload daemon: "

#: /etc/rc.d/init.d/autogroup:99 /etc/rc.d/init.d/autohome:99
msgid "Usage: $prog {start|stop|restart|reload|condrestart|status}"
msgstr "Gebruik: $prog {start|stop|restart|reload|condrestart|status}"

#: /etc/rc.d/init.d/rdisc:32
msgid "Starting router discovery: "
msgstr "Starten van router discovery: "

#: /etc/rc.d/init.d/netfs:95
msgid "Mounting other filesystems: "
msgstr "Aankoppelen van andere bestandssystemen: "

#: /etc/rc.d/init.d/microcode_ctl:37
msgid "Applying Intel CPU microcode update: "
msgstr "Toepassen van Intel CPU-microcode update: "

#: /etc/rc.d/init.d/qemu:68
msgid "qemu binary format handlers are registered."
msgstr "qemu binair formaat verwerkers zijn geregistreerd."

#: /etc/rc.d/init.d/mon:49 /etc/rc.d/init.d/partimaged:59
msgid "Reloading $desc ($prog): "
msgstr "Herladen van $desc ($prog): "

#: /etc/rc.d/init.d/moomps:42
msgid "Stopping moomps: "
msgstr "Stoppen van moomps: "

#: /etc/rc.d/init.d/auditd:163
msgid "Usage: $0 {start|stop|status|restart|condrestart|reload|rotate|resume}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|condrestart|reload|rotate|resume}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:962
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1019
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1058
msgid "Given device '$device' is not supported (arg 1)"
msgstr "Opgegeven apparaat '$device' is niet ondersteund (arg 1)"

#: /etc/rc.d/init.d/functions:352
msgid "Usage: pidofproc [-p pidfile] {program}"
msgstr "Gebruik: pidofproc [-p pid-bestand] {programma}"

#: /etc/rc.d/init.d/ntpdate:85
msgid "Usage: $0 {start|stop|status|restart|force-reload}"
msgstr "Gebruik: $0 {start|stop|status|restart|force-reload}"

#: /etc/rc.d/init.d/xend:34
msgid "Starting xend daemon: "
msgstr "Starten van xend daemon: "

#: /etc/rc.d/init.d/irda:35
msgid "irattach shutdown"
msgstr "irattach is gestopt"

#: /etc/rc.d/init.d/nfslock:75
msgid "Stopping NFS locking: "
msgstr "Stoppen van NFS-locking: "

#: /etc/rc.d/init.d/denyhosts:60
msgid "Disabling denyhosts cron service: "
msgstr "Uitzetten van denyhosts cron service: "

#: /etc/rc.d/init.d/canna:54
msgid "Restarting $prog: "
msgstr "Herstarten van $prog: "

#: /etc/rc.d/init.d/rstatd:87 /etc/rc.d/init.d/rusersd:88
msgid "Usage: $0 {start|stop|status|restart|reload|force-reload}"
msgstr "Gebruik: $0 {start|stop|status|restart|reload|force-reload}"

#: /etc/rc.d/init.d/wpa_supplicant:38
msgid "Starting $prog: $conf, $INTERFACES, $DRIVERS"
msgstr "Starten van $prog: $conf, $INTERFACES, $DRIVERS"

#: /etc/rc.d/init.d/hddtemp:49
msgid "Stopping hard disk temperature monitor daemon ($prog): "
msgstr "Stoppen van hard disk temperature monitor daemon ($prog): "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:278
msgid "Missing parameter 'forwarding control' (arg 1)"
msgstr "Parameter 'forwarding control' (arg 1) ontbreekt"

#: /etc/rc.d/init.d/irda:28
msgid "irattach startup"
msgstr "irattach is gestart"

#: /etc/rc.d/init.d/ocspd:40 /etc/rc.d/init.d/ucarp:31
msgid "Starting ${prog}: "
msgstr "Starten van ${prog}: "

#: /etc/rc.d/rc.sysinit:53
msgid "*** Run 'setenforce 1' to reenable."
msgstr "*** Voer 'setenforce 1' in om opnieuw aan te zetten."

#: /etc/sysconfig/network-scripts/ifup-ipv6:306
msgid "6to4 configuration is not valid"
msgstr "6to4 configuratie is niet geldig"

#: /etc/rc.d/init.d/ibmasm:61
msgid "Stopping ibmasm: "
msgstr "Stoppen van ibmasm: "

#: /etc/rc.d/init.d/ipmi:295 /etc/rc.d/init.d/ipmi:301
msgid "Starting ipmi_poweroff driver: "
msgstr "Starten van ipmi_poweroff driver: "

#: /etc/sysconfig/network-scripts/ifdown:33
#: /etc/sysconfig/network-scripts/ifup:49
msgid "Users cannot control this device."
msgstr "Gebruikers kunnen deze netwerkkaart niet beheren."

#: /etc/rc.d/init.d/ez-ipupdate:63
msgid "Shutting down $prog for $ez_name: "
msgstr "Stoppen van $prog voor $ez_name: "

#: /etc/rc.d/init.d/arptables_jf:99
msgid "Configuration file /etc/sysconfig/arptables missing"
msgstr "Configuratiebestand /etc/sysconfig/arptables ontbreekt"

#: /etc/rc.d/init.d/systemtap:491
msgid "Failed to make stat directory ($STAT_PATH)"
msgstr ""

#: /etc/rc.d/init.d/bandwidthd:44
#, fuzzy
msgid "Shuting down Bandwidthd network traffic monitor: "
msgstr "Stoppen van network plug daemon: "

#: /etc/sysconfig/network-scripts/ifup-sl:33
#: /etc/sysconfig/network-scripts/ifup-sl:45
msgid "ifup-sl for $DEVICE exiting"
msgstr "ifup-sl voor $DEVICE gestopt"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:116
msgid "WARN     "
msgstr "WAARSCHUWEN     "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:354
msgid ""
"'No route to host' adding route '$networkipv6' via gateway '$gatewayipv6' "
"through device '$device'"
msgstr ""
"'Geen route naar host' route '$networkipv6' wordt toegevoegd via gateway "
"'$gatewayipv6' op apparaat '$device'"

#: /etc/rc.d/init.d/cyphesis:77
msgid "Loading database with rules: "
msgstr "Laden van database met regels: "

#: /etc/rc.d/init.d/vncserver:80 /etc/rc.d/init.d/vncserver:81
msgid "vncserver shutdown"
msgstr "vncserver is gestopt"

#: /etc/rc.d/init.d/xenconsoled:67
msgid "Stopping xenconsoled daemon: "
msgstr "Stoppen van xenconsoled daemon: "

#: /etc/rc.d/init.d/netfs:137
msgid "Configured network block devices: "
msgstr "Geconfigureerde network block devices: "

#: /etc/rc.d/init.d/dovecot:97
msgid ""
"Usage: $0 {condrestart|try-restart|start|stop|restart|reload|force-reload|"
"status}"
msgstr ""
"Gebruik: $0 {condrestart|try-restart|start|stop|restart|reload|force-reload|"
"status}"

#: /etc/rc.d/init.d/cyphesis:161
msgid "Usage: $0 (start|stop|restart|condrestart|status)"
msgstr "Gebruik: $0 (start|stop|restart|condrestart|status)"

#: /etc/rc.d/init.d/iptables:285
msgid "${IPTABLES}: Firewall modules are not loaded."
msgstr "${IPTABLES}: Firewall modules zijn niet geladen."

#: /etc/rc.d/init.d/denyhosts:87
msgid "Starting denyhosts: "
msgstr "Starten van denyhosts: "

#: /etc/rc.d/init.d/functions:524
msgid "cC"
msgstr "dD"

#: /etc/rc.d/init.d/systemtap:599
#, fuzzy
msgid "$prog compiled "
msgstr "$prog is gestopt"

#: /etc/rc.d/init.d/vncserver:120
msgid "Usage: $0 {start|stop|restart|try-restart|status|force-reload}"
msgstr "Gebruik: $0 {start|stop|restart|try-restart|status|force-reload}"

#: /etc/rc.d/rc.sysinit:398
msgid "*** Dropping you to a shell; the system will continue"
msgstr "*** U komt terecht in een shell, het systeem zal doorgaan"

#: /etc/rc.d/init.d/sgemaster:323
msgid "Stopping $master_prog: "
msgstr "Stoppen van $master_prog: "

#: /etc/rc.d/init.d/halt:119
msgid "Unmounting pipe file systems (retry): "
msgstr "Afkoppelen van pipe bestandssystemen (opnieuw): "

#: /etc/rc.d/init.d/cyrus-imapd:133
msgid "Reloading cyrus.conf file: "
msgstr "Herladen van cyrus.conf bestand: "

#: /etc/rc.d/init.d/unbound:59
#, fuzzy
msgid "Stopping unbound: "
msgstr "Stoppen van Pound: "

#: /etc/rc.d/init.d/systemtap:496 /etc/rc.d/init.d/systemtap:583
msgid "Failed to make cache directory ($CACHE_PATH)"
msgstr ""

#: /etc/rc.d/init.d/autofs:118 /etc/rc.d/init.d/autofs:124
msgid "$prog not running"
msgstr "$prog is niet gestart"

#: /etc/sysconfig/network-scripts/ifup-ppp:80
msgid ""
"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist for ${DEVICE}"
msgstr ""
"/etc/sysconfig/network-scripts/chat-${DEVNAME} bestaat niet voor ${DEVICE}"

#: /etc/rc.d/init.d/arptables_jf:76
msgid "Clearing all current rules and user defined chains:"
msgstr "Wissen van alle huidige en door de gebruiker gedefinieerde regels:"

#: /etc/rc.d/init.d/yppasswdd:49
msgid "Stopping YP passwd service: "
msgstr "Stoppen van YP passwd service: "

#: /etc/rc.d/init.d/postfix:151
msgid ""
"Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}"
msgstr ""
"Gebruik: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}"

#: /etc/rc.d/init.d/udev-post:25
msgid "Adding udev persistent rules"
msgstr "Toevoegen van persistente udev regels"

#: /etc/sysconfig/network-scripts/ifup-eth:211
#: /etc/sysconfig/network-scripts/ifup-ib:181
msgid " failed."
msgstr " mislukt."

#: /etc/rc.d/init.d/monotone:145 /etc/rc.d/init.d/monotone:146
msgid "database initialization"
msgstr "database initialisatie"

#: /etc/rc.d/init.d/sec:66
msgid "Dumping state in /tmp/sec.dump: "
msgstr "Toestand wordt gedumpt in /tmp/sec.dump: "

#: /etc/rc.d/init.d/nfs:74
msgid "Starting NFS quotas: "
msgstr "Starten van NFS-quotas: "

#: /etc/rc.d/init.d/boa:89
msgid "Usage: boa {start|stop|status|reload|restart|condrestart}"
msgstr "Gebruik: boa {start|stop|status|reload|restart|condrestart}"

#: /etc/rc.d/init.d/microcode_ctl:67
msgid "$0: kernel does not have CPU microcode device support"
msgstr "$0: kernel heeft geen CPU-microcode apparaatondersteuning"

#: /etc/rc.d/init.d/sepostgresql:138
msgid "Reloading ${NAME} service: "
msgstr "Herladen van ${NAME} service: "

#: /etc/rc.d/init.d/netfs:82 /etc/rc.d/rc.sysinit:593
msgid "*** An error occurred during the file system check."
msgstr "*** Er was een fout tijdens de schijfcontrole."

#: /etc/rc.d/init.d/netfs:115
msgid "Unmounting NCP filesystems: "
msgstr "Afkoppelen van NCP-bestandssystemen: "

#: /etc/rc.d/init.d/arptables_jf:165
msgid "Changing target policies to DROP: "
msgstr "Veranderen van het doelbeleid naar DROP: "

#: /etc/rc.d/init.d/udev-post:49
msgid "Generating udev makedev cache file"
msgstr "Genereren van udev makedev cache bestand"

#: /etc/rc.d/init.d/avahi-dnsconfd:85
msgid "Avahi DNS daemon is running"
msgstr "Avahi DNS-daemon is gestart"

#: /etc/sysconfig/network-scripts/ifup-eth:59
msgid "Bridge support not available: brctl not found"
msgstr "Bridge ondersteuning niet beschikbaar: brctl niet gevonden"

#: /etc/rc.d/init.d/functions:378
msgid "Usage: status [-p pidfile] {program}"
msgstr "Gebruik: status [-p pid-bestand] {programma}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:907
msgid "Missing parameter 'address' (arg 1)"
msgstr "Parameter 'address' (arg 1) ontbreekt"

#: /etc/rc.d/init.d/amavisd:60
msgid "Reloading ${prog_base}:"
msgstr "Herladen van ${prog_base}:"

#: /etc/rc.d/init.d/dropbear:48
msgid "Generating dropbear DSS host key: "
msgstr "Genereren van dropbear DSS host-sleutel: "

#: /etc/sysconfig/network-scripts/ifup-ppp:85
msgid "Setting up a new ${PEERCONF} config file"
msgstr "Instellen van een nieuw ${PEERCONF} configuratiebestand"

#: /etc/rc.d/init.d/proftpd:84
msgid "Re-reading $prog configuration: "
msgstr "Opnieuw inlezen van $prog configuratie: "

#: /etc/rc.d/init.d/supervisord:30
msgid "Stopping supervisord: "
msgstr "Stoppen van supervisord: "

#: /etc/rc.d/init.d/systemtap:409
msgid "Dependency loop detected on $s"
msgstr ""

#: /etc/rc.d/rc.sysinit:227
#, c-format
msgid "%s is password protected"
msgstr ""

#: /etc/rc.d/rc.sysinit:139
msgid "INSECURE OWNER FOR $key"
msgstr "ONVEILIGE EIGENAAR VOOR $key"

#: /etc/sysconfig/network-scripts/ifup-eth:199
#: /etc/sysconfig/network-scripts/ifup-ib:169
msgid " failed; no link present.  Check cable?"
msgstr " mislukt; geen link aanwezig.  Misschien eens de kabel controleren?"

#: /etc/rc.d/init.d/moomps:30
msgid "Starting moomps: "
msgstr "Starten van moomps: "

#: /etc/rc.d/init.d/isdn:149 /etc/rc.d/init.d/isdn:151
msgid "Loading Firmware"
msgstr "Laden van firmware"

#: /etc/rc.d/init.d/liquidwar-server:32
msgid "Starting liquidwar game server: "
msgstr "Starten van liquidwar game server: "

#: /etc/rc.d/init.d/and:44
msgid "Shutting down auto nice daemon:"
msgstr "Stoppen van auto nice daemon:"

#: /etc/rc.d/init.d/util-vserver:74
msgid "Stopping all running guests"
msgstr "Stoppen van alle actieve guests"

#: /etc/rc.d/init.d/dropbear:33
msgid "Generating dropbear RSA host key: "
msgstr "Genereren van dropbear RSA host-sleutel: "

#: /etc/rc.d/init.d/crond:78 /etc/rc.d/init.d/sshd:161
msgid "Reloading $prog"
msgstr "Herladen van $prog"

#: /etc/rc.d/rc.sysinit:397
msgid "*** Warning -- the system did not shut down cleanly. "
msgstr "*** Waarschuwing -- het systeem is niet correct afgesloten. "

#: /etc/rc.d/init.d/ebtables:61
msgid "Stopping $desc ($prog): "
msgstr "Stoppen van $desc ($prog): "

#: /etc/rc.d/init.d/halt:73
msgid "Sending all processes the KILL signal..."
msgstr "Verzenden van KILL signaal naar alle processen..."

#: /etc/rc.d/init.d/functions:310 /etc/rc.d/init.d/tclhttpd:123
msgid "$base $killlevel"
msgstr "$base $killlevel"

#: /etc/sysconfig/network-scripts/ifdown-routes:5
#: /etc/sysconfig/network-scripts/ifup-routes:5
msgid "usage: ifup-routes <net-device> [<nickname>]"
msgstr "Gebruik: ifup-routes <net-device> [<alias>]"

#: /etc/rc.d/init.d/opensm:114
msgid "Rescanning IB Subnet:"
msgstr "Herscannen van IB Subnet:"

#: /etc/rc.d/init.d/arptables_jf:182
msgid "Saving current rules to $ARPTABLES_CONFIG: "
msgstr "Opslaan van huidige regels naar $ARPTABLES_CONFIG: "

#: /etc/rc.d/init.d/avahi-dnsconfd:35
msgid "Starting Avahi DNS daemon... "
msgstr "Starten van Avahi DNS-daemon... "

#: /etc/rc.d/init.d/aprsd:78 /etc/rc.d/init.d/cpuspeed:300
#: /etc/rc.d/init.d/cwdaemon:75 /etc/rc.d/init.d/glacier2router:105
#: /etc/rc.d/init.d/glusterfsd:67 /etc/rc.d/init.d/icegridnode:106
#: /etc/rc.d/init.d/icegridregistry:106 /etc/rc.d/init.d/mt-daapd:52
#: /etc/rc.d/init.d/netlabel:114 /etc/rc.d/init.d/pads:84
#: /etc/rc.d/init.d/prelude-correlator:81 /etc/rc.d/init.d/prelude-manager:66
#: /etc/rc.d/init.d/psad:120 /etc/rc.d/init.d/qpidd:99
#: /etc/rc.d/init.d/remotetrx:72 /etc/rc.d/init.d/roundup:78
#: /etc/rc.d/init.d/sendmail:157 /etc/rc.d/init.d/spampd:67
#: /etc/rc.d/init.d/ssbd:73 /etc/rc.d/init.d/svxlink:72
#: /etc/rc.d/init.d/telescoped:70 /etc/rc.d/init.d/thebridge:71
#: /etc/rc.d/init.d/ucarp:141 /etc/rc.d/init.d/upnpd:89
#: /etc/rc.d/init.d/vsftpd:90 /etc/rc.d/init.d/wdaemon:92
msgid "Usage: $0 {start|stop|restart|condrestart|status}"
msgstr "Gebruik: $0 {start|stop|restart|condrestart|status}"

#: /etc/rc.d/init.d/ypxfrd:31
msgid "Stopping YP map server: "
msgstr "Stoppen van YP map server: "

#: /etc/rc.d/init.d/bandwidthd:34
#, fuzzy
msgid "Starting Bandwidthd network traffic monitor: "
msgstr "Starten van Red Hat Network Daemon: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:737
msgid ""
"On given address '$testipv6addr_valid' the prefix length is out of range "
"(valid: 0-128)"
msgstr ""
"Op het gegeven adres '$testipv6addr_valid' valt de prefix lengte buiten het "
"bereik (geldig: 0-128)"

#: /etc/rc.d/init.d/oki4daemon:42
msgid "Stopping oki4daemon: "
msgstr "Stoppen van oki4daemon: "

#: /etc/rc.d/init.d/portreserve:84
msgid "Usage: $prog {start|stop|restart|condrestart|status}"
msgstr "Gebruik: $prog {start|stop|restart|condrestart|status}"

#: /etc/rc.d/init.d/ip6tables:277
msgid "${IP6TABLES}: Firewall is not running."
msgstr "${IP6TABLES}: Firewall is niet gestart."

#: /etc/rc.d/init.d/tor:68
msgid "program or service status is unknown"
msgstr "programma of service status is onbekend"

#: /etc/rc.d/init.d/kadmin:33 /etc/rc.d/init.d/krb524:32
msgid "Error. Default principal database does not exist."
msgstr "Fout. Standaard principal database bestaat niet."

#: /etc/rc.d/init.d/ntpdate:47
msgid "$prog: Synchronizing with time server: "
msgstr "$prog: Synchroniseren met tijd-server: "

#: /etc/rc.d/init.d/ohmd:39
#, fuzzy
msgid "Starting Open Hardware Manager: "
msgstr "Starten van xend daemon: "

#: /etc/rc.d/init.d/denyhosts:98
msgid "Stray lockfile present; removing it."
msgstr "Achtergebleven lock-bestand aanwezig, verwijderen."

# user is niet in het bezit van file
#: /etc/rc.d/init.d/ldap:114
msgid "$file is not owned by \"$user\""
msgstr "$file is geen bezit van \"$user\""

#: /etc/rc.d/init.d/vsftpd:43
msgid "Starting $prog for $site: "
msgstr "Starten van $prog voor $site: "

#: /etc/rc.d/init.d/flumotion:66
msgid "Starting $type $name: "
msgstr "Starten van $type $name: "

#: /etc/rc.d/init.d/pgpool:123
msgid "Reloading ${NAME}"
msgstr "Herladen van ${NAME}"

#: /etc/rc.d/init.d/vdr:53
msgid "Starting Video Disk Recorder ($prog): "
msgstr "Starten van Video Disk Recorder ($prog): "

#: /etc/rc.d/init.d/functions:413
msgid "${base} is stopped"
msgstr "${base} is gestopt"

#: /etc/rc.d/init.d/systemtap:554
#, fuzzy
msgid "$prog stopping "
msgstr "$prog stop"

#: /etc/rc.d/init.d/puppetmaster:66
msgid "Stopping puppetmaster: "
msgstr "Stoppen van puppetmaster: "

#: /etc/rc.d/init.d/perlbal:21
msgid "Starting Perlbal: "
msgstr "Starten van Perlbal: "

#: /etc/rc.d/init.d/sshd:96 /etc/rc.d/init.d/sshd:99
msgid "DSA key generation"
msgstr "DSA-sleutel genereren"

#: /etc/rc.d/init.d/pgbouncer:161
msgid ""
"Usage: $0 {start|stop|status|restart|pause|continue|reload|force-reload|"
"condrestart|condstop}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|pause|continue|reload|force-reload|"
"condrestart|condstop}"

#: /etc/rc.d/init.d/blktapctrl:39
msgid "Starting xen blktapctrl daemon: "
msgstr "Starten van xen blktapctrl daemon: "

#: /etc/rc.d/init.d/wesnothd:43
msgid "Starting Wesnoth game server: "
msgstr "Starten van Wesnoth game server: "

#: /etc/rc.d/init.d/postfix:81
msgid "$prog stop"
msgstr "$prog stop"

#: /etc/rc.d/init.d/ypserv:44
msgid "Stopping YP server services: "
msgstr "Stoppen van YP server services: "

#: /etc/rc.d/init.d/openhpid:243
msgid "Usage: $0 {start|stop|restart|condrestart|status|force-reload}"
msgstr "Gebruik: $0 {start|stop|restart|condrestart|status|force-reload}"

#: /etc/rc.d/init.d/netconsole:82
msgid "netconsole: can't resolve MAC address of $SYSLOGADDR"
msgstr "netconsole: kan MAC-adres van $SYSLOGADDR niet opzoeken"

#: /etc/rc.d/init.d/halt:158
msgid "On the next boot fsck will be skipped."
msgstr "Bij het opnieuw opstarten zal fsck worden overgeslagen."

#: /etc/rc.d/init.d/systemtap:67
msgid "\tscript(s)\t: specify systemtap scripts"
msgstr ""

#: /etc/rc.d/rc.sysinit:794
msgid "Enabling local swap partitions: "
msgstr "Aanzetten van lokale swap partities: "

#: /etc/sysconfig/network-scripts/ifup-eth:234
#: /etc/sysconfig/network-scripts/ifup-ib:206
msgid "Failed to bring up ${DEVICE}."
msgstr "Opstarten van ${DEVICE} mislukte."

#: /etc/rc.d/init.d/xenner:57
msgid "Starting xenner daemons"
msgstr "Starten van xenner daemons"

#: /etc/rc.d/init.d/halt:80
msgid "Saving mixer settings"
msgstr "Opslaan van mixer-instellingen"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:468
msgid "Tunnel device 'sit0' enabling didn't work"
msgstr "Aanzetten van tunnel-apparaat 'sit0' is mislukt"

#: /etc/rc.d/init.d/smolt:22
msgid "Enabling monthly Smolt checkin: "
msgstr "Aanzetten van maandelijkse Smolt checkin: "

#: /etc/rc.d/init.d/udev-post:84
msgid "Usage: $0 {start|stop|reload}"
msgstr "Gebruik: $0 {start|stop|reload}"

#: /etc/rc.d/init.d/condor:58
msgid "Warning: $prog may not have exited, start/restart may fail"
msgstr ""

#: /etc/rc.d/rc.sysinit:277
msgid "\t\tPress 'I' to enter interactive startup."
msgstr "\t\tDruk op 'I' om interactief op te starten."

#: /etc/rc.d/init.d/sshd:89
msgid "Generating SSH2 DSA host key: "
msgstr "Genereren van SSH2 DSA host-sleutel: "

#: /etc/sysconfig/network-scripts/ifup:93
msgid "No 802.1Q VLAN support available in kernel for device ${DEVICE}"
msgstr ""
"Geen 802.1Q VLAN-ondersteuning beschikbaar in kernel voor apparaat ${DEVICE}"

#: /etc/rc.d/init.d/tetrinetx:43
msgid "Stopping $display_name: "
msgstr "Stoppen van $display_name: "

#: /etc/rc.d/init.d/monotone:177 /etc/rc.d/init.d/monotone:179
msgid "key generation"
msgstr "sleutel generatie"

#: /etc/rc.d/rc.sysinit:735
msgid "Resetting hostname ${HOSTNAME}: "
msgstr "Herinstellen van hostname ${HOSTNAME}: "

#: /etc/rc.d/init.d/netfs:60
msgid "Checking network-attached filesystems"
msgstr "Controleren van netwerk-gekoppelde bestandssystemen"

#: /etc/rc.d/init.d/netfs:113
msgid "Unmounting SMB filesystems: "
msgstr "Afkoppelen van SMB-bestandssystemen: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:658
msgid "Missing parameter 'IPv6 address' (arg 2)"
msgstr "Parameter 'IPv6-address' (arg 2) ontbreekt"

#: /etc/rc.d/init.d/xpilot-ng-server:31
msgid "Starting Xpilot game server: "
msgstr "Starten van Xpilot game server: "

#: /etc/rc.d/init.d/argus:29
msgid "Starting argus: "
msgstr "Starten van argus: "

#: /etc/rc.d/init.d/mailman:152
msgid "Usage: $prog {start|stop|restart|force-reload|condrestart|status}"
msgstr "Gebruik: $prog {start|stop|restart|force-reload|condrestart|status}"

#: /etc/rc.d/init.d/moodle:75
msgid "Usage: $0 {start|stop|status|restart|reload|force-reload|try-restart}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|reload|force-reload|try-restart}"

#: /etc/rc.d/init.d/tclhttpd:69
msgid "Usage: killproc {program} [signal]"
msgstr "Gebruik: killproc {programma} [signaal]"

#: /etc/rc.d/rc.sysinit:336
msgid "Setting hostname ${HOSTNAME}: "
msgstr "Instellen van hostnaam ${HOSTNAME}: "

#: /etc/rc.d/init.d/yppasswdd:40
msgid "Starting YP passwd service: "
msgstr "Starten van YP passwd service: "

#: /etc/rc.d/init.d/cman:823 /etc/rc.d/init.d/modclusterd:153
msgid "Usage: $0 {start|stop|reload|restart|status}"
msgstr "Gebruik: $0 {start|stop|reload|restart|status}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:30
msgid "ERROR: [ipv6_log] Missing 'message' (arg 1)"
msgstr "FOUT: [ipv6_log] ontbrekend 'bericht' (arg 1)"

#: /etc/sysconfig/network-scripts/ifup-ipx:7
msgid "usage: $0 <net-device>"
msgstr "Gebruik: $0 <net-device>"

#: /etc/rc.d/init.d/cyrus-imapd:77
msgid "$BASENAME already running."
msgstr "$BASENAME reeds gestart."

#: /etc/rc.d/init.d/condor:210
msgid "$prog dead but subsys locked"
msgstr "$prog afgesloten, maar subsysteem is vergrendeld"

# Willekeursgetal = eigen inventie
#: /etc/rc.d/init.d/halt:86
msgid "Saving random seed: "
msgstr "Opslaan van willekeursgetal: "

#: /etc/rc.d/init.d/isdn:122 /etc/rc.d/init.d/isdn:125
msgid "Loading ISDN modules"
msgstr "Laden van ISDN-modules"

#: /etc/rc.d/init.d/ldap:229
msgid "Usage: $0 {start|stop|restart|status|condrestart|configtest}"
msgstr "Gebruik: $0 {start|stop|restart|status|condrestart|configtest}"

#: /etc/rc.d/init.d/microcode_ctl:55
msgid "$0: microcode device $DEVICE doesn't exist?"
msgstr "$0: microcode-apparaat $DEVICE bestaat niet?"

#: /etc/rc.d/init.d/ctdb:173
msgid "killing ctdbd "
msgstr ""

#: /etc/rc.d/init.d/uuidd:34
msgid "Starting uuidd: "
msgstr "Starten van uuidd: "

#: /etc/rc.d/rc.sysinit:665 /etc/rc.d/rc.sysinit:667
msgid "Mounting local filesystems: "
msgstr "Aankoppelen van lokale bestandssystemen: "

#: /etc/rc.d/init.d/privoxy:61
msgid "Can't find $PRIVOXY_CONF, exit."
msgstr "Kan $PRIVOXY_CONF niet vinden, gestopt."

#: /etc/sysconfig/network-scripts/network-functions-ipv6:329
#: /etc/sysconfig/network-scripts/network-functions-ipv6:384
msgid "Missing parameter 'IPv6-gateway' (arg 2)"
msgstr "Parameter 'IPv6-gateway' (arg 2) ontbreekt"

#: /etc/rc.d/init.d/milter-regex:85
msgid "Usage: $0 {start|stop|force-reload|restart|try-restart|status}"
msgstr "Gebruik: $0 {start|stop|force-reload|restart|try-restart|status}"

#: /etc/sysconfig/network-scripts/ifup-ipv6:101
#: /etc/sysconfig/network-scripts/ifup-ipv6:118
msgid "Please restart network with '/sbin/service network restart'"
msgstr ""
"Gelieve het netwerk opnieuw op te starten via '/sbin/service network restart'"

#: /etc/rc.d/init.d/systemtap:61
msgid "Usage: $prog {start|stop|restart|status|compile|cleanup} [option]"
msgstr "Gebruik: $prog {start|stop|restart|status|compile|cleanup} [optie]"

#: /etc/rc.d/init.d/cyphesis:65
msgid "Creating PostgreSQL database: "
msgstr "Aanmaken van PostgreSQL database: "

#: /etc/rc.d/init.d/ucarp:21
msgid "common address redundancy protocol daemon"
msgstr "common address redundancy protocol daemon"

#: /etc/rc.d/init.d/netfs:84 /etc/rc.d/rc.sysinit:71 /etc/rc.d/rc.sysinit:399
#: /etc/rc.d/rc.sysinit:595
msgid "*** when you leave the shell."
msgstr "*** wanneer u de shell verlaat."

#: /etc/rc.d/init.d/sendmail:69
msgid "Starting sm-client: "
msgstr "Starten van sm-client: "

#: /etc/rc.d/init.d/ipa_kpasswd:36 /etc/rc.d/init.d/ipa_webgui:32
msgid "Starting $NAME: "
msgstr "Starten van $NAME: "

#: /etc/rc.d/init.d/monotone:87
msgid "Pre-0.26 monotone database must be migrated by hand: "
msgstr "Pre-0.26 monotone database dient handmatig gemigreerd te worden: "

#: /etc/rc.d/init.d/iptables:197
msgid "${IPTABLES}: Loading additional modules: "
msgstr "${IPTABLES}: Laden van additionele modules: "

#: /etc/rc.d/init.d/openhpi-subagent:78
msgid "Shutting down HPI SNMP sub-agent daemon: "
msgstr "Stoppen van HPI SNMP sub-agent daemon: "

#: /etc/rc.d/init.d/scanbuttond:84
msgid "Usage: $prog {start|stop|restart|status|condrestart}"
msgstr "Gebruik: $prog {start|stop|restart|status|condrestart}"

#: /etc/rc.d/init.d/sqlgrey:15
msgid "Starting SQLgrey: "
msgstr "Starten van SQLgrey: "

#: /etc/rc.d/init.d/oddjobd:85
msgid "Reloading $prog configuration: "
msgstr "Herladen van $prog configuratie: "

#: /etc/rc.d/init.d/netfs:44
msgid "Mounting CIFS filesystems: "
msgstr "Aankoppelen van CIFS-bestandssystemen: "

#: /etc/sysconfig/network-scripts/ifup-ipv6:178
msgid "Device 'tun6to4' (from '$DEVICE') is already up, shutdown first"
msgstr ""
"Netwerkkaart 'tun6to4' (van '$DEVICE') is reeds gestart, sluit het eerst af"

#: /etc/rc.d/init.d/bluetooth:62 /etc/rc.d/init.d/bootparamd:78
#: /etc/rc.d/init.d/clamd-wrapper:88 /etc/rc.d/init.d/collectd:60
#: /etc/rc.d/init.d/dhcp-fwd:73 /etc/rc.d/init.d/ip-sentinel:77
#: /etc/rc.d/init.d/irqbalance:90 /etc/rc.d/init.d/ladvd:87
#: /etc/rc.d/init.d/maradns:115 /etc/rc.d/init.d/maradns-zoneserver:109
#: /etc/rc.d/init.d/nscd:104 /etc/rc.d/init.d/radiusd:76
#: /etc/rc.d/init.d/radvd:83 /etc/rc.d/init.d/rpcbind:88
#: /etc/rc.d/init.d/snake-server:67 /etc/rc.d/init.d/yppasswdd:80
#: /etc/rc.d/init.d/ypserv:75 /etc/rc.d/init.d/ypxfrd:62
msgid "Usage: $0 {start|stop|status|restart|reload|condrestart}"
msgstr "Gebruik: $0 {start|stop|status|restart|reload|condrestart}"

#: /etc/rc.d/init.d/rusersd:40
msgid "Starting rusers services: "
msgstr "Starten van rusers services: "

#: /etc/rc.d/init.d/netfs:141
msgid "Active NFS mountpoints: "
msgstr "Actieve NFS-koppelpunten: "

#: /etc/rc.d/init.d/nfs:82
msgid "Starting NFS daemon: "
msgstr "Starten van NFS-daemon: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:918
msgid "Given address '$addr' is not a global IPv4 one (arg 1)"
msgstr "Opgegeven adres '$addr' is geen algemeen (global) IPv4-adres (arg 1)"

#: /etc/rc.d/init.d/telescoped:29
#, fuzzy
msgid "Starting telescope daemon: "
msgstr "Starten van acpi-daemon: "

#: /etc/rc.d/init.d/cgred:120
#, fuzzy
msgid "$servicename is not running."
msgstr "CIM-server is niet gestart"

#: /etc/rc.d/init.d/sge_execd:130
msgid ""
"Usage: $0 {start|stop|softstop|status|restart|try-restart|reload|force-"
"reload}"
msgstr ""
"Gebruik: $0 {start|stop|softstop|status|restart|try-restart|reload|force-"
"reload}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1230
msgid "Missing parameter 'selection' (arg 2)"
msgstr "Parameter 'selection' (arg 2) ontbreekt"

#: /etc/ppp/ip-up.ipv6to4:91 /etc/sysconfig/network-scripts/ifup-ipv6:218
msgid ""
"IPv6to4 configuration needs an IPv4 address on related interface or "
"otherwise specified"
msgstr ""
"IPv6to4 configuratie heeft een IPv4-adres op een gerelateerde interface "
"nodig of moet worden gespecificeerd"

#: /etc/rc.d/init.d/apt:39
msgid "Disabling nightly apt update: "
msgstr "Uitzetten van nachtelijke apt update: "

#: /etc/rc.d/init.d/ospf6d:63 /etc/rc.d/init.d/ospfd:63
msgid "Usage: $PROG {start|stop|restart|reload|condrestart|status}"
msgstr "Gebruik: $PROG {start|stop|restart|reload|condrestart|status}"

#: /etc/rc.d/init.d/nfs:63
msgid "Starting NFS services: "
msgstr "Starten van NFS-services: "

#: /etc/rc.d/init.d/nsd:102
msgid ""
"Usage: $0 {start|stop|status|restart|condrestart|stats|notify|reload|rebuild|"
"running|update}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|condrestart|stats|notify|reload|"
"rebuild|running|update}"

#: /etc/rc.d/init.d/xpilot-ng-server:57
msgid "Stopping Xpilot game server: "
msgstr "Stoppen van Xpilot game server: "

#: /etc/rc.d/init.d/haldaemon:27
msgid "Starting HAL daemon: "
msgstr "Starten van HAL-daemon: "

#: /etc/rc.d/rc.sysinit:69
msgid "*** /etc/selinux/config indicates you want to manually fix labeling"
msgstr ""
"*** /etc/selinux/config geeft aan dat u het labelen handmatig wilt repareren"

#: /etc/rc.d/init.d/tgtd:25
msgid "Starting SCSI target daemon: "
msgstr "Starten van SCSI target daemon: "

#: /etc/rc.d/init.d/vprocunhide:50
msgid "/proc entries were fixed"
msgstr "/proc items zijn gerepareerd"

#: /etc/rc.d/init.d/postgresql:296 /etc/rc.d/init.d/sepostgresql:208
msgid ""
"Usage: $0 {start|stop|status|restart|condrestart|condstop|reload|force-"
"reload|initdb}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|condrestart|condstop|reload|force-"
"reload|initdb}"

#: /etc/rc.d/init.d/halt:63 /etc/rc.d/init.d/killall:10
#: /etc/rc.d/init.d/stinit:18
msgid "Usage: $0 {start}"
msgstr "Gebruik: $0 {start}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1127
msgid "Tunnel device '$device' creation didn't work"
msgstr "Aanmaken van tunnel-apparaat '$device' is mislukt"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:535
msgid "Missing parameter 'IPv6-address' (arg 2)"
msgstr "Parameter 'IPv6-address' (arg 2) ontbreekt"

#: /etc/rc.d/rc.sysinit:75 /etc/rc.d/rc.sysinit:579 /etc/rc.d/rc.sysinit:602
msgid "Unmounting file systems"
msgstr "Afkoppelen van bestandssystemen"

#: /etc/rc.d/init.d/ntpdate:43
msgid "NTP server not specified in $ntpstep or $ntpconf"
msgstr "NTP-server niet opgegeven in $ntpstep of $ntpconf"

#: /etc/rc.d/init.d/portreserve:54
msgid "(not starting, no services registered)"
msgstr "(niet gestart, geen services geregistreerd)"

#: /etc/rc.d/init.d/ez-ipupdate:50
msgid "Starting $prog for $ez_name: "
msgstr "Starten van $prog voor $ez_name: "

#: /etc/rc.d/init.d/netlabel:71
msgid "Netlabel is stopped."
msgstr "Netlabel is gestopt."

#: /etc/sysconfig/network-scripts/network-functions-ipv6:197
msgid ""
"Utility 'sysctl' (package: procps) doesn't exist or isn't executable - stop"
msgstr ""
"Programma 'sysctl' (pakket: procps) bestaat niet of is niet uitvoerbaar - "
"stop"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:549
msgid "Device '$device' doesn't exist"
msgstr "Apparaat '$device' bestaat niet"

#: /etc/rc.d/init.d/flumotion:99
msgid "Stopping $type $name: "
msgstr "Stoppen van $type $name: "

#: /etc/rc.d/init.d/postgresql:166
msgid ""
"See $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for more information."
msgstr ""
"Zie $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist voor meer informatie."

#: /etc/rc.d/init.d/netbsd-iscsi:45 /etc/rc.d/init.d/nighthttpd:41
msgid "Starting $SERVICE: "
msgstr "Starten van $SERVICE: "

#: /etc/rc.d/init.d/zfs-fuse:88
#, fuzzy
msgid "Mounting zfs partitions: "
msgstr "Aanzetten van lokale swap partities: "

#: /etc/rc.d/init.d/network:143 /etc/rc.d/init.d/network:155
msgid "Bringing up interface $i: "
msgstr "Starten van interface $i: "

#: /etc/rc.d/rc.sysinit:135
msgid "INSECURE MODE FOR $key"
msgstr "ONVEILIGE MODUS VOOR $key"

#: /etc/rc.d/init.d/clamd-wrapper:67
msgid "Loading new virus-database: "
msgstr "Laden van nieuwe virus-database: "

#: /etc/rc.d/init.d/cyphesis:124
msgid "Shutting down cyphesis: "
msgstr "Stoppen van cyphesis: "

#: /etc/rc.d/init.d/crossfire:56
msgid "Stopping Crossfire game server: "
msgstr "Stoppen van Crossfire game server: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:576
msgid "Cannot add IPv6 address '$address' on dev '$device'"
msgstr "Kan IPv6-adres '$address' niet toevoegen op apparaat '$device'"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:429
#: /etc/sysconfig/network-scripts/network-functions-ipv6:530
#: /etc/sysconfig/network-scripts/network-functions-ipv6:593
#: /etc/sysconfig/network-scripts/network-functions-ipv6:622
#: /etc/sysconfig/network-scripts/network-functions-ipv6:653
#: /etc/sysconfig/network-scripts/network-functions-ipv6:836
#: /etc/sysconfig/network-scripts/network-functions-ipv6:951
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1013
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1047
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1089
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1167
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1225
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1278
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1317
#: /etc/sysconfig/network-scripts/network-functions-ipv6:1445
msgid "Missing parameter 'device' (arg 1)"
msgstr "Parameter 'device' (arg 1) ontbreekt"

#: /etc/rc.d/init.d/psacct:36
msgid "Shutting down process accounting: "
msgstr "Stoppen van processenbeheer: "

#: /etc/sysconfig/network-scripts/ifup-ppp:78
msgid "ifup-ppp for ${DEVNAME} exiting"
msgstr "ifup-ppp voor ${DEVNAME} gestopt"

#: /etc/rc.d/init.d/ajaxterm:42 /etc/rc.d/init.d/boa:56
#: /etc/rc.d/init.d/clamd-wrapper:64 /etc/rc.d/init.d/crond:74
#: /etc/rc.d/init.d/cups:95 /etc/rc.d/init.d/cups:101
#: /etc/rc.d/init.d/dbmail-imapd:51 /etc/rc.d/init.d/dbmail-lmtpd:52
#: /etc/rc.d/init.d/dbmail-pop3d:52 /etc/rc.d/init.d/dbmail-timsieved:53
#: /etc/rc.d/init.d/dovecot:62 /etc/rc.d/init.d/haproxy:75
#: /etc/rc.d/init.d/honeyd:91 /etc/rc.d/init.d/httpd:73
#: /etc/rc.d/init.d/ircd:53 /etc/rc.d/init.d/keepalived:47
#: /etc/rc.d/init.d/lighttpd:59 /etc/rc.d/init.d/mailgraph:57
#: /etc/rc.d/init.d/monit:52 /etc/rc.d/init.d/nginx:59
#: /etc/rc.d/init.d/ngircd:42 /etc/rc.d/init.d/nscd:95
#: /etc/rc.d/init.d/ntop:57 /etc/rc.d/init.d/postgrey:54
#: /etc/rc.d/init.d/pure-ftpd:60 /etc/rc.d/init.d/ratbox-services:47
#: /etc/rc.d/init.d/rbldnsd:116 /etc/rc.d/init.d/rinetd:49
#: /etc/rc.d/init.d/rtpproxy:38 /etc/rc.d/init.d/scanbuttond:58
#: /etc/rc.d/init.d/sendmail:88 /etc/rc.d/init.d/ser:53
#: /etc/rc.d/init.d/smsd:50 /etc/rc.d/init.d/snmpd:68
#: /etc/rc.d/init.d/sshd:157 /etc/rc.d/init.d/tor:56 /etc/rc.d/init.d/ulogd:60
#: /etc/rc.d/init.d/ushare:44 /etc/rc.d/init.d/xfs:90
msgid "Reloading $prog: "
msgstr "Herladen van $prog: "

#: /etc/rc.d/init.d/hddtemp:39
msgid "Starting hard disk temperature monitor daemon ($prog): "
msgstr "Starten van hard disk temperature monitor daemon ($prog): "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1529
msgid "Given pidfile '$pidfile' doesn't exist, cannot send trigger to radvd"
msgstr ""
"Opgegeven pid-bestand '$pidfile' bestaat niet, kan de 'trigger' niet naar "
"radvd sturen"

#: /etc/sysconfig/network-scripts/ifup-ippp:376
#: /etc/sysconfig/network-scripts/ifup-isdn:376
msgid "Warning: link doesn't support IPv6 using encapsulation 'rawip'"
msgstr "Waarschuwing: link ondersteunt geen IPv6 met inkapseling van 'rawip'"

#: /etc/rc.d/init.d/halt:50
msgid "Please stand by while rebooting the system..."
msgstr "Gelieve te wachten terwijl het systeem herstart..."

#: /etc/rc.d/init.d/avahi-dnsconfd:49
msgid "Shutting down Avahi DNS daemon: "
msgstr "Stoppen van Avahi DNS-daemon: "

#: /etc/rc.d/init.d/yum-updatesd:42
msgid "Stopping yum-updatesd: "
msgstr "Stoppen van yum-updatesd: "

#: /etc/rc.d/init.d/mt-daapd:27
msgid "Shutting down DAAP server: "
msgstr "Stoppen van DAAP server: "

#: /etc/rc.d/init.d/openct:66
msgid "Waiting for reader attach/detach events..."
msgstr "Wachten op reader attach/detach events..."

#: /etc/rc.d/init.d/apmd:100
msgid "Usage: apmd {start|stop|status|restart|reload|force-reload|condrestart}"
msgstr ""
"Gebruik: apmd {start|stop|status|restart|reload|force-reload|condrestart}"

#: /etc/rc.d/init.d/postfix:105
msgid "$prog flush"
msgstr "$prog flush"

#: /etc/rc.d/init.d/avahi-daemon:65
msgid "$base reload"
msgstr "$base herladen"

#: /etc/rc.d/init.d/tog-pegasus:67
msgid "Starting up CIM server: "
msgstr "Starten van CIM-server: "

#: /etc/rc.d/init.d/callweaver:15
msgid "Starting CallWeaver: "
msgstr "Starten van CallWeaver: "

#: /etc/rc.d/init.d/rstatd:51
msgid "Stopping rstat services: "
msgstr "Stoppen van rstat services: "

#: /etc/rc.d/init.d/functions:443
msgid "PASSED"
msgstr "VOLTOOID"

#: /etc/rc.d/init.d/cyphesis:31
msgid "Could not check for running PostgreSQL database."
msgstr "Niet in staat om op actieve PostgreSQL database te controleren."

#: /etc/rc.d/init.d/xfs:103
msgid "Restarting $prog:"
msgstr "Herstarten van $prog:"

#: /etc/rc.d/init.d/liquidwar-server:54
msgid "Stopping liquidwar game server: "
msgstr "Stoppen van liquidwar game server: "

#: /etc/rc.d/init.d/cyphesis:43
msgid "Cannot find user $CYPHESISUSER to run cyphesis service."
msgstr ""
"Kan gebruiker $CYPHESISUSER niet vinden om cyphesis service uit te voeren."

#: /etc/rc.d/init.d/ipmi:311
msgid "Stopping ipmi_poweroff driver: "
msgstr "Stoppen van ipmi_poweroff driver: "

#: /etc/rc.d/init.d/qemu:71
msgid "qemu binary format handlers are not registered."
msgstr "qemu binair formaat verwerkers zijn niet geregistreerd."

#: /etc/rc.d/init.d/sshd:51
msgid "Generating SSH1 RSA host key: "
msgstr "Genereren van SSH1 RSA host-sleutel: "

#: /etc/rc.d/init.d/cherokee:35
#, fuzzy
msgid "$NAME: already running"
msgstr "$BASENAME reeds gestart."

#: /etc/rc.d/init.d/ocspd:75
#, fuzzy
msgid "Reloading CRLs: "
msgstr "Herladen van nsca: "

#: /etc/rc.d/init.d/ipmi:545
msgid "Usage: $0 {start|stop|status|restart|condrestart|try-restart"
msgstr "Gebruik: $0 {start|stop|status|restart|condrestart|try-restart"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:729
msgid "Missing prefix length for given address '$testipv6addr_valid'"
msgstr "Prefix lengte voor het opgegeven adres '$testipv6addr_valid' ontbreekt"

#: /etc/rc.d/init.d/maradns:77 /etc/rc.d/init.d/maradns-zoneserver:71
msgid "$rcfile "
msgstr "$rcfile "

#: /etc/rc.d/init.d/arpwatch:80 /etc/rc.d/init.d/gkrellmd:74
#: /etc/rc.d/init.d/hddtemp:83 /etc/rc.d/init.d/LCDd:74
#: /etc/rc.d/init.d/lcdproc:74 /etc/rc.d/init.d/ntpd:86
#: /etc/rc.d/init.d/vdr:106 /etc/rc.d/init.d/vdradmind:66
msgid "Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
msgstr "Gebruik: $0 {start|stop|status|restart|try-restart|force-reload}"

#: /etc/rc.d/init.d/ldap:155
msgid "stale lock files may be present in $directory"
msgstr "er kunnen verouderde lock-bestanden aanwezig zijn in $directory"

#: /etc/rc.d/init.d/ip6tables:197
msgid "${IP6TABLES}: Loading additional modules: "
msgstr "${IP6TABLES}: Laden van additionele modules: "

#: /etc/rc.d/init.d/halt:98
msgid "Turning off swap: "
msgstr "Uitzetten van swap ruimte: "

#: /etc/rc.d/init.d/privoxy:60
msgid "Can't find $PRIVOXY_BIN, exit."
msgstr "Kan $PRIVOXY_BIN niet vinden, gestopt."

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1488
msgid "Unsupported reason '$reason' for sending trigger to radvd"
msgstr ""
"Niet-ondersteunde reden '$reason' voor het verzenden van 'trigger' naar radvd"

#: /etc/rc.d/init.d/bgpd:41 /etc/rc.d/init.d/cachefilesd:60
#: /etc/rc.d/init.d/ospf6d:40 /etc/rc.d/init.d/ospfd:40
#: /etc/rc.d/init.d/remotetrx:38 /etc/rc.d/init.d/ripd:40
#: /etc/rc.d/init.d/ripngd:40 /etc/rc.d/init.d/svxlink:38
#: /etc/rc.d/init.d/zebra:40
msgid "Shutting down $PROG: "
msgstr "Stoppen van $PROG: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:93
msgid "ERROR: [ipv6_log] Loglevel isn't valid '$level' (arg 2)"
msgstr "FOUT: [ipv6_log] Loglevel is niet geldig '$level' (arg 2)"

#: /etc/rc.d/init.d/ipmi:546
msgid "          start-watchdog|stop-watchdog|status-watchdog"
msgstr "          start-watchdog|stop-watchdog|status-watchdog"

#: /etc/rc.d/init.d/amavisd:41
msgid "Shutting down ${prog_base}:"
msgstr "Stoppen van ${prog_base}:"

#: /etc/rc.d/init.d/innd:71
msgid "Stopping INNWatch service: "
msgstr "Stoppen van INNWatch service: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1555
msgid "radvd not (properly) installed, triggering failed"
msgstr "radvd niet (juist) geïnstalleerd, 'triggering' is mislukt"

#: /etc/rc.d/init.d/asterisk:99
msgid "Stopping asterisk: "
msgstr "Stoppen van asterisk: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1322
msgid "Missing parameter 'IPv6 MTU' (arg 2)"
msgstr "Parameter 'IPv6-MTU' (arg 2) ontbreekt"

#: /etc/rc.d/init.d/blktapctrl:75 /etc/rc.d/init.d/xenstored:82
msgid "Usage: $0 {start|stop|status}"
msgstr "Gebruik: $0 {start|stop|status}"

#: /etc/rc.d/init.d/ypserv:35
msgid "Starting YP server services: "
msgstr "Starten van YP server services: "

#: /etc/rc.d/init.d/kadmin:89
msgid "Usage: $0 {start|stop|status|condrestart|reload|restart}"
msgstr "Gebruik: $0 {start|stop|status|condrestart|reload|restart}"

#: /etc/rc.d/init.d/chronyd:72
#, fuzzy
msgid "Generating chrony command key: "
msgstr "Genereren van dropbear DSS host-sleutel: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1419
msgid "Given IPv6 default device '$device' requires an explicit nexthop"
msgstr ""
"Opgegeven IPv6 standaardapparaat '$device' vereist een expliciete 'nexthop'"

#: /etc/rc.d/rc.sysinit:672
msgid "Checking local filesystem quotas: "
msgstr "Controleren van lokale bestandssysteemquota's: "

#: /etc/rc.d/init.d/nfslock:53
msgid "Starting NFS statd: "
msgstr "Starten van NFS-statd: "

#: /etc/rc.d/init.d/sgemaster:282
msgid "Starting $master_prog: "
msgstr "Starten van $master_prog: "

#: /etc/rc.d/init.d/openhpid:216
msgid "Force-reload not supported."
msgstr "Force-reload niet ondersteund."

#: /etc/rc.d/init.d/innd:60 /etc/rc.d/init.d/innd:62
msgid "innd shutdown"
msgstr "innd is gestopt"

#: /etc/rc.d/init.d/corosync:29
#, fuzzy
msgid "Stopping Corosync Cluster Engine ($prog): "
msgstr "Stoppen van $desc ($prog): "

#: /etc/sysconfig/network-scripts/ifup-ppp:48
msgid "pppd does not exist or is not executable for ${DEVICE}"
msgstr "pppd bestaat niet of is niet uitvoerbaar voor ${DEVICE}"

#: /etc/rc.d/init.d/denyhosts:77
msgid "denyhosts cron service is enabled."
msgstr "denyhosts cron service is aangezet."

#: /etc/rc.d/init.d/pgpool:119
msgid "Reloading ${NAME}: "
msgstr "Herladen van ${NAME}: "

#: /etc/rc.d/init.d/exim:78
msgid "Reloading exim:"
msgstr "Herladen van exim:"

#: /etc/rc.d/init.d/functions:404
msgid "${base} dead but pid file exists"
msgstr "${base} afgesloten, maar pid-bestand bestaat"

#: /etc/rc.d/init.d/sendmail:49
msgid "Package sendmail-cf is required to update configuration."
msgstr ""

#: /etc/rc.d/init.d/restorecond:52
msgid "Shutting down restorecond: "
msgstr "Stoppen van restorecond: "

#: /etc/rc.d/init.d/tor:66
msgid "program is dead and /var/lock lock file exists"
msgstr "programma is afgesloten en /var/lock lock-bestand bestaat"

#: /etc/rc.d/init.d/mysqld:148 /etc/rc.d/init.d/ndbd:107
#: /etc/rc.d/init.d/ndb_mgmd:112
msgid "Usage: $0 {start|stop|status|condrestart|restart}"
msgstr "Gebruik: $0 {start|stop|status|condrestart|restart}"

#: /etc/sysconfig/network-scripts/ifup-ppp:46
msgid "ifup-ppp for ${DEVICE} exiting"
msgstr "ifup-ppp voor ${DEVICE} gestopt"

#: /etc/rc.d/init.d/cups:118 /etc/rc.d/init.d/dbmail-imapd:85
#: /etc/rc.d/init.d/dbmail-lmtpd:86 /etc/rc.d/init.d/dbmail-pop3d:86
#: /etc/rc.d/init.d/dbmail-timsieved:87 /etc/rc.d/init.d/mailgraph:91
#: /etc/rc.d/init.d/ntop:90 /etc/rc.d/init.d/ris-linuxd:102
#: /etc/rc.d/init.d/sip-redirect:73
msgid "Usage: $prog {start|stop|restart|condrestart|reload|status}"
msgstr "Gebruik: $prog {start|stop|restart|condrestart|reload|status}"

#: /etc/rc.d/init.d/rbldnsd:132
msgid "($pid) is running..."
msgstr "($pid) is gestart..."

#: /etc/rc.d/init.d/smartd:72
msgid "Reloading $prog daemon configuration: "
msgstr "Herladen van $prog daemon configuratie: "

#: /etc/rc.d/init.d/qpidd:52
msgid "Starting Qpid AMQP daemon: "
msgstr "Starten van Qpid AMQP daemon: "

#: /etc/rc.d/init.d/tofmipd:48
msgid "Starting $progname: "
msgstr "Starten van $progname: "

#: /etc/rc.d/init.d/moodle:70
msgid "Moodle cron job is disabled."
msgstr "Moodle cron job is uitgezet."

#: /etc/rc.d/init.d/systemtap:552
#, fuzzy
msgid "Failed to run \"$s\". "
msgstr "Opstarten van ${DEVICE} mislukte."

#: /etc/rc.d/init.d/wine:50
msgid "Wine binary format handlers are not registered."
msgstr "Wine binair formaat verwerkers zijn niet geregistreerd."

#: /etc/rc.d/init.d/nfs:167 /etc/rc.d/init.d/nfslock:107
msgid "start"
msgstr "start"

#: /etc/rc.d/init.d/network:248
msgid "Shutting down interface $i: "
msgstr "Stoppen van interface $i: "

#: /etc/rc.d/init.d/yum-updateonboot:66
msgid "Updating RPMS in group $group: "
msgstr "Bijwerken van RPMS in groep $group: "

#: /etc/sysconfig/network-scripts/ifup:132
msgid "WARNING: vconfig not able to disable REORDER_HDR on ${DEVICE}"
msgstr ""
"WAARSCHUWING: vconfig is niet in staat om REORDER_HDR uit te zetten op "
"${DEVICE}"

#: /etc/sysconfig/network-scripts/ifup-ipv6:147
msgid ""
"Cannot enable IPv6 privacy method '$IPV6_PRIVACY', not supported by kernel"
msgstr ""
"Kan IPv6 privacy methode '$IPV6_PRIVACY' niet aanzetten, niet ondersteund "
"door de kernel"

#: /etc/rc.d/rc.sysinit:51
msgid "*** Warning -- SELinux is active"
msgstr "*** Waarschuwing -- SELinux is gestart"

#: /etc/rc.d/init.d/spamass-milter:68
msgid "Shutting down ${desc} (${prog}): "
msgstr "Stoppen van ${desc} (${prog}): "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1052
msgid "Missing parameter 'local IPv4 address' (arg 2)"
msgstr "Parameter 'local IPv4-address' (arg 2) ontbreekt"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:1379
msgid ""
"Given IPv6 default gateway '$address' is link-local, but no scope or gateway "
"device is specified"
msgstr ""
"Opgegeven IPv6 standaard gateway '$address' is link-local, maar er is geen "
"bereik of gateway-apparaat opgegeven"

#: /etc/rc.d/init.d/cobblerd:66
#, fuzzy
msgid "Stopping cobbler daemon: "
msgstr "Stoppen van xenconsoled daemon: "

#: /etc/rc.d/init.d/lirc:89
msgid "Stopping infrared remote control daemon ($prog): "
msgstr "Stoppen van infrared remote control daemon ($prog): "

#: /etc/rc.d/init.d/gkrellmd:33
msgid "Unconfigured: $prog, /etc/gkrellmd.conf not found"
msgstr "Niet-geconfigureerd: $prog, /etc/gkrellmd.conf niet gevonden"

#: /etc/rc.d/init.d/denyhosts:108
msgid "Stopping denyhosts: "
msgstr "Stoppen van denyhosts: "

#: /etc/rc.d/init.d/condor:173
msgid "$0: error: insufficient privileges"
msgstr "$0: fout: onvoldoende rechten"

#: /etc/rc.d/rc.sysinit:786
msgid "Enabling /etc/fstab swaps: "
msgstr "Aanzetten van /etc/fstab swaps: "

#: /etc/rc.d/rc.sysinit:52
msgid "*** Disabling security enforcement for system recovery."
msgstr "*** Uitzetten van beveiliging ten behoeve van systeemherstel."

#: /etc/rc.d/init.d/ushare:76
msgid "Usage: $prog {start|stop|restart|condrestart|reload|status"
msgstr "Gebruik: $prog {start|stop|restart|condrestart|reload|status"

#: /etc/rc.d/init.d/autofs:166
msgid ""
"Usage: $0 {start|forcestart|stop|status|restart|orcerestart|reload|"
"condrestart}"
msgstr "Gebruik: $0 {start|forcestart|stop|status|restart|orcerestart|reload|"
"condrestart}"

#: /etc/rc.d/init.d/tofmipd:56
msgid "Stopping $progname: "
msgstr "Stoppen van $progname: "

#: /etc/rc.d/init.d/netplugd:38
msgid "Shutting down network plug daemon: "
msgstr "Stoppen van network plug daemon: "

#: /etc/rc.d/init.d/postfix:68
msgid "Starting postfix: "
msgstr "Starten van postfix: "

#: /etc/rc.d/init.d/zvbid:32
msgid "Stopping vbi proxy daemon: "
msgstr "Stoppen van vbi proxy daemon: "

#: /etc/rc.d/init.d/apmd:49
msgid "Starting up APM daemon: "
msgstr "Starten van APM-daemon: "

#: /etc/rc.d/init.d/isdn:138
msgid "Unloading ISDN modules"
msgstr "Verwijderen van ISDN-modules"

#: /etc/rc.d/rc.sysinit:194
msgid "$dst: no value for hash option, skipping"
msgstr "$dst: geen waarde voor hash-optie, wordt overgeslagen"

#: /etc/sysconfig/network-scripts/ifup-ipv6:100
msgid ""
"Global IPv6 forwarding is enabled in configuration, but not currently "
"enabled in kernel"
msgstr ""
"Globale IPv6-forwarding is aangezet in de configuratie, maar is niet "
"aangezet in de kernel"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:140
msgid ""
"ERROR: [ipv6_log] Syslog is chosen, but binary 'logger' doesn't exist or "
"isn't executable"
msgstr ""
"FOUT: [ipv6_log] Syslog werd gekozen, maar het binaire bestand 'logger' "
"bestaat niet of is niet uitvoerbaar"

#: /etc/rc.d/init.d/flumotion:166
msgid "Usage: $service {start|stop|restart|list|status|clean}"
msgstr "Gebruik: $service {start|stop|restart|list|status|clean}"

#: /etc/rc.d/init.d/imapproxy:34
msgid "Starting up-imapproxy daemon: "
msgstr "Starten van up-imapproxy daemon: "

#: /etc/rc.d/init.d/abrt:97 /etc/rc.d/init.d/acpid:111
#: /etc/rc.d/init.d/cfenvd:74 /etc/rc.d/init.d/cfexecd:71
#: /etc/rc.d/init.d/cfservd:74 /etc/rc.d/init.d/gpm:131
#: /etc/rc.d/init.d/xenconsoled:116 /etc/rc.d/init.d/xend:92
msgid "Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
msgstr ""
"Gebruik: $0 {start|stop|status|restart|condrestart|reload|force-reload}"

#: /etc/rc.d/init.d/sagator:40
msgid "Stopping $name: "
msgstr "Stoppen van $name: "

#: /etc/rc.d/init.d/network:87
msgid "No 802.1Q VLAN support available in kernel."
msgstr "Geen 802.1Q VLAN-ondersteuning beschikbaar in de kernel."

#: /etc/rc.d/init.d/tog-pegasus:100
msgid "CIM server is not running"
msgstr "CIM-server is niet gestart"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:555
msgid "Device '$device' enabling didn't work"
msgstr "Aanzetten van apparaat '$device' is mislukt"

#: /etc/rc.d/init.d/puppet:45
msgid "Stopping puppet: "
msgstr "Stoppen van puppet: "

#: /etc/rc.d/init.d/functions:528
msgid "nN"
msgstr "nN"

#: /etc/rc.d/init.d/ipmi:547
msgid "          start-powercontrol|stop-powercontrol|status-powercontrol"
msgstr "          start-powercontrol|stop-powercontrol|status-powercontrol"

#: /etc/rc.d/init.d/fail2ban:27
msgid "Starting fail2ban: "
msgstr "Starten van fail2ban: "

#: /etc/rc.d/init.d/postgresql:165
msgid "You need to upgrade the data format before using PostgreSQL."
msgstr "U dient het data formaat op te waarderen voor PostgreSQL te gebruiken."

#: /etc/rc.d/init.d/audio-entropyd:27
msgid "Starting Audio Entropy daemon... "
msgstr "Starten van Audio Entropy daemon... "

#: /etc/rc.d/rc.sysinit:631
msgid "Remounting root filesystem in read-write mode: "
msgstr "root-bestandssysteem aankoppelen in lezen-schrijven modus: "

#: /etc/rc.d/init.d/postfix:70
msgid "$prog start"
msgstr "$prog start"

#: /etc/rc.d/init.d/coda-client:47
msgid "Unmounting $mountpoint:"
msgstr "Afkoppelen van $mountpoint:"

#: /etc/rc.d/init.d/yum-cron:57
msgid "Nightly yum update is enabled."
msgstr "Nachtelijke yum update is aangezet."

#: /etc/rc.d/init.d/halt:88 /etc/rc.d/init.d/ntpdate:55
msgid "Syncing hardware clock to system time"
msgstr "Synchroniseren van hardware klok met de systeemtijd"

#: /etc/rc.d/init.d/sshd:111
msgid "Configuration file or keys are invalid"
msgstr "Configuratiebestand of toetsen zijn niet geldig"

#: /etc/rc.d/init.d/openhpid:168
msgid "Checking for $prog daemon: "
msgstr "Controleren op $prog daemon: "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:125
msgid "NOTICE   "
msgstr "OPMERKING   "

#: /etc/sysconfig/network-scripts/network-functions-ipv6:110
msgid "DEBUG    "
msgstr "DEBUG    "

#: /etc/rc.d/init.d/bandwidthd:72 /etc/rc.d/init.d/gfs:144
#: /etc/rc.d/init.d/gfs2:144 /etc/rc.d/init.d/netbsd-iscsi:95
#: /etc/rc.d/init.d/netfs:173 /etc/rc.d/init.d/network:297
#: /etc/rc.d/init.d/nighthttpd:86 /etc/rc.d/init.d/yum-updateonboot:94
msgid "Usage: $0 {start|stop|restart|reload|status}"
msgstr "Gebruik: $0 {start|stop|restart|reload|status}"

#: /etc/sysconfig/network-scripts/network-functions-ipv6:783
msgid "Part $c of given IPv4 address '$testipv4addr_valid' is out of range"
msgstr ""
"Onderdeel $c van het opgegeven IPv4-adres '$testipv4addr_valid' valt buiten "
"het bereik"

#: /etc/rc.d/init.d/ypbind:44
msgid "Turning on allow_ypbind SELinux boolean"
msgstr "Aanzetten van allow_ypbind SELinux boolean"

#: /etc/rc.d/init.d/monotone:101
msgid "Starting monotone server: "
msgstr "Starten van monotone server: "

#: /etc/rc.d/init.d/asterisk:80
msgid "Starting asterisk: "
msgstr "Starten van asterisk: "

#: /etc/rc.d/init.d/acpid:47
msgid "Starting acpi daemon: "
msgstr "Starten van acpi-daemon: "

#: /etc/rc.d/init.d/cobblerd:52
#, fuzzy
msgid "Starting cobbler daemon: "
msgstr "Starten van xenconsoled daemon: "

#: /etc/rc.d/init.d/netfs:43
msgid "Mounting SMB filesystems: "
msgstr "Aankoppelen van SMB-bestandssystemen: "

#: /etc/rc.d/init.d/ip6tables:131
msgid "${IP6TABLES}: Setting chains to policy $policy: "
msgstr "${IP6TABLES}: Instellen van regels naar beleid $policy: "

#: /etc/rc.d/rc.sysinit:78 /etc/rc.d/rc.sysinit:91 /etc/rc.d/rc.sysinit:582
#: /etc/rc.d/rc.sysinit:605
msgid "Automatic reboot in progress."
msgstr "Automatisch herstarten in werking."

#: /etc/rc.d/init.d/ypbind:56
msgid "Turning off allow_ypbind SELinux boolean"
msgstr "Uitzetten van allow_ypbind SELinux boolean"

#: /etc/sysconfig/network-scripts/ifup-ppp:45
msgid "pppd does not exist or is not executable"
msgstr "pppd bestaat niet of is niet uitvoerbaar"

#: /etc/rc.d/init.d/oki4daemon:32
msgid "Starting oki4daemon: "
msgstr "Starten van oki4daemon: "

#: /etc/rc.d/init.d/functions:504
msgid "$STRING"
msgstr "$STRING"

#: /etc/rc.d/init.d/ip6tables:285
msgid "${IP6TABLES}: Firewall modules are not loaded."
msgstr "${IP6TABLES}: Firewall modules zijn niet geladen."

#: /etc/rc.d/init.d/apt:32
msgid "Enabling nightly apt update: "
msgstr "Aanzetten van nachtelijke apt update: "

#: /etc/rc.d/init.d/ctdb:148
#, fuzzy
msgid "Shutting down ctdbd service: "
msgstr "Stoppen van nsd-services: "

#: /etc/rc.d/init.d/cgred:115
#, fuzzy
msgid "Reloading rules configuration..."
msgstr "Herladen van configuratie: "

#: /etc/rc.d/init.d/sendmail:93
msgid "reloading sm-client: "
msgstr "herladen van sm-client: "

#: /etc/rc.d/init.d/qemu:31
msgid "Registering binary handler for qemu applications"
msgstr "Registreren van binaire verwerker voor qemu applicaties"

#: /etc/rc.d/init.d/nsd:57
msgid "Stopping nsd: "
msgstr "Stoppen van nsd: "

#: /etc/sysconfig/network-scripts/ifup-sl:54
msgid "dip started for $DEVICE on $MODEMPORT at $LINESPEED"
msgstr "dip gestart voor $DEVICE op $MODEMPORT met $LINESPEED"

#: /etc/rc.d/init.d/netfs:161
msgid "/proc filesystem unavailable"
msgstr "/proc bestandssysteem niet beschikbaar"

#: /etc/rc.d/init.d/nfs:106
msgid "Starting NFS mountd: "
msgstr "Starten van NFS-mountd: "

#: /etc/rc.d/init.d/functions:394 /etc/rc.d/init.d/functions:400
msgid "${base} (pid $pid) is running..."
msgstr "${base} (pid $pid) is gestart..."

#: /etc/rc.d/init.d/denyhosts:53
msgid "Enabling denyhosts cron service: "
msgstr "Aanzetten van denyhosts cron service: "

#: /etc/rc.d/init.d/funcd:93
#, fuzzy
msgid "Stopping func daemon: "
msgstr "Stoppen van xend daemon: "

#: /etc/rc.d/init.d/smokeping:51
#, fuzzy
msgid "Reloading smokeping: "
msgstr "Herladen van ser2net: "

#: /etc/rc.d/init.d/rpcgssd:116 /etc/rc.d/init.d/rpcidmapd:100
#: /etc/rc.d/init.d/rpcsvcgssd:114
msgid "Usage: $0 {start|stop|restart|condstart|condrestart|status|condstop}"
msgstr "Gebruik: $0 {start|stop|restart|condstart|condrestart|status|condstop}"

#: /etc/rc.d/init.d/moodle:67
msgid "Moodle cron job is enabled."
msgstr "Moodle cron job is aangezet."

#: /etc/rc.d/init.d/yum-updatesd:34
msgid "Starting yum-updatesd: "
msgstr "Starten van yum-updatesd: "

#: /etc/rc.d/init.d/ip6tables:183
msgid "${IP6TABLES}: Applying firewall rules: "
msgstr "${IP6TABLES}: Toepassen van firewall regels: "

#: /etc/rc.d/init.d/netfs:45
msgid "Mounting NCP filesystems: "
msgstr "Aankoppelen van NCP-bestandssystemen: "

#: /etc/rc.d/init.d/ajaxterm:35 /etc/rc.d/init.d/amd:45
#: /etc/rc.d/init.d/arpwatch:47 /etc/rc.d/init.d/atd:45
#: /etc/rc.d/init.d/atop:29 /etc/rc.d/init.d/auditd:81
#: /etc/rc.d/init.d/auth2:35 /etc/rc.d/init.d/autofs:93
#: /etc/rc.d/init.d/autogroup:56 /etc/rc.d/init.d/autohome:56
#: /etc/rc.d/init.d/beanstalkd:47 /etc/rc.d/init.d/boa:46
#: /etc/rc.d/init.d/bootparamd:47 /etc/rc.d/init.d/bro:127
#: /etc/rc.d/init.d/cfexecd:31 /etc/rc.d/init.d/cfservd:35
#: /etc/rc.d/init.d/chronyd:93 /etc/rc.d/init.d/clamav-milter:32
#: /etc/rc.d/init.d/clamd-wrapper:54 /etc/rc.d/init.d/coda-client:42
#: /etc/rc.d/init.d/codasrv:38 /etc/rc.d/init.d/collectd:35
#: /etc/rc.d/init.d/collectl:41 /etc/rc.d/init.d/couchdb:48
#: /etc/rc.d/init.d/cpuspeed:108 /etc/rc.d/init.d/crond:55
#: /etc/rc.d/init.d/ctrlproxy:50 /etc/rc.d/init.d/cups:68
#: /etc/rc.d/init.d/dbmail-imapd:44 /etc/rc.d/init.d/dbmail-lmtpd:45
#: /etc/rc.d/init.d/dbmail-pop3d:45 /etc/rc.d/init.d/dbmail-timsieved:46
#: /etc/rc.d/init.d/dc_client:41 /etc/rc.d/init.d/dc_server:37
#: /etc/rc.d/init.d/ddclient:39 /etc/rc.d/init.d/dhcp-fwd:49
#: /etc/rc.d/init.d/distccd:51 /etc/rc.d/init.d/dovecot:54
#: /etc/rc.d/init.d/dropbear:78 /etc/rc.d/init.d/fcron_watch_config:41
#: /etc/rc.d/init.d/flow-capture:52 /etc/rc.d/init.d/fyre-cluster:39
#: /etc/rc.d/init.d/glusterfsd:37 /etc/rc.d/init.d/gmediaserver:69
#: /etc/rc.d/init.d/haproxy:50 /etc/rc.d/init.d/honeyd:61
#: /etc/rc.d/init.d/httpd:66 /etc/rc.d/init.d/ip-sentinel:51
#: /etc/rc.d/init.d/ircd:44 /etc/rc.d/init.d/irqbalance:59
#: /etc/rc.d/init.d/iscsi:68 /etc/rc.d/init.d/iscsid:71
#: /etc/rc.d/init.d/jetty:90 /etc/rc.d/init.d/kadmin:50
#: /etc/rc.d/init.d/keepalived:39 /etc/rc.d/init.d/kojid:50
#: /etc/rc.d/init.d/kojira:50 /etc/rc.d/init.d/kprop:33
#: /etc/rc.d/init.d/krb524:44 /etc/rc.d/init.d/krb5kdc:36
#: /etc/rc.d/init.d/ldap:191 /etc/rc.d/init.d/lighttpd:50
#: /etc/rc.d/init.d/mailgraph:50 /etc/rc.d/init.d/mcstrans:63
#: /etc/rc.d/init.d/memcached:49 /etc/rc.d/init.d/milter-greylist:40
#: /etc/rc.d/init.d/milter-regex:44 /etc/rc.d/init.d/mydns:34
#: /etc/rc.d/init.d/mysqld:105 /etc/rc.d/init.d/mysqld:109
#: /etc/rc.d/init.d/mysqld:112 /etc/rc.d/init.d/mysqld:116
#: /etc/rc.d/init.d/ndbd:69 /etc/rc.d/init.d/ndbd:71 /etc/rc.d/init.d/ndbd:75
#: /etc/rc.d/init.d/ndb_mgmd:74 /etc/rc.d/init.d/ndb_mgmd:76
#: /etc/rc.d/init.d/ndb_mgmd:80 /etc/rc.d/init.d/nessusd:47
#: /etc/rc.d/init.d/nginx:43 /etc/rc.d/init.d/ngircd:34
#: /etc/rc.d/init.d/npcd:43 /etc/rc.d/init.d/nscd:50 /etc/rc.d/init.d/ntop:50
#: /etc/rc.d/init.d/nuauth:74 /etc/rc.d/init.d/nufw:71
#: /etc/rc.d/init.d/nxtvepgd:43 /etc/rc.d/init.d/oidentd:40
#: /etc/rc.d/init.d/openhpid:137 /etc/rc.d/init.d/openhpid:149
#: /etc/rc.d/init.d/openser:32 /etc/rc.d/init.d/pads:53
#: /etc/rc.d/init.d/plague-builder:41 /etc/rc.d/init.d/plague-server:42
#: /etc/rc.d/init.d/poker-bot:45 /etc/rc.d/init.d/poker-server:48
#: /etc/rc.d/init.d/portreserve:60 /etc/rc.d/init.d/postgrey:41
#: /etc/rc.d/init.d/prelude-correlator:50 /etc/rc.d/init.d/prelude-manager:32
#: /etc/rc.d/init.d/psad:81 /etc/rc.d/init.d/pure-ftpd:40
#: /etc/rc.d/init.d/racoon:30 /etc/rc.d/init.d/rarpd:52
#: /etc/rc.d/init.d/ratbox-services:38 /etc/rc.d/init.d/rbldnsd:96
#: /etc/rc.d/init.d/rinetd:34 /etc/rc.d/init.d/ris-linuxd:57
#: /etc/rc.d/init.d/roundup:37 /etc/rc.d/init.d/rpcbind:55
#: /etc/rc.d/init.d/rtpproxy:30 /etc/rc.d/init.d/rwalld:52
#: /etc/rc.d/init.d/saslauthd:49 /etc/rc.d/init.d/scanbuttond:45
#: /etc/rc.d/init.d/sec:44 /etc/rc.d/init.d/sensord:44 /etc/rc.d/init.d/ser:45
#: /etc/rc.d/init.d/sge_execd:62 /etc/rc.d/init.d/sgemaster:315
#: /etc/rc.d/init.d/sip-redirect:40 /etc/rc.d/init.d/smsd:36
#: /etc/rc.d/init.d/snmpd:54 /etc/rc.d/init.d/snmptrapd:51
#: /etc/rc.d/init.d/spamassassin:51 /etc/rc.d/init.d/spampd:37
#: /etc/rc.d/init.d/squid:100 /etc/rc.d/init.d/squidGuard:94
#: /etc/rc.d/init.d/sshd:137 /etc/rc.d/init.d/syslog-ng:44
#: /etc/rc.d/init.d/systemtap:538 /etc/rc.d/init.d/tclhttpd:151
#: /etc/rc.d/init.d/tcsd:101 /etc/rc.d/init.d/thttpd:40
#: /etc/rc.d/init.d/tinyerp-server:57 /etc/rc.d/init.d/tinyproxy:45
#: /etc/rc.d/init.d/tor:45 /etc/rc.d/init.d/trytond:57
#: /etc/rc.d/init.d/tuned:42 /etc/rc.d/init.d/ucarp:100
#: /etc/rc.d/init.d/ulogd:48 /etc/rc.d/init.d/update:50
#: /etc/rc.d/init.d/update:57 /etc/rc.d/init.d/upnpd:46
#: /etc/rc.d/init.d/ups:74 /etc/rc.d/init.d/ushare:36
#: /etc/rc.d/init.d/vdradmind:36 /etc/rc.d/init.d/vtund:45
#: /etc/rc.d/init.d/wdaemon:51 /etc/rc.d/init.d/wpa_supplicant:47
#: /etc/rc.d/init.d/xinetd:83 /etc/rc.d/init.d/zfs-fuse:142
#: /etc/rc.d/init.d/zoneminder:58
msgid "Stopping $prog: "
msgstr "Stoppen van $prog: "

#: /etc/rc.d/init.d/audio-entropyd:34
msgid "Shutting down Audio Entropy daemon: "
msgstr "Stoppen van Audio Entropy daemon: "

#~ msgid "Module $module is loaded."
#~ msgstr "Module $module is geladen."

#~ msgid "Reloading Resource Configuration: "
#~ msgstr "Herladen van resource-configuratie: "

#~ msgid "Starting $schedd_prog: "
#~ msgstr "Starten van $schedd_prog: "

#~ msgid "Can not shutdown iSCSI. Root is on a iSCSI disk."
#~ msgstr "Kan iSCSI niet afsluiten. Root bevindt zich op een iSCSI disk."

#~ msgid "Stopping iSCSI daemon: "
#~ msgstr "Stoppen van iSCSI-daemon: "

#~ msgid "Active GFS2 mountpoints: "
#~ msgstr "Actieve GFS2-koppelpunten: "

#~ msgid "Clearing database"
#~ msgstr "Wissen van database"

#~ msgid "Loading $module kernel module: "
#~ msgstr "Laden van $module kernel module: "

#~ msgid "Starting disk encryption:"
#~ msgstr "Starten van disk-encryptie:"

#~ msgid ""
#~ "Usage: $0 {start|stop|status|restart|try-restart|condrestart|reload|force-"
#~ "reload|cleardb [test][verbose]}"
#~ msgstr ""
#~ "Gebruik: $0 {start|stop|status|restart|try-restart|condrestart|reload|"
#~ "force-reload|cleardb [test][verbose]}"

#~ msgid "Starting disk encryption using the RNG:"
#~ msgstr "Starten van disk-encryptie gebruik makend van de RNG:"

#~ msgid "Stopping $DESC $NAME :"
#~ msgstr "Stoppen van $DESC $NAME :"

#~ msgid "Unmounting GFS filesystems (lazy): "
#~ msgstr "Afkoppelen van GFS-bestandssystemen (lazy): "

#~ msgid "Module $module isn't loaded."
#~ msgstr "Module $module is niet geladen."

#~ msgid "Unmounting GFS2 filesystems: "
#~ msgstr "Afkoppelen van GFS2-bestandssystemen: "

#~ msgid "Shutting down dund: "
#~ msgstr "Stoppen van dund: "

#~ msgid "Starting nsd... "
#~ msgstr "Starten van nsd... "

#~ msgid "Active GFS mountpoints: "
#~ msgstr "Actieve GFS-koppelpunten: "

#~ msgid "Shutting down RPC $PROG: "
#~ msgstr "Stoppen van RPC $PROG: "

#~ msgid "Starting $DESC $NAME :"
#~ msgstr "Starten van $DESC $NAME :"

#~ msgid "Starting pand: "
#~ msgstr "Starten van pand: "

#~ msgid "Unmounting GFS filesystems: "
#~ msgstr "Afkoppelen van GFS-bestandssystemen: "

#~ msgid "Configured GFS mountpoints: "
#~ msgstr "Geconfigureerde GFS-koppelpunten: "

#~ msgid "Waiting for services to stop: "
#~ msgstr "Wachten op het stoppen van services: "

#~ msgid "Mounting GFS filesystems: "
#~ msgstr "Aankoppelen van GFS-bestandssystemen: "

#~ msgid "Stopping $schedd_prog: "
#~ msgstr "Stoppen van $schedd_prog: "

#~ msgid "Starting ltsp-$prog: "
#~ msgstr "Starten van ltsp-$prog: "

#~ msgid "Services are stopped."
#~ msgstr "Services zijn gestopt."

#~ msgid "Configured GFS2 mountpoints: "
#~ msgstr "Geconfigureerde GFS2-koppelpunten: "

#~ msgid "Shutting down ltsp-$prog: "
#~ msgstr "Stoppen van ltsp-$prog: "

#~ msgid "Starting $prog:"
#~ msgstr "Starten van $prog:"

#~ msgid "Cannot start $prog: SELinux not enabled"
#~ msgstr "Kan $prog niet starten: SELinux niet aangezet"

#~ msgid "Mounting GFS2 filesystems: "
#~ msgstr "Aankoppelen van GFS2-bestandssystemen: "

#~ msgid "Starting iSCSI daemon: "
#~ msgstr "Starten van iSCSI-daemon: "

#~ msgid "Usage: $0 {start|stop|restart|reload|force-reload}"
#~ msgstr "Gebruik: $0 {start|stop|restart|reload|force-reload}"

#~ msgid "Unmounting GFS2 filesystems (lazy): "
#~ msgstr "Afkoppelen van GFS2-bestandssystemen (lazy): "

#~ msgid "  blkbackd"
#~ msgstr "  blkbackd"

#~ msgid "  "
#~ msgstr "  "

#~ msgid "Starting NetworkManagerDispatcher daemon: "
#~ msgstr "Starten van NetworkManagerDispatcher daemon: "

#~ msgid "Failed to load firmware."
#~ msgstr "Kon firmware niet laden."

#~ msgid "Setting up iSCSI targets: "
#~ msgstr "Instellen van iSCSI-targets: "

#~ msgid "customized): "
#~ msgstr "customized): "

#~ msgid "Stopping NetworkManagerDispatcher daemon: "
#~ msgstr "Stoppen van NetworkManagerDispatcher daemon: "

#~ msgid "Usage: $0 {condrestart|start|stop|restart|reload|status}"
#~ msgstr "Gebruik: $0 {condrestart|start|stop|restart|reload|status}"

#~ msgid "Stopping $servicename: "
#~ msgstr "Stoppen van $servicename: "

#~ msgid "  xenstored"
#~ msgstr "  xenstored"

#~ msgid "X is now configured.  Starting firstboot."
#~ msgstr "X is nu geconfigureerd.  Opstarten van firstboot."

#~ msgid "Usage: nfs {start|stop|status|restart|reload|condrestart}"
#~ msgstr "Gebruik: nfs {start|stop|status|restart|reload|condrestart}"

#~ msgid "Extracting kadm5 Service Keys: "
#~ msgstr "Uitpakken van de kadm5 service sleutels: "

#~ msgid "Usage: $0 {start|stop|restart|status|force-reload}"
#~ msgstr "Gebruik: $0 {start|stop|restart|status|force-reload}"

#~ msgid "full mode): "
#~ msgstr "full mode): "

#~ msgid "X is not configured.  Running system-config-display."
#~ msgstr "X is niet geconfigureerd.  Opstarten van system-config-display."

#~ msgid "Usage: ${0##*/} {start|stop|status|restart|reload|condrestart}"
#~ msgstr "Gebruik: ${0##*/} {start|stop|status|restart|reload|condrestart}"

#~ msgid "Disabling PLX devices... "
#~ msgstr "Uitzetten van PLX apparaten... "

#~ msgid "$prog stopped but subsys locked..."
#~ msgstr "$prog is gestopt, maar subsysteem is vergrendeld..."

#~ msgid "  xenconsoled"
#~ msgstr "  xenconsoled"

#~ msgid "Loading isicom firmware... "
#~ msgstr "Laden van isicom firmware... "

# 'background readahead' onvertaald gelaten omdat het een naam is van een service
#~ msgid "Starting background readahead ($LTYPE, "
#~ msgstr "Starten van background readahead ($LTYPE, "

#~ msgid "Shut down poker-bot first!"
#~ msgstr "Schakel poker-bot eerst uit!"

#~ msgid "Bridge support not available in this kernel"
#~ msgstr "Bridge ondersteuning niet beschikbaar in deze kernel"

#~ msgid "Loading PLX (isicom) modules... "
#~ msgstr "Laden van PLX (isicom) modules... "

#~ msgid "  netbackd"
#~ msgstr "  netbackd"

#~ msgid "  evtchnd"
#~ msgstr "  evtchnd"

#~ msgid "cannot find ipsec command"
#~ msgstr "kan ipsec commando niet vinden"

#~ msgid "Starting NFS locking: "
#~ msgstr "Starten van NFS-locking: "

#~ msgid "Usage: $0 {start|stop|status|restart|probe|condrestart}"
#~ msgstr "Gebruik: $0 {start|stop|status|restart|probe|condrestart}"

#~ msgid "poker-server must be running"
#~ msgstr "poker-server dient gestart te zijn"

#~ msgid "fast mode): "
#~ msgstr "fast mode): "

#~ msgid ""
#~ "Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-"
#~ "reloadstatus}"
#~ msgstr ""
#~ "Gebruik: $0 {start|stop|restart|try-restart|condrestart|reload|force-"
#~ "reloadstatus}"

#~ msgid "Starting $servicename: "
#~ msgstr "Starten van $servicename: "

#~ msgid "Starting imapproxyd: "
#~ msgstr "Starten van imapproxyd: "

#~ msgid "Failed to load module: isicom"
#~ msgstr "Kon module niet laden: isicom"

#~ msgid "$prog stopped but pid file exists..."
#~ msgstr "$prog is gestopt, maar pid-bestand bestaat..."

#~ msgid "Turning off network shutdown. "
#~ msgstr "Uitzetten van stoppen netwerk. "

#~ msgid "Shutting down $MODEL: "
#~ msgstr "Stoppen van $MODEL: "

# 'Zoeken naar' klinkt beter dan 'Controleren op'
#~ msgid "Checking for hardware changes"
#~ msgstr "Controleren op veranderingen aan de hardware"

#~ msgid "OK"
#~ msgstr "OK"

#~ msgid "Starting $subsys: "
#~ msgstr "Starten van $subsys: "

#~ msgid "no response, killing with -TERM "
#~ msgstr "geen antwoord, stoppen met KILL signaal -TERM "

#~ msgid "Starting pmud daemon: "
#~ msgstr "Starten van pmud daemon: "

#~ msgid "no virtual addresses are configured in ${CONFDIR}:"
#~ msgstr "er zijn geen virtuele adressen geconfigureerd in ${CONFDIR}:"

#~ msgid "Usage: apmd {start|stop|status|restart|reload|condrestart}"
#~ msgstr "Gebruik: apmd {start|stop|status|restart|reload|condrestart}"

#~ msgid "Loading default keymap ($KEYTABLE): "
#~ msgstr "Laden van standaard toetsenbordindeling ($KEYTABLE): "

#~ msgid "Usage: $0 {start|stop|reload|report|restart|status}"
#~ msgstr "Gebruik: $0 {start|stop|reload|report|restart|status}"

#~ msgid "Loading additional $IP6TABLES modules: "
#~ msgstr "Laden van additionele $IP6TABLES modules: "

#~ msgid "all ucarp daemons stopped and IP addresses unassigned:"
#~ msgstr ""
#~ "alle ucarp daemons zijn gestopt en IP-adressen zijn niet toegewezen:"

#~ msgid "no VIP_ADDRESS found in ${FILE}, skipped VIP ID ${ID}:"
#~ msgstr "geen VIP_ADDRESS gevonden in ${FILE}, VIP ID ${ID} overgeslagen:"

#~ msgid "all ucarp configurations were applied successfully:"
#~ msgstr "alle ucarp configuraties zijn succesvol toegepast:"

#~ msgid "error running one or more of the ucarp daemon instances:"
#~ msgstr "fout bij het opstarten van een of meerdere ucarp daemon instanties:"

#~ msgid "error in one or more of the ucarp configurations:"
#~ msgstr "fout in een of meerdere ucarp configuraties:"

#~ msgid "Loading default keymap"
#~ msgstr "Laden van standaard toetsenbordindeling"

#~ msgid "Stopping $subsys: "
#~ msgstr "Stoppen van $subsys: "

#~ msgid "${base} has run"
#~ msgstr "${base} is gestart"

#~ msgid "no PASSWORD found in ${FILE}, skipped VIP ID ${ID}:"
#~ msgstr "geen WACHTWOORD gevonden in ${FILE}, VIP ID ${ID} overgeslagen:"

#~ msgid "Running system reconfiguration tool"
#~ msgstr "Opstarten van systeem herconfiguratie-hulpmiddel"

#~ msgid "Setting clock $CLOCKDEF: `date`"
#~ msgstr "Instellen van klok $CLOCKDEF: `date`"

#~ msgid "no BIND_ADDRESS found in ${FILE}, skipped VIP ID ${ID}:"
#~ msgstr "geen BIND_ADDRESS gevonden in ${FILE}, VIP ID ${ID} overgeslagen:"

#~ msgid "it seems like no ucarp daemon were running:"
#~ msgstr "het lijkt er op dat er geen ucarp daemons actief waren:"

#~ msgid "Stopping ConsoleKit: "
#~ msgstr "Stoppen van ConsoleKit: "

#~ msgid "Unloading $IPTABLES modules: "
#~ msgstr "Verwijderen van $IPTABLES modules: "

#~ msgid "Stopping $prog:"
#~ msgstr "Stoppen van $prog:"

#~ msgid "Loading default keymap: "
#~ msgstr "Laden van standaard toetsenbordindeling: "

#~ msgid "ID out of range (1-255) for ${FILE}, skipped VIP ID ${ID}:"
#~ msgstr "ID buiten bereik (1-255) voor ${FILE}, VIP ID ${ID} overgeslagen:"

#~ msgid "Starting ConsoleKit: "
#~ msgstr "Starten van ConsoleKit: "

#~ msgid "Networking not configured - exiting"
#~ msgstr "Netwerk niet geconfigureerd - gestopt"

#~ msgid "Firewall is stopped."
#~ msgstr "Firewall is gestopt."

#~ msgid "Usage: $0 {start|stop|status|restart|condrestart|reload|cleardb}"
#~ msgstr "Gebruik: $0 {start|stop|status|restart|condrestart|reload|cleardb}"

#~ msgid "Starting $OTRS_PROG.."
#~ msgstr "Starten van $OTRS_PROG.."

#~ msgid "reloading $prog: "
#~ msgstr "herladen van $prog: "

#~ msgid "cannot stop crond: crond is not running."
#~ msgstr "kan crond niet stoppen: crond is niet actief."

#~ msgid "Stopping OpenPBX: "
#~ msgstr "Stoppen van OpenPBX: "

#~ msgid "Starting OpenPBX: "
#~ msgstr "Starten van OpenPBX: "

#~ msgid "Stopping iSCSI initiator service: "
#~ msgstr "Stoppen van iSCSI initiator service: "

#~ msgid "$prog: Usage: < start | stop | restart | reload | status >"
#~ msgstr "$prog: Gebruik: < start | stop | restart | reload | status >"

#~ msgid "$1 (pid $pid) is running..."
#~ msgstr "$1 (pid $pid) is gestart..."

#~ msgid "or install caching-nameserver."
#~ msgstr "of installeer caching-nameserver."

#~ msgid "cannot start crond: crond already running."
#~ msgstr "kan crond niet starten: crond is reeds gestart."

#~ msgid "cannot start crond: crond is already running."
#~ msgstr "kan crond niet starten: crond is reeds gestart."

#~ msgid "Listening for an NIS domain server."
#~ msgstr "Luisteren naar een NIS domein server."

#~ msgid "$prog ( $pid ) listening on $sender"
#~ msgstr "$prog ( $pid ) luistert op $sender"

#~ msgid "ipchains and $IP6TABLES can not be used together."
#~ msgstr "ipchains en $IP6TABLES kunnen niet naast elkaar worden gebruikt."

#~ msgid "Starting $MODEL: "
#~ msgstr "Starten van $MODEL: "

#~ msgid "Usage: $0 {start|stop|status|restart|condrestart} [instance-name]"
#~ msgstr ""
#~ "Gebruik: $0 {start|stop|status|restart|condrestart} [instantie-naam]"

#~ msgid "Usage: $0 {start|stop|status|restart|condrestart|reload|probe}"
#~ msgstr "Gebruik: $0 {start|stop|status|restart|condrestart|reload|probe}"

#~ msgid "Converting old group quota files: "
#~ msgstr "Oude groepsquota-bestanden omzetten: "

#~ msgid "Starting iSCSI initiator service: "
#~ msgstr "Starten van iSCSI initiator service: "

#~ msgid "  $TYPE tables: "
#~ msgstr "  $TYPE tables: "

#~ msgid "Usage: $0 {start|stop|restart|condstart|condrestart|condstop|status}"
#~ msgstr ""
#~ "Gebruik: $0 {start|stop|restart|condstart|condrestart|condstop|status}"

#~ msgid "Error in named configuration"
#~ msgstr "Fout in named configuratie"

#~ msgid "Converting old user quota files: "
#~ msgstr "Oude gebruikersquota-bestanden omzetten: "

#~ msgid "Shutting down RPC gssd: "
#~ msgstr "Stoppen van RPC gssd: "

#~ msgid "Final start of $OTRS_PROG.. done"
#~ msgstr "Laatste start van $OTRS_PROG.. klaar"

#~ msgid ""
#~ "I can't find any configuration file. You can create it by system-config-"
#~ "bind"
#~ msgstr ""
#~ "Ik kan geen enkel configuratiebestand vinden. U kunt het aanmaken met "
#~ "behulp van system-config-bind"

#~ msgid "Shutting down RPC idmapd: "
#~ msgstr "Stoppen van RPC idmapd: "

#~ msgid "ipchains and $IPTABLES can not be used together."
#~ msgstr "ipchains en $IPTABLES kunnen niet naast elkaar worden gebruikt."

#~ msgid "Final shutdown of $OTRS_PROG.. done"
#~ msgstr "Laatste stop van $OTRS_PROG.. klaar"

# werkwoord of znw?
#~ msgid "Binding to the NIS domain: "
#~ msgstr "Binding maken met het NIS domein: "

#~ msgid "Unmounting CFS dir: "
#~ msgstr "Afkoppelen van CFS-map: "

#~ msgid "Enslaving ${DEVICE} to ${MASTER}"
#~ msgstr "${DEVICE} als slaaf gebruiken voor ${MASTER}"

#~ msgid "mdmpd"
#~ msgstr "mdmpd"

#~ msgid "Mounting CFS dir: "
#~ msgstr "Aankoppelen van CFS-map: "

#~ msgid "$src is not a swap partition"
#~ msgstr "$src is geen swap partitie"

#~ msgid ""
#~ "no ifcfg-${BIND_INTERFACE} file found for carp ${FILE} configuration:"
#~ msgstr ""
#~ "geen ifcfg-${BIND_INTERFACE} bestand gevonden voor carp ${FILE} "
#~ "configuratie:"

#~ msgid "Usage: killproc [-p pidfile] {program} [-signal]"
#~ msgstr "Gebruik: killproc [-p pid-bestand] {programma} [-signaal]"

#~ msgid "bringing down carp managed interface ${VIP_INTERFACE}:"
#~ msgstr "stoppen van carp managed interface ${VIP_INTERFACE}:"

#~ msgid "no IPADDR found in interface file ifcfg-${BIND_INTERFACE}:"
#~ msgstr "geen IPADDR gevonden in interface-bestand ifcfg-${BIND_INTERFACE}:"

#~ msgid "disabling netdump"
#~ msgstr "uitzetten van netdump"

#~ msgid "no ifcfg-${VIP_INTERFACE} file found for carp ${FILE} configuration:"
#~ msgstr ""
#~ "geen ifcfg-${VIP_INTERFACE} bestand gevonden voor carp ${FILE} "
#~ "configuratie:"

#~ msgid "Starting Avahi daemon: "
#~ msgstr "Starten van Avahi daemon: "

#~ msgid "Saving panic dump from swap partition:\r"
#~ msgstr "Opslaan van panic dump vanaf swap partitie:\r"

#~ msgid "$1 $prog: "
#~ msgstr "$1 $prog: "

#~ msgid "initializing netdump"
#~ msgstr "initialiseren van netdump"

#~ msgid "Start $x"
#~ msgstr "Start $x"

#~ msgid "$prog is not started..."
#~ msgstr "$prog is niet opgestart..."

#~ msgid "Unmounting file systems (retry): "
#~ msgstr "Afkoppelen van bestandssystemen (opnieuw): "

#~ msgid "Unmounting network block filesystems (retry): "
#~ msgstr "Afkoppelen van netwerk blok-bestandssystemen (opnieuw): "

#~ msgid "Unmounting network block filesystems: "
#~ msgstr "Afkoppelen van netwerk blok-bestandssystemen: "

#~ msgid "Unmounting NFS filesystems: "
#~ msgstr "Afkoppelen van NFS-bestandssystemen: "

#~ msgid ""
#~ "Active Mount Points:\n"
#~ "--------------------"
#~ msgstr ""
#~ "Actieve koppelpunten:\n"
#~ "--------------------"

#~ msgid "Stopping cups-config-daemon: "
#~ msgstr "Stoppen van cups-config-daemon: "

#~ msgid "done. "
#~ msgstr "voltooid. "

#~ msgid "Enabling Athlon powersaving mode..."
#~ msgstr "Aanzetten van Athlon powersaving mode..."

#~ msgid "Stop $command"
#~ msgstr "Stop $command"

#~ msgid "Stopping Red Hat Network Daemon: "
#~ msgstr "Stoppen van Red Hat Network Daemon: "

#~ msgid "Reload map $command"
#~ msgstr "Herladen map $command"

#~ msgid "Checking for changes to /etc/auto.master ...."
#~ msgstr "Controleren op veranderingen in /etc/auto.master ...."

#~ msgid "No Mountpoints Defined"
#~ msgstr "Geen koppelpunten gedefinieerd"

#~ msgid "Unmounting loopback filesystem $match:  "
#~ msgstr "Afkoppelen van loopback-bestandssystemen $match:  "

#~ msgid ""
#~ "Configured Mount Points:\n"
#~ "------------------------"
#~ msgstr ""
#~ "Geconfigureerde koppelpunten:\n"
#~ "------------------------"

#~ msgid "Unmounting file systems: "
#~ msgstr "Afkoppelen van bestandssystemen: "

#~ msgid "Starting cups-config-daemon: "
#~ msgstr "Starten van cups-config-daemon: "

#~ msgid "error! "
#~ msgstr "fout! "

#~ msgid "$BASENAME startup"
#~ msgstr "$BASENAME start op"

#~ msgid "Unmounting NFS filesystems (retry): "
#~ msgstr "Afkoppelen van NFS-bestandssystemen (opnieuw): "

#~ msgid "could not make temp file"
#~ msgstr "kon geen tijdelijk bestand aanmaken"

#~ msgid "Stopping $prog:  "
#~ msgstr "Stoppen van $prog:  "

#~ msgid "Shutting down display manager: "
#~ msgstr "Afsluiten van display manager: "

#~ msgid "Shutting down mDNSResponder services: "
#~ msgstr "Afsluiten van mDNSResponder services: "

#~ msgid "$dev is not a dump device"
#~ msgstr "$dev is geen dump apparaat"

#~ msgid "Shutting down AppleTalk services: "
#~ msgstr "Afsluiten van AppleTalk services: "

#~ msgid "Allow users to login from display manager:"
#~ msgstr "Sta gebruikers toe om aan te melden vanuit de display manager:"

#~ msgid "Shutting down all Xen domains:"
#~ msgstr "Afsluiten van alle Xen domeinen:"

#~ msgid "Usage: $0 {start|stop)"
#~ msgstr "Gebruik: $0 {start|stop}"

#~ msgid "postfix reload"
#~ msgstr "postfix herladen"

#~ msgid "Starting PCMCIA services: "
#~ msgstr "Starten van PCMCIA services: "

#~ msgid "determination of alias_database"
#~ msgstr "vaststellen van alias_database"

#~ msgid "Error in configuration file /etc/named.conf : $named_err"
#~ msgstr "Fout in configuratiebestand /etc/named.conf : $named_err"

#~ msgid "Starting mDNSResponder... "
#~ msgstr "Starten van mDNSResponder... "

#~ msgid "Initializing hardware... "
#~ msgstr "Initialiseren van de hardware... "

#~ msgid "Starting auto Xen domains:"
#~ msgstr "Starten van auto Xen domeinen:"

#~ msgid "postfix stop"
#~ msgstr "postfix stoppen"

#~ msgid "using yenta_socket instead of $PCIC"
#~ msgstr "gebruik yenta_socket in plaats van $PCIC"

#~ msgid "cardmgr is already running."
#~ msgstr "cardmgr is reeds opgestart."

#~ msgid "cardmgr is stopped"
#~ msgstr "cardmgr is gestopt"

#~ msgid "mdadm"
#~ msgstr "mdadm"

#~ msgid "done."
#~ msgstr "voltooid."

#~ msgid "Shutting down PCMCIA services: "
#~ msgstr "Stoppen van PCMCIA services: "

#~ msgid "Stopping IIIMF input server: "
#~ msgstr "Stoppen van IIIMF input server: "

#~ msgid "PCIC module not defined in startup options!"
#~ msgstr "PCIC-module niet gedefinieerd in de opstart-opties!"

#~ msgid "postalias $alias_database"
#~ msgstr "postalias $alias_database"

#~ msgid "postfix start"
#~ msgstr "postfix starten"

#~ msgid " audio"
#~ msgstr " audio"

#~ msgid " done"
#~ msgstr " voltooid"

#~ msgid " network"
#~ msgstr " netwerk"

#~ msgid "Starting IIIMF input server: "
#~ msgstr "Starten van IIIMF input server: "

#~ msgid "Formatting dump device: "
#~ msgstr "Dump apparaat wordt nu geformatteerd: "

#~ msgid "Starting routed (RIP) services: "
#~ msgstr "Starten van routed (RIP) services: "

#~ msgid "Hardware configuration timed out."
#~ msgstr "Er trad een time out op tijdens de hardware configuratie."

#~ msgid "Setting hard drive parameters for ${disk[$device]}: "
#~ msgstr ""
#~ "Parameters aan het instellen voor de harde schijf ${disk[$device]}: "

#~ msgid "Missing parameter 'IPv6 address prefix length' (arg 3)"
#~ msgstr "Parameter 'IPv6 address prefix length' (arg 3) ontbreekt"

#~ msgid "$0: reading microcode status is not yet supported"
#~ msgstr "$0: lezen van microcode-status wordt nog niet ondersteund"

#~ msgid "Run '/usr/sbin/kudzu' from the command line to re-detect."
#~ msgstr ""
#~ "Start '/usr/sbin/kudzu' vanaf de command line om opnieuw te laten "
#~ "detecteren."

#~ msgid "Usage: radvd {start|stop|status|restart|reload|condrestart}"
#~ msgstr "Gebruik: radvd {start|stop|status|restart|reload|condrestart}"

#~ msgid "Checking root filesystem quotas: "
#~ msgstr "root-bestandssysteem quota's controleren: "

#~ msgid "TBD"
#~ msgstr "TBD"

#~ msgid "Stopping routed (RIP) services: "
#~ msgstr "Stoppen van routed (RIP) services: "

#~ msgid "Missing parameter 'IPv6 address to test' (arg 2)"
#~ msgstr "Ontbrekende parameter 'IPv6 address to test' (arg 2)"

#~ msgid "Forcing file system integrity check due to default setting"
#~ msgstr ""
#~ "Integriteitscontrole van het bestandssysteem aan het afdwingen wegens de "
#~ "standaard instellingen"

#~ msgid ""
#~ "An old version of the database format was found.\n"
#~ "You need to upgrade the data format before using PostgreSQL.\n"
#~ "See $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for more information."
#~ msgstr ""
#~ "Een oude database formattering werd gevonden.\n"
#~ "U dient de data-formattering te upgraden voordat u PostgreSQL gebruikt.\n"
#~ "Bekijk $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist voor meer "
#~ "informatie."

#~ msgid "(RAID Repair)"
#~ msgstr "(RAID-herstel)"

#~ msgid "Your system appears to have shut down uncleanly"
#~ msgstr "Het ziet er naar uit dat uw systeem niet correct werd afgesloten"

#~ msgid "Starting up RAID devices: "
#~ msgstr "Opstarten van RAID apparaten: "

#~ msgid "punching nameserver $nameserver through the firewall"
#~ msgstr "pakketten van nameserver $nameserver mogen nu door de firewall heen"

#~ msgid "Not forcing file system integrity check due to default setting"
#~ msgstr ""
#~ "Integriteitscontrole van het bestandssysteem niet afdwingen wegens de "
#~ "standaard instellingen"

#~ msgid "Usage: $0 {start|stop|format|initialformat|status|restart|reload}"
#~ msgstr "Gebruik: $0 {start|stop|format|initialformat|status|restart|reload}"

#~ msgid "diskdump not enabled"
#~ msgstr "diskdump niet aangezet"

#~ msgid "Device not specified in $CONF_DISKDUMP"
#~ msgstr "Apparaat niet opgegeven in $CONF_DISKDUMP"

#~ msgid "Setting up ISA PNP devices: "
#~ msgstr "Opzetten van ISA PNP apparaten: "

#~ msgid "Configuring kernel parameters: "
#~ msgstr "Kernel parameters aan het configureren: "

#~ msgid "module directory $PC not found."
#~ msgstr "module map $PC werd niet gevonden."

#~ msgid "Skipping ISA PNP configuration at users request: "
#~ msgstr ""
#~ "ISA PNP configuratie werd overgeslagen op aanvraag van de gebruiker: "

#~ msgid ""
#~ "Press N within %d seconds to not force file system integrity check..."
#~ msgstr ""
#~ "Druk op N binnen %d seconden om geen integriteitscontrole van het "
#~ "bestandssysteem af te dwingen..."

#~ msgid "diskdump enabled"
#~ msgstr "diskdump aangezet"

#~ msgid "*** An error occurred during the RAID startup"
#~ msgstr "*** Er deed zich een fout voor tijdens het opstarten van RAID"

#~ msgid "Press Y within %d seconds to force file system integrity check..."
#~ msgstr ""
#~ "Druk op J binnen %d seconden om een integriteitscontrole van het "
#~ "bestandssysteem af te dwingen..."

#~ msgid "$prog: Removing firewall opening for $server port 123"
#~ msgstr "$prog: firewall-opening voor $server poort 123 afdichten"

#~ msgid "$prog: Opening firewall for input from $server port 123"
#~ msgstr "$prog: Openen van de firewall voor invoer vanaf $server port 123"

#~ msgid "permission denied (must be superuser)"
#~ msgstr "geen toestemming (moet superuser zijn)"

#~ msgid "Stopping NetWare emulator-server: "
#~ msgstr "Stoppen van NetWare emulator-server: "

#~ msgid "The random data source exists"
#~ msgstr "De random databron bestaat"

#~ msgid "Mounting USB filesystem: "
#~ msgstr "USB-bestandssysteem aankoppelen: "

#~ msgid "$prog has run"
#~ msgstr "$prog is opgestart"

#~ msgid "Could not find /etc/iscsi.conf!"
#~ msgstr "Kon het bestand /etc/iscsi.conf niet vinden!"

#~ msgid "Initializing USB HID interface: "
#~ msgstr "Initialiseren van USB HID interface: "

#~ msgid "  If the command 'raw' still refers to /dev/raw as a file."
#~ msgstr ""
#~ "  Als de opdracht 'raw' nog steeds naar /dev/raw verwijst als bestand."

#~ msgid "Creating initial udev device nodes:"
#~ msgstr "Aanmaken van initiële udev device nodes:"

#~ msgid "done"
#~ msgstr "voltooid"

#~ msgid "Initializing firewire controller ($alias): "
#~ msgstr "Initialiseren van firewire controller ($alias): "

#~ msgid "Stopping iSCSI:"
#~ msgstr "Stoppen van iSCSI:"

#~ msgid "InitiatorName file /etc/initiatorname.iscsi is missing!"
#~ msgstr "InitiatorName bestand /etc/initiatorname.iscsi bestaat niet!"

#~ msgid "Starting NetWare emulator-server: "
#~ msgstr "Starten van NetWare emulator-server: "

#~ msgid "   you'll have to upgrade your util-linux package"
#~ msgstr "   U dient het util-linux pakket up te daten"

#~ msgid "Updating /etc/fstab"
#~ msgstr "Updaten van /etc/fstab"

#~ msgid "Assigning devices: "
#~ msgstr "Toewijzen apparaten: "

#~ msgid "     rawdevices are now located in the directory /dev/raw/ "
#~ msgstr "     rawdevices zijn nu terug te vinden in de map /dev/raw/ "

#~ msgid "Initializing USB keyboard: "
#~ msgstr "Initialiseren van USB toetsenbord: "

#~ msgid "Loading sound module ($alias): "
#~ msgstr "Inladen van de geluidsmodule ($alias): "

#~ msgid "Initializing USB controller ($alias): "
#~ msgstr "Initialiseren van USB controller ($alias): "

#~ msgid " umount"
#~ msgstr " afkoppelen"

#~ msgid "Starting iSCSI: iscsi"
#~ msgstr "Starten van iSCSI: iscsi"

#~ msgid "Initializing USB mouse: "
#~ msgstr "Initialiseren van de USB muis: "

#~ msgid "You need to be root to use this command ! "
#~ msgstr "U dient root te zijn om dit programma te gebruiken ! "

#~ msgid "Initializing random number generator: "
#~ msgstr "Initialiseren van random nummer generator: "

#~ msgid "The random data source is missing"
#~ msgstr "De random data bron is niet aanwezig"

#~ msgid "  Please correct your /etc/sysconfig/rawdevices:"
#~ msgstr "  Gelieve /etc/sysconfig/rawdevices aan te passen:"

#~ msgid "Could not load module iscsi.o"
#~ msgstr "Kon module iscsi.o niet inladen"

#~ msgid "Usage: $0 {start|stop|restart|status|panic|save}"
#~ msgstr "Gebruik: $0 {start|stop|restart|status|panic|save}"

#~ msgid "Loading system font: "
#~ msgstr "Inladen van het lettertype gebruikt door het systeem: "

#~ msgid "No status available for this package"
#~ msgstr "Geen status beschikbaar voor dit pakket"

#~ msgid "Resetting built-in chains to the default ACCEPT policy"
#~ msgstr ""
#~ "Herinstellen van de ingebouwde regels naar het standaard ACCEPT beleid"

#~ msgid "Saving current rules to $IPCHAINS_CONFIG: "
#~ msgstr "Opslaan van huidige regels naar $IPCHAINS_CONFIG: "

#~ msgid "Changing target policies to DENY: "
#~ msgstr "Wijzigen van doel-beleid naar DENY: "

#~ msgid "Applying ipchains firewall rules"
#~ msgstr "Toepassen van de ipchains firewall regels"

#~ msgid "Changing target policies to DENY"
#~ msgstr "Veranderen van doel-beleid naar DENY"

#~ msgid "Finding module dependencies: "
#~ msgstr "Aan het zoeken naar module afhankelijkheden: "

#~ msgid "Mounting proc filesystem: "
#~ msgstr "proc-bestandssysteem aankoppelen: "

#~ msgid " cardmgr."
#~ msgstr " cardmgr."

#~ msgid "Saving current rules to $IPCHAINS_CONFIG"
#~ msgstr "Opslaan van huidige regels naar $IPCHAINS_CONFIG"

#~ msgid "Loading keymap: "
#~ msgstr "Inladen van toetsenbord instelling: "

#~ msgid "Usage: nfs {start|stop|status|restart|reload}"
#~ msgstr "Gebruik: nfs {start|stop|status|restart|reload}"

#~ msgid "Error initializing device ${DEVICE}"
#~ msgstr "Fout tijdens het initialiseren van netwerkkaart ${DEVICE}"
s->sub.trees.tb = Z_NULL;
- {
- uInt bl, bd;
- inflate_huft *tl, *td;
- inflate_codes_statef *c;
-
- bl = 9; /* must be <= 9 for lookahead assumptions */
- bd = 6; /* must be <= 9 for lookahead assumptions */
- t = s->sub.trees.table;
-#ifdef DEBUG_ZLIB
- inflate_hufts = 0;
-#endif
- t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
- s->sub.trees.blens, &bl, &bd, &tl, &td, z);
- ZFREE(z, s->sub.trees.blens);
- if (t != Z_OK)
- {
- if (t == (uInt)Z_DATA_ERROR)
- s->mode = BADB;
- r = t;
- LEAVE
- }
- Tracev((stderr, "inflate: trees ok, %d * %d bytes used\n",
- inflate_hufts, sizeof(inflate_huft)));
- if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
- {
- inflate_trees_free(td, z);
- inflate_trees_free(tl, z);
- r = Z_MEM_ERROR;
- LEAVE
- }
- s->sub.decode.codes = c;
- s->sub.decode.tl = tl;
- s->sub.decode.td = td;
- }
- s->mode = CODES;
- case CODES:
- UPDATE
- if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
- return inflate_flush(s, z, r);
- r = Z_OK;
- inflate_codes_free(s->sub.decode.codes, z);
- inflate_trees_free(s->sub.decode.td, z);
- inflate_trees_free(s->sub.decode.tl, z);
- LOAD
- Tracev((stderr, "inflate: codes end, %lu total out\n",
- z->total_out + (q >= s->read ? q - s->read :
- (s->end - s->read) + (q - s->window))));
- if (!s->last)
- {
- s->mode = TYPE;
- break;
- }
- if (k > 7) /* return unused byte, if any */
- {
- Assert(k < 16, "inflate_codes grabbed too many bytes")
- k -= 8;
- n++;
- p--; /* can always return one */
- }
- s->mode = DRY;
- case DRY:
- FLUSH
- if (s->read != s->write)
- LEAVE
- s->mode = DONEB;
- case DONEB:
- r = Z_STREAM_END;
- LEAVE
- case BADB:
- r = Z_DATA_ERROR;
- LEAVE
- default:
- r = Z_STREAM_ERROR;
- LEAVE
- }
-}
-
-
-int inflate_blocks_free(s, z, c)
-inflate_blocks_statef *s;
-z_streamp z;
-uLongf *c;
-{
- inflate_blocks_reset(s, z, c);
- ZFREE(z, s->window);
- ZFREE(z, s);
- Trace((stderr, "inflate: blocks freed\n"));
- return Z_OK;
-}
-
-
-void inflate_set_dictionary(s, d, n)
-inflate_blocks_statef *s;
-const Bytef *d;
-uInt n;
-{
- zmemcpy((charf *)s->window, d, n);
- s->read = s->write = s->window + n;
-}
-
-/*
- * This subroutine adds the data at next_in/avail_in to the output history
- * without performing any output. The output buffer must be "caught up";
- * i.e. no pending output (hence s->read equals s->write), and the state must
- * be BLOCKS (i.e. we should be willing to see the start of a series of
- * BLOCKS). On exit, the output will also be caught up, and the checksum
- * will have been updated if need be.
- */
-int inflate_addhistory(s, z)
-inflate_blocks_statef *s;
-z_stream *z;
-{
- uLong b; /* bit buffer */ /* NOT USED HERE */
- uInt k; /* bits in bit buffer */ /* NOT USED HERE */
- uInt t; /* temporary storage */
- Bytef *p; /* input data pointer */
- uInt n; /* bytes available there */
- Bytef *q; /* output window write pointer */
- uInt m; /* bytes to end of window or read pointer */
-
- if (s->read != s->write)
- return Z_STREAM_ERROR;
- if (s->mode != TYPE)
- return Z_DATA_ERROR;
-
- /* we're ready to rock */
- LOAD
- /* while there is input ready, copy to output buffer, moving
- * pointers as needed.
- */
- while (n) {
- t = n; /* how many to do */
- /* is there room until end of buffer? */
- if (t > m) t = m;
- /* update check information */
- if (s->checkfn != Z_NULL)
- s->check = (*s->checkfn)(s->check, q, t);
- zmemcpy(q, p, t);
- q += t;
- p += t;
- n -= t;
- z->total_out += t;
- s->read = q; /* drag read pointer forward */
-/* WWRAP */ /* expand WWRAP macro by hand to handle s->read */
- if (q == s->end) {
- s->read = q = s->window;
- m = WAVAIL;
- }
- }
- UPDATE
- return Z_OK;
-}
-
-
-/*
- * At the end of a Deflate-compressed PPP packet, we expect to have seen
- * a `stored' block type value but not the (zero) length bytes.
- */
-int inflate_packet_flush(s)
- inflate_blocks_statef *s;
-{
- if (s->mode != LENS)
- return Z_DATA_ERROR;
- s->mode = TYPE;
- return Z_OK;
-}
-/* --- infblock.c */
-
-/* +++ inftrees.c */
-/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-1996 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* #include "zutil.h" */
-/* #include "inftrees.h" */
-
-char inflate_copyright[] = " inflate 1.0.4 Copyright 1995-1996 Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-/* simplify the use of the inflate_huft type with some defines */
-#define base more.Base
-#define next more.Next
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-
-local int huft_build OF((
- uIntf *, /* code lengths in bits */
- uInt, /* number of codes */
- uInt, /* number of "simple" codes */
- const uIntf *, /* list of base values for non-simple codes */
- const uIntf *, /* list of extra bits for non-simple codes */
- inflate_huft * FAR*,/* result: starting table */
- uIntf *, /* maximum lookup bits (returns actual) */
- z_streamp )); /* for zalloc function */
-
-local voidpf falloc OF((
- voidpf, /* opaque pointer (not used) */
- uInt, /* number of items */
- uInt)); /* size of item */
-
-/* Tables for deflate from PKZIP's appnote.txt. */
-local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- /* see note #13 above about 258 */
-local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
-local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577};
-local const uInt cpdext[30] = { /* Extra bits for distance codes */
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13};
-
-/*
- Huffman code decoding is performed using a multi-level table lookup.
- The fastest way to decode is to simply build a lookup table whose
- size is determined by the longest code. However, the time it takes
- to build this table can also be a factor if the data being decoded
- is not very long. The most common codes are necessarily the
- shortest codes, so those codes dominate the decoding time, and hence
- the speed. The idea is you can have a shorter table that decodes the
- shorter, more probable codes, and then point to subsidiary tables for
- the longer codes. The time it costs to decode the longer codes is
- then traded against the time it takes to make longer tables.
-
- This results of this trade are in the variables lbits and dbits
- below. lbits is the number of bits the first level table for literal/
- length codes can decode in one step, and dbits is the same thing for
- the distance codes. Subsequent tables are also less than or equal to
- those sizes. These values may be adjusted either when all of the
- codes are shorter than that, in which case the longest code length in
- bits is used, or when the shortest code is *longer* than the requested
- table size, in which case the length of the shortest code in bits is
- used.
-
- There are two different values for the two tables, since they code a
- different number of possibilities each. The literal/length table
- codes 286 possible values, or in a flat code, a little over eight
- bits. The distance table codes 30 possible values, or a little less
- than five bits, flat. The optimum values for speed end up being
- about one bit more than those, so lbits is 8+1 and dbits is 5+1.
- The optimum values may differ though from machine to machine, and
- possibly even between compilers. Your mileage may vary.
- */
-
-
-/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
-#define BMAX 15 /* maximum bit length of any code */
-#define N_MAX 288 /* maximum number of codes in any set */
-
-#ifdef DEBUG_ZLIB
- uInt inflate_hufts;
-#endif
-
-local int huft_build(b, n, s, d, e, t, m, zs)
-uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
-uInt n; /* number of codes (assumed <= N_MAX) */
-uInt s; /* number of simple-valued codes (0..s-1) */
-const uIntf *d; /* list of base values for non-simple codes */
-const uIntf *e; /* list of extra bits for non-simple codes */
-inflate_huft * FAR *t; /* result: starting table */
-uIntf *m; /* maximum lookup bits, returns actual */
-z_streamp zs; /* for zalloc function */
-/* Given a list of code lengths and a maximum table size, make a set of
- tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
- if the given code set is incomplete (the tables are still built in this
- case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
- lengths), or Z_MEM_ERROR if not enough memory. */
-{
-
- uInt a; /* counter for codes of length k */
- uInt c[BMAX+1]; /* bit length count table */
- uInt f; /* i repeats in table every f entries */
- int g; /* maximum code length */
- int h; /* table level */
- register uInt i; /* counter, current code */
- register uInt j; /* counter */
- register int k; /* number of bits in current code */
- int l; /* bits per table (returned in m) */
- register uIntf *p; /* pointer into c[], b[], or v[] */
- inflate_huft *q; /* points to current table */
- struct inflate_huft_s r; /* table entry for structure assignment */
- inflate_huft *u[BMAX]; /* table stack */
- uInt v[N_MAX]; /* values in order of bit length */
- register int w; /* bits before this table == (l * h) */
- uInt x[BMAX+1]; /* bit offsets, then code stack */
- uIntf *xp; /* pointer into x */
- int y; /* number of dummy codes added */
- uInt z; /* number of entries in current table */
-
-
- /* Generate counts for each bit length */
- p = c;
-#define C0 *p++ = 0;
-#define C2 C0 C0 C0 C0
-#define C4 C2 C2 C2 C2
- C4 /* clear c[]--assume BMAX+1 is 16 */
- p = b; i = n;
- do {
- c[*p++]++; /* assume all entries <= BMAX */
- } while (--i);
- if (c[0] == n) /* null input--all zero length codes */
- {
- *t = (inflate_huft *)Z_NULL;
- *m = 0;
- return Z_OK;
- }
-
-
- /* Find minimum and maximum length, bound *m by those */
- l = *m;
- for (j = 1; j <= BMAX; j++)
- if (c[j])
- break;
- k = j; /* minimum code length */
- if ((uInt)l < j)
- l = j;
- for (i = BMAX; i; i--)
- if (c[i])
- break;
- g = i; /* maximum code length */
- if ((uInt)l > i)
- l = i;
- *m = l;
-
-
- /* Adjust last length count to fill out codes, if needed */
- for (y = 1 << j; j < i; j++, y <<= 1)
- if ((y -= c[j]) < 0)
- return Z_DATA_ERROR;
- if ((y -= c[i]) < 0)
- return Z_DATA_ERROR;
- c[i] += y;
-
-
- /* Generate starting offsets into the value table for each length */
- x[1] = j = 0;
- p = c + 1; xp = x + 2;
- while (--i) { /* note that i == g from above */
- *xp++ = (j += *p++);
- }
-
-
- /* Make a table of values in order of bit lengths */
- p = b; i = 0;
- do {
- if ((j = *p++) != 0)
- v[x[j]++] = i;
- } while (++i < n);
- n = x[g]; /* set n to length of v */
-
-
- /* Generate the Huffman codes and for each, make the table entries */
- x[0] = i = 0; /* first Huffman code is zero */
- p = v; /* grab values in bit order */
- h = -1; /* no tables yet--level -1 */
- w = -l; /* bits decoded == (l * h) */
- u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */
- q = (inflate_huft *)Z_NULL; /* ditto */
- z = 0; /* ditto */
-
- /* go through the bit lengths (k already is bits in shortest code) */
- for (; k <= g; k++)
- {
- a = c[k];
- while (a--)
- {
- /* here i is the Huffman code of length k bits for value *p */
- /* make tables up to required level */
- while (k > w + l)
- {
- h++;
- w += l; /* previous table always l bits */
-
- /* compute minimum size table less than or equal to l bits */
- z = g - w;
- z = z > (uInt)l ? l : z; /* table size upper limit */
- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
- { /* too few codes for k-w bit table */
- f -= a + 1; /* deduct codes from patterns left */
- xp = c + k;
- if (j < z)
- while (++j < z) /* try smaller tables up to z bits */
- {
- if ((f <<= 1) <= *++xp)
- break; /* enough codes to use up j bits */
- f -= *xp; /* else deduct codes from patterns */
- }
- }
- z = 1 << j; /* table entries for j-bit table */
-
- /* allocate and link in new table */
- if ((q = (inflate_huft *)ZALLOC
- (zs,z + 1,sizeof(inflate_huft))) == Z_NULL)
- {
- if (h)
- inflate_trees_free(u[0], zs);
- return Z_MEM_ERROR; /* not enough memory */
- }
-#ifdef DEBUG_ZLIB
- inflate_hufts += z + 1;
-#endif
- *t = q + 1; /* link to list for huft_free() */
- *(t = &(q->next)) = Z_NULL;
- u[h] = ++q; /* table starts after link */
-
- /* connect to last table, if there is one */
- if (h)
- {
- x[h] = i; /* save pattern for backing up */
- r.bits = (Byte)l; /* bits to dump before this table */
- r.exop = (Byte)j; /* bits in this table */
- r.next = q; /* pointer to this table */
- j = i >> (w - l); /* (get around Turbo C bug) */
- u[h-1][j] = r; /* connect to last table */
- }
- }
-
- /* set up table entry in r */
- r.bits = (Byte)(k - w);
- if (p >= v + n)
- r.exop = 128 + 64; /* out of values--invalid code */
- else if (*p < s)
- {
- r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */
- r.base = *p++; /* simple code is just the value */
- }
- else
- {
- r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
- r.base = d[*p++ - s];
- }
-
- /* fill code-like entries with r */
- f = 1 << (k - w);
- for (j = i >> w; j < z; j += f)
- q[j] = r;
-
- /* backwards increment the k-bit code i */
- for (j = 1 << (k - 1); i & j; j >>= 1)
- i ^= j;
- i ^= j;
-
- /* backup over finished tables */
- while ((i & ((1 << w) - 1)) != x[h])
- {
- h--; /* don't need to update q */
- w -= l;
- }
- }
- }
-
-
- /* Return Z_BUF_ERROR if we were given an incomplete table */
- return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
-}
-
-
-int inflate_trees_bits(c, bb, tb, z)
-uIntf *c; /* 19 code lengths */
-uIntf *bb; /* bits tree desired/actual depth */
-inflate_huft * FAR *tb; /* bits tree result */
-z_streamp z; /* for zfree function */
-{
- int r;
-
- r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, z);
- if (r == Z_DATA_ERROR)
- z->msg = (char*)"oversubscribed dynamic bit lengths tree";
- else if (r == Z_BUF_ERROR || *bb == 0)
- {
- inflate_trees_free(*tb, z);
- z->msg = (char*)"incomplete dynamic bit lengths tree";
- r = Z_DATA_ERROR;
- }
- return r;
-}
-
-
-int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, z)
-uInt nl; /* number of literal/length codes */
-uInt nd; /* number of distance codes */
-uIntf *c; /* that many (total) code lengths */
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-z_streamp z; /* for zfree function */
-{
- int r;
-
- /* build literal/length tree */
- r = huft_build(c, nl, 257, cplens, cplext, tl, bl, z);
- if (r != Z_OK || *bl == 0)
- {
- if (r == Z_DATA_ERROR)
- z->msg = (char*)"oversubscribed literal/length tree";
- else if (r != Z_MEM_ERROR)
- {
- inflate_trees_free(*tl, z);
- z->msg = (char*)"incomplete literal/length tree";
- r = Z_DATA_ERROR;
- }
- return r;
- }
-
- /* build distance tree */
- r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, z);
- if (r != Z_OK || (*bd == 0 && nl > 257))
- {
- if (r == Z_DATA_ERROR)
- z->msg = (char*)"oversubscribed distance tree";
- else if (r == Z_BUF_ERROR) {
-#ifdef PKZIP_BUG_WORKAROUND
- r = Z_OK;
- }
-#else
- inflate_trees_free(*td, z);
- z->msg = (char*)"incomplete distance tree";
- r = Z_DATA_ERROR;
- }
- else if (r != Z_MEM_ERROR)
- {
- z->msg = (char*)"empty distance tree with lengths";
- r = Z_DATA_ERROR;
- }
- inflate_trees_free(*tl, z);
- return r;
-#endif
- }
-
- /* done */
- return Z_OK;
-}
-
-
-/* build fixed tables only once--keep them here */
-local int fixed_built = 0;
-#define FIXEDH 530 /* number of hufts used by fixed tables */
-local inflate_huft fixed_mem[FIXEDH];
-local uInt fixed_bl;
-local uInt fixed_bd;
-local inflate_huft *fixed_tl;
-local inflate_huft *fixed_td;
-
-
-local voidpf falloc(q, n, s)
-voidpf q; /* opaque pointer */
-uInt n; /* number of items */
-uInt s; /* size of item */
-{
- Assert(s == sizeof(inflate_huft) && n <= *(intf *)q,
- "inflate_trees falloc overflow");
- *(intf *)q -= n+s-s; /* s-s to avoid warning */
- return (voidpf)(fixed_mem + *(intf *)q);
-}
-
-
-int inflate_trees_fixed(bl, bd, tl, td)
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-{
- /* build fixed tables if not already (multiple overlapped executions ok) */
- if (!fixed_built)
- {
- int k; /* temporary variable */
- unsigned c[288]; /* length list for huft_build */
- z_stream z; /* for falloc function */
- int f = FIXEDH; /* number of hufts left in fixed_mem */
-
- /* set up fake z_stream for memory routines */
- z.zalloc = falloc;
- z.zfree = Z_NULL;
- z.opaque = (voidpf)&f;
-
- /* literal table */
- for (k = 0; k < 144; k++)
- c[k] = 8;
- for (; k < 256; k++)
- c[k] = 9;
- for (; k < 280; k++)
- c[k] = 7;
- for (; k < 288; k++)
- c[k] = 8;
- fixed_bl = 7;
- huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, &z);
-
- /* distance table */
- for (k = 0; k < 30; k++)
- c[k] = 5;
- fixed_bd = 5;
- huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, &z);
-
- /* done */
- Assert(f == 0, "invalid build of fixed tables");
- fixed_built = 1;
- }
- *bl = fixed_bl;
- *bd = fixed_bd;
- *tl = fixed_tl;
- *td = fixed_td;
- return Z_OK;
-}
-
-
-int inflate_trees_free(t, z)
-inflate_huft *t; /* table to free */
-z_streamp z; /* for zfree function */
-/* Free the malloc'ed tables built by huft_build(), which makes a linked
- list of the tables it made, with the links in a dummy first entry of
- each table. */
-{
- register inflate_huft *p, *q, *r;
-
- /* Reverse linked list */
- p = Z_NULL;
- q = t;
- while (q != Z_NULL)
- {
- r = (q - 1)->next;
- (q - 1)->next = p;
- p = q;
- q = r;
- }
- /* Go through linked list, freeing from the malloced (t[-1]) address. */
- while (p != Z_NULL)
- {
- q = (--p)->next;
- ZFREE(z,p);
- p = q;
- }
- return Z_OK;
-}
-/* --- inftrees.c */
-
-/* +++ infcodes.c */
-/* infcodes.c -- process literals and length/distance pairs
- * Copyright (C) 1995-1996 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* #include "zutil.h" */
-/* #include "inftrees.h" */
-/* #include "infblock.h" */
-/* #include "infcodes.h" */
-/* #include "infutil.h" */
-
-/* +++ inffast.h */
-/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-1996 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-extern int inflate_fast OF((
- uInt,
- uInt,
- inflate_huft *,
- inflate_huft *,
- inflate_blocks_statef *,
- z_streamp ));
-/* --- inffast.h */
-
-/* simplify the use of the inflate_huft type with some defines */
-#define base more.Base
-#define next more.Next
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-/* inflate codes private state */
-struct inflate_codes_state {
-
- /* mode */
- enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
- START, /* x: set up for LEN */
- LEN, /* i: get length/literal/eob next */
- LENEXT, /* i: getting length extra (have base) */
- DIST, /* i: get distance next */
- DISTEXT, /* i: getting distance extra */
- COPY, /* o: copying bytes in window, waiting for space */
- LIT, /* o: got literal, waiting for output space */
- WASH, /* o: got eob, possibly still output waiting */
- END, /* x: got eob and all data flushed */
- BADCODE} /* x: got error */
- mode; /* current inflate_codes mode */
-
- /* mode dependent information */
- uInt len;
- union {
- struct {
- inflate_huft *tree; /* pointer into tree */
- uInt need; /* bits needed */
- } code; /* if LEN or DIST, where in tree */
- uInt lit; /* if LIT, literal */
- struct {
- uInt get; /* bits to get for extra */
- uInt dist; /* distance back to copy from */
- } copy; /* if EXT or COPY, where and how much */
- } sub; /* submode */
-
- /* mode independent information */
- Byte lbits; /* ltree bits decoded per branch */
- Byte dbits; /* dtree bits decoder per branch */
- inflate_huft *ltree; /* literal/length/eob tree */
- inflate_huft *dtree; /* distance tree */
-
-};
-
-
-inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-z_streamp z;
-{
- inflate_codes_statef *c;
-
- if ((c = (inflate_codes_statef *)
- ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
- {
- c->mode = START;
- c->lbits = (Byte)bl;
- c->dbits = (Byte)bd;
- c->ltree = tl;
- c->dtree = td;
- Tracev((stderr, "inflate: codes new\n"));
- }
- return c;
-}
-
-
-int inflate_codes(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
-{
- uInt j; /* temporary storage */
- inflate_huft *t; /* temporary pointer */
- uInt e; /* extra bits or operation */
- uLong b; /* bit buffer */
- uInt k; /* bits in bit buffer */
- Bytef *p; /* input data pointer */
- uInt n; /* bytes available there */
- Bytef *q; /* output window write pointer */
- uInt m; /* bytes to end of window or read pointer */
- Bytef *f; /* pointer to copy strings from */
- inflate_codes_statef *c = s->sub.decode.codes; /* codes state */
-
- /* copy input/output information to locals (UPDATE macro restores) */
- LOAD
-
- /* process input and output based on current state */
- while (1) switch (c->mode)
- { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
- case START: /* x: set up for LEN */
-#ifndef SLOW
- if (m >= 258 && n >= 10)
- {
- UPDATE
- r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
- LOAD
- if (r != Z_OK)
- {
- c->mode = r == Z_STREAM_END ? WASH : BADCODE;
- break;
- }
- }
-#endif /* !SLOW */
- c->sub.code.need = c->lbits;
- c->sub.code.tree = c->ltree;
- c->mode = LEN;
- case LEN: /* i: get length/literal/eob next */
- j = c->sub.code.need;
- NEEDBITS(j)
- t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
- DUMPBITS(t->bits)
- e = (uInt)(t->exop);
- if (e == 0) /* literal */
- {
- c->sub.lit = t->base;
- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", t->base));
- c->mode = LIT;
- break;
- }
- if (e & 16) /* length */
- {
- c->sub.copy.get = e & 15;
- c->len = t->base;
- c->mode = LENEXT;
- break;
- }
- if ((e & 64) == 0) /* next table */
- {
- c->sub.code.need = e;
- c->sub.code.tree = t->next;
- break;
- }
- if (e & 32) /* end of block */
- {
- Tracevv((stderr, "inflate: end of block\n"));
- c->mode = WASH;
- break;
- }
- c->mode = BADCODE; /* invalid code */
- z->msg = (char*)"invalid literal/length code";
- r = Z_DATA_ERROR;
- LEAVE
- case LENEXT: /* i: getting length extra (have base) */
- j = c->sub.copy.get;
- NEEDBITS(j)
- c->len += (uInt)b & inflate_mask[j];
- DUMPBITS(j)
- c->sub.code.need = c->dbits;
- c->sub.code.tree = c->dtree;
- Tracevv((stderr, "inflate: length %u\n", c->len));
- c->mode = DIST;
- case DIST: /* i: get distance next */
- j = c->sub.code.need;
- NEEDBITS(j)
- t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
- DUMPBITS(t->bits)
- e = (uInt)(t->exop);
- if (e & 16) /* distance */
- {
- c->sub.copy.get = e & 15;
- c->sub.copy.dist = t->base;
- c->mode = DISTEXT;
- break;
- }
- if ((e & 64) == 0) /* next table */
- {
- c->sub.code.need = e;
- c->sub.code.tree = t->next;
- break;
- }
- c->mode = BADCODE; /* invalid code */
- z->msg = (char*)"invalid distance code";
- r = Z_DATA_ERROR;
- LEAVE
- case DISTEXT: /* i: getting distance extra */
- j = c->sub.copy.get;
- NEEDBITS(j)
- c->sub.copy.dist += (uInt)b & inflate_mask[j];
- DUMPBITS(j)
- Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
- c->mode = COPY;
- case COPY: /* o: copying bytes in window, waiting for space */
-#ifndef __TURBOC__ /* Turbo C bug for following expression */
- f = (uInt)(q - s->window) < c->sub.copy.dist ?
- s->end - (c->sub.copy.dist - (q - s->window)) :
- q - c->sub.copy.dist;
-#else
- f = q - c->sub.copy.dist;
- if ((uInt)(q - s->window) < c->sub.copy.dist)
- f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
-#endif
- while (c->len)
- {
- NEEDOUT
- OUTBYTE(*f++)
- if (f == s->end)
- f = s->window;
- c->len--;
- }
- c->mode = START;
- break;
- case LIT: /* o: got literal, waiting for output space */
- NEEDOUT
- OUTBYTE(c->sub.lit)
- c->mode = START;
- break;
- case WASH: /* o: got eob, possibly more output */
- FLUSH
- if (s->read != s->write)
- LEAVE
- c->mode = END;
- case END:
- r = Z_STREAM_END;
- LEAVE
- case BADCODE: /* x: got error */
- r = Z_DATA_ERROR;
- LEAVE
- default:
- r = Z_STREAM_ERROR;
- LEAVE
- }
-}
-
-
-void inflate_codes_free(c, z)
-inflate_codes_statef *c;
-z_streamp z;
-{
- ZFREE(z, c);
- Tracev((stderr, "inflate: codes free\n"));
-}
-/* --- infcodes.c */
-
-/* +++ infutil.c */
-/* inflate_util.c -- data and routines common to blocks and codes
- * Copyright (C) 1995-1996 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* #include "zutil.h" */
-/* #include "infblock.h" */
-/* #include "inftrees.h" */
-/* #include "infcodes.h" */
-/* #include "infutil.h" */
-
-#ifndef NO_DUMMY_DECL
-struct inflate_codes_state {int dummy;}; /* for buggy compilers */
-#endif
-
-/* And'ing with mask[n] masks the lower n bits */
-uInt inflate_mask[17] = {
- 0x0000,
- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-
-
-/* copy as much as possible from the sliding window to the output area */
-int inflate_flush(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
-{
- uInt n;
- Bytef *p;
- Bytef *q;
-
- /* local copies of source and destination pointers */
- p = z->next_out;
- q = s->read;
-
- /* compute number of bytes to copy as far as end of window */
- n = (uInt)((q <= s->write ? s->write : s->end) - q);
- if (n > z->avail_out) n = z->avail_out;
- if (n && r == Z_BUF_ERROR) r = Z_OK;
-
- /* update counters */
- z->avail_out -= n;
- z->total_out += n;
-
- /* update check information */
- if (s->checkfn != Z_NULL)
- z->adler = s->check = (*s->checkfn)(s->check, q, n);
-
- /* copy as far as end of window */
- if (p != Z_NULL) {
- zmemcpy(p, q, n);
- p += n;
- }
- q += n;
-
- /* see if more to copy at beginning of window */
- if (q == s->end)
- {
- /* wrap pointers */
- q = s->window;
- if (s->write == s->end)
- s->write = s->window;
-
- /* compute bytes to copy */
- n = (uInt)(s->write - q);
- if (n > z->avail_out) n = z->avail_out;
- if (n && r == Z_BUF_ERROR) r = Z_OK;
-
- /* update counters */
- z->avail_out -= n;
- z->total_out += n;
-
- /* update check information */
- if (s->checkfn != Z_NULL)
- z->adler = s->check = (*s->checkfn)(s->check, q, n);
-
- /* copy */
- if (p != Z_NULL) {
- zmemcpy(p, q, n);
- p += n;
- }
- q += n;
- }
-
- /* update pointers */
- z->next_out = p;
- s->read = q;
-
- /* done */
- return r;
-}
-/* --- infutil.c */
-
-/* +++ inffast.c */
-/* inffast.c -- process literals and length/distance pairs fast
- * Copyright (C) 1995-1996 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* #include "zutil.h" */
-/* #include "inftrees.h" */
-/* #include "infblock.h" */
-/* #include "infcodes.h" */
-/* #include "infutil.h" */
-/* #include "inffast.h" */
-
-#ifndef NO_DUMMY_DECL
-struct inflate_codes_state {int dummy;}; /* for buggy compilers */
-#endif
-
-/* simplify the use of the inflate_huft type with some defines */
-#define base more.Base
-#define next more.Next
-#define exop word.what.Exop
-#define bits word.what.Bits
-
-/* macros for bit input with no checking and for returning unused bytes */
-#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
-#define UNGRAB {n+=(c=k>>3);p-=c;k&=7;}
-
-/* Called with number of bytes left to write in window at least 258
- (the maximum string length) and number of input bytes available
- at least ten. The ten bytes are six bytes for the longest length/
- distance pair plus four bytes for overloading the bit buffer. */
-
-int inflate_fast(bl, bd, tl, td, s, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-inflate_blocks_statef *s;
-z_streamp z;
-{
- inflate_huft *t; /* temporary pointer */
- uInt e; /* extra bits or operation */
- uLong b; /* bit buffer */
- uInt k; /* bits in bit buffer */
- Bytef *p; /* input data pointer */
- uInt n; /* bytes available there */
- Bytef *q; /* output window write pointer */
- uInt m; /* bytes to end of window or read pointer */
- uInt ml; /* mask for literal/length tree */
- uInt md; /* mask for distance tree */
- uInt c; /* bytes to copy */
- uInt d; /* distance back to copy from */
- Bytef *r; /* copy source pointer */
-
- /* load input, output, bit values */
- LOAD
-
- /* initialize masks */
- ml = inflate_mask[bl];
- md = inflate_mask[bd];
-
- /* do until not enough input or output space for fast loop */
- do { /* assume called with m >= 258 && n >= 10 */
- /* get literal/length code */
- GRABBITS(20) /* max bits for literal/length code */
- if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
- {
- DUMPBITS(t->bits)
- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
- "inflate: * literal '%c'\n" :
- "inflate: * literal 0x%02x\n", t->base));
- *q++ = (Byte)t->base;
- m--;
- continue;
- }
- do {
- DUMPBITS(t->bits)
- if (e & 16)
- {
- /* get extra bits for length */
- e &= 15;
- c = t->base + ((uInt)b & inflate_mask[e]);
- DUMPBITS(e)
- Tracevv((stderr, "inflate: * length %u\n", c));
-
- /* decode distance base of block to copy */
- GRABBITS(15); /* max bits for distance code */
- e = (t = td + ((uInt)b & md))->exop;
- do {
- DUMPBITS(t->bits)
- if (e & 16)
- {
- /* get extra bits to add to distance base */
- e &= 15;
- GRABBITS(e) /* get extra bits (up to 13) */
- d = t->base + ((uInt)b & inflate_mask[e]);
- DUMPBITS(e)
- Tracevv((stderr, "inflate: * distance %u\n", d));
-
- /* do the copy */
- m -= c;
- if ((uInt)(q - s->window) >= d) /* offset before dest */
- { /* just copy */
- r = q - d;
- *q++ = *r++; c--; /* minimum count is three, */
- *q++ = *r++; c--; /* so unroll loop a little */
- }
- else /* else offset after destination */
- {
- e = d - (uInt)(q - s->window); /* bytes from offset to end */
- r = s->end - e; /* pointer to offset */
- if (c > e) /* if source crosses, */
- {
- c -= e; /* copy to end of window */
- do {
- *q++ = *r++;
- } while (--e);
- r = s->window; /* copy rest from start of window */
- }
- }
- do { /* copy all or what's left */
- *q++ = *r++;
- } while (--c);
- break;
- }
- else if ((e & 64) == 0)
- e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop;
- else
- {
- z->msg = (char*)"invalid distance code";
- UNGRAB
- UPDATE
- return Z_DATA_ERROR;
- }
- } while (1);
- break;
- }
- if ((e & 64) == 0)
- {
- if ((e = (t = t->next + ((uInt)b & inflate_mask[e]))->exop) == 0)
- {
- DUMPBITS(t->bits)
- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
- "inflate: * literal '%c'\n" :
- "inflate: * literal 0x%02x\n", t->base));
- *q++ = (Byte)t->base;
- m--;
- break;
- }
- }
- else if (e & 32)
- {
- Tracevv((stderr, "inflate: * end of block\n"));
- UNGRAB
- UPDATE
- return Z_STREAM_END;
- }
- else
- {
- z->msg = (char*)"invalid literal/length code";
- UNGRAB
- UPDATE
- return Z_DATA_ERROR;
- }
- } while (1);
- } while (m >= 258 && n >= 10);
-
- /* not enough input or output--restore pointers and return */
- UNGRAB
- UPDATE
- return Z_OK;
-}
-/* --- inffast.c */
-
-/* +++ zutil.c */
-/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-1996 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* From: zutil.c,v 1.17 1996/07/24 13:41:12 me Exp $ */
-
-#ifdef DEBUG_ZLIB
-#include <stdio.h>
-#endif
-
-/* #include "zutil.h" */
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-#ifndef STDC
-extern void exit OF((int));
-#endif
-
-const char *z_errmsg[10] = {
-"need dictionary", /* Z_NEED_DICT 2 */
-"stream end", /* Z_STREAM_END 1 */
-"", /* Z_OK 0 */
-"file error", /* Z_ERRNO (-1) */
-"stream error", /* Z_STREAM_ERROR (-2) */
-"data error", /* Z_DATA_ERROR (-3) */
-"insufficient memory", /* Z_MEM_ERROR (-4) */
-"buffer error", /* Z_BUF_ERROR (-5) */
-"incompatible version",/* Z_VERSION_ERROR (-6) */
-""};
-
-
-const char *zlibVersion()
-{
- return ZLIB_VERSION;
-}
-
-#ifdef DEBUG_ZLIB
-void z_error (m)
- char *m;
-{
- fprintf(stderr, "%s\n", m);
- exit(1);
-}
-#endif
-
-#ifndef HAVE_MEMCPY
-
-void zmemcpy(dest, source, len)
- Bytef* dest;
- Bytef* source;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = *source++; /* ??? to be unrolled */
- } while (--len != 0);
-}
-
-int zmemcmp(s1, s2, len)
- Bytef* s1;
- Bytef* s2;
- uInt len;
-{
- uInt j;
-
- for (j = 0; j < len; j++) {
- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
- }
- return 0;
-}
-
-void zmemzero(dest, len)
- Bytef* dest;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = 0; /* ??? to be unrolled */
- } while (--len != 0);
-}
-#endif
-
-#ifdef __TURBOC__
-#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
-/* Small and medium model in Turbo C are for now limited to near allocation
- * with reduced MAX_WBITS and MAX_MEM_LEVEL
- */
-# define MY_ZCALLOC
-
-/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
- * and farmalloc(64K) returns a pointer with an offset of 8, so we
- * must fix the pointer. Warning: the pointer must be put back to its
- * original form in order to free it, use zcfree().
- */
-
-#define MAX_PTR 10
-/* 10*64K = 640K */
-
-local int next_ptr = 0;
-
-typedef struct ptr_table_s {
- voidpf org_ptr;
- voidpf new_ptr;
-} ptr_table;
-
-local ptr_table table[MAX_PTR];
-/* This table is used to remember the original form of pointers
- * to large buffers (64K). Such pointers are normalized with a zero offset.
- * Since MSDOS is not a preemptive multitasking OS, this table is not
- * protected from concurrent access. This hack doesn't work anyway on
- * a protected system like OS/2. Use Microsoft C instead.
- */
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- voidpf buf = opaque; /* just to make some compilers happy */
- ulg bsize = (ulg)items*size;
-
- /* If we allocate less than 65520 bytes, we assume that farmalloc
- * will return a usable pointer which doesn't have to be normalized.
- */
- if (bsize < 65520L) {
- buf = farmalloc(bsize);
- if (*(ush*)&buf != 0) return buf;
- } else {
- buf = farmalloc(bsize + 16L);
- }
- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
- table[next_ptr].org_ptr = buf;
-
- /* Normalize the pointer to seg:0 */
- *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
- *(ush*)&buf = 0;
- table[next_ptr++].new_ptr = buf;
- return buf;
-}
-
-void zcfree (voidpf opaque, voidpf ptr)
-{
- int n;
- if (*(ush*)&ptr != 0) { /* object < 64K */
- farfree(ptr);
- return;
- }
- /* Find the original pointer */
- for (n = 0; n < next_ptr; n++) {
- if (ptr != table[n].new_ptr) continue;
-
- farfree(table[n].org_ptr);
- while (++n < next_ptr) {
- table[n-1] = table[n];
- }
- next_ptr--;
- return;
- }
- ptr = opaque; /* just to make some compilers happy */
- Assert(0, "zcfree: ptr not found");
-}
-#endif
-#endif /* __TURBOC__ */
-
-
-#if defined(M_I86) && !defined(__32BIT__)
-/* Microsoft C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-#if (!defined(_MSC_VER) || (_MSC_VER < 600))
-# define _halloc halloc
-# define _hfree hfree
-#endif
-
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- return _halloc((long)items, size);
-}
-
-void zcfree (voidpf opaque, voidpf ptr)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- _hfree(ptr);
-}
-
-#endif /* MSC */
-
-
-#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-
-#ifndef STDC
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-voidpf zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
-{
- if (opaque) items += size - size; /* make compiler happy */
- return (voidpf)calloc(items, size);
-}
-
-void zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
-{
- free(ptr);
- if (opaque) return; /* make compiler happy */
-}
-
-#endif /* MY_ZCALLOC */
-/* --- zutil.c */
-
-/* +++ adler32.c */
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-1996 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* From: adler32.c,v 1.10 1996/05/22 11:52:18 me Exp $ */
-
-/* #include "zlib.h" */
-
-#define BASE 65521L /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf) DO8(buf,0); DO8(buf,8);
-
-/* ========================================================================= */
-uLong adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
-{
- unsigned long s1 = adler & 0xffff;
- unsigned long s2 = (adler >> 16) & 0xffff;
- int k;
-
- if (buf == Z_NULL) return 1L;
-
- while (len > 0) {
- k = len < NMAX ? len : NMAX;
- len -= k;
- while (k >= 16) {
- DO16(buf);
- buf += 16;
- k -= 16;
- }
- if (k != 0) do {
- s1 += *buf++;
- s2 += s1;
- } while (--k);
- s1 %= BASE;
- s2 %= BASE;
- }
- return (s2 << 16) | s1;
-}
-/* --- adler32.c */
diff --git a/mdk-stage1/ppp/common/zlib.h b/mdk-stage1/ppp/common/zlib.h
deleted file mode 100644
index 188ddaff9..000000000
--- a/mdk-stage1/ppp/common/zlib.h
+++ /dev/null
@@ -1,1010 +0,0 @@
-/* $Id$ */
-
-/*
- * This file is derived from zlib.h and zconf.h from the zlib-1.0.4
- * distribution by Jean-loup Gailly and Mark Adler, with some additions
- * by Paul Mackerras to aid in implementing Deflate compression and
- * decompression for PPP packets.
- */
-
-/*
- * ==FILEVERSION 971127==
- *
- * This marker is used by the Linux installation script to determine
- * whether an up-to-date version of this file is already installed.
- */
-
-
-/* +++ zlib.h */
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.0.4, Jul 24th, 1996.
-
- Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- gzip@prep.ai.mit.edu madler@alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef _ZLIB_H
-#define _ZLIB_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* +++ zconf.h */
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-1996 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* From: zconf.h,v 1.20 1996/07/02 15:09:28 me Exp $ */
-
-#ifndef _ZCONF_H
-#define _ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateReset z_inflateReset
-# define compress z_compress
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
-#endif
-
-#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
-# define WIN32
-#endif
-#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
-# ifndef __32BIT__
-# define __32BIT__
-# endif
-#endif
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#if defined(MSDOS) && !defined(__32BIT__)
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
-# define STDC
-#endif
-#if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC)
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const
-# endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2 */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- 1 << (windowBits+2) + 1 << (memLevel+9)
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR __far
-# else
-# define FAR far
-# endif
-#endif
-#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
-# ifndef __32BIT__
-# define SMALL_MEDIUM
-# define FAR __far
-# endif
-#endif
-#ifndef FAR
-# define FAR
-#endif
-
-typedef unsigned char Byte; /* 8 bits */
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#if defined(__BORLANDC__) && defined(SMALL_MEDIUM)
- /* Borland C/C++ ignores FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-
-/* Compile with -DZLIB_DLL for Windows DLL support */
-#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
-# include <windows.h>
-# define EXPORT WINAPI
-#else
-# define EXPORT
-#endif
-
-#endif /* _ZCONF_H */
-/* --- zconf.h */
-
-#define ZLIB_VERSION "1.0.4P"
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed
- data. This version of the library supports only one compression method
- (deflation) but other algorithms may be added later and will have the same
- stream interface.
-
- For compression the application must provide the output buffer and
- may optionally provide the input buffer for optimization. For decompression,
- the application must provide the input buffer and may optionally provide
- the output buffer for optimization.
-
- Compression can be done in a single step if the buffers are large
- enough (for example if an input file is mmap'ed), or can be done by
- repeated calls of the compression function. In the latter case, the
- application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The library does not install any signal handler. It is recommended to
- add at least a handler for SIGSEGV when decompressing; the library checks
- the consistency of the input data whenever possible but may go nuts
- for some forms of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total nb of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total nb of bytes output so far */
-
- char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: ascii or binary */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- The application must update next_in and avail_in when avail_in has
- dropped to zero. It must update next_out and avail_out when avail_out
- has dropped to zero. The application must initialize zalloc, zfree and
- opaque before calling the init function. All other fields are set by the
- compression library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this
- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
- pointers returned by zalloc for objects of exactly 65536 bytes *must*
- have their offset normalized to zero. The default allocation function
- provided by this library ensures this (see zutil.c). To reduce memory
- requirements and avoid any allocation of 64K objects, at the expense of
- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or
- progress reports. After compression, total_in holds the total size of
- the uncompressed data and may be saved for use in the decompressor
- (particularly if the decompressor wants to decompress everything in
- a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1
-#define Z_PACKET_FLUSH 2
-#define Z_SYNC_FLUSH 3
-#define Z_FULL_FLUSH 4
-#define Z_FINISH 5
-/* Allowed flush values; see deflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_ASCII 1
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
- /* basic functions */
-
-extern const char * EXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is
- not compatible with the zlib.h header file used by the application.
- This check is automatically made by deflateInit and inflateInit.
- */
-
-/*
-extern int EXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller.
- If zalloc and zfree are set to Z_NULL, deflateInit updates them to
- use default allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at
- all (the input data is simply copied a block at a time).
- Z_DEFAULT_COMPRESSION requests a default compromise between speed and
- compression (currently equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if level is not a valid compression level,
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION).
- msg is set to null if there is no error message. deflateInit does not
- perform any compression: this will be done by deflate().
-*/
-
-
-extern int EXPORT deflate OF((z_streamp strm, int flush));
-/*
- Performs one or both of the following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications).
- Some output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating avail_in or avail_out accordingly; avail_out
- should never be zero before the call. The application can consume the
- compressed output when it wants, for example when the output buffer is full
- (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
- and with zero avail_out, it must be called again after making room in the
- output buffer because there might be more output pending.
-
- If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression
- block is terminated and flushed to the output buffer so that the
- decompressor can get all input data available so far. For method 9, a future
- variant on method 8, the current block will be flushed but not terminated.
- Z_SYNC_FLUSH has the same effect as partial flush except that the compressed
- output is byte aligned (the compressor can clear its internal bit buffer)
- and the current block is always terminated; this can be useful if the
- compressor has to be restarted from scratch after an interruption (in which
- case the internal state of the compressor may be lost).
- If flush is set to Z_FULL_FLUSH, the compression block is terminated, a
- special marker is output and the compression dictionary is discarded; this
- is useful to allow the decompressor to synchronize if one compressed block
- has been damaged (see inflateSync below). Flushing degrades compression and
- so should be used only when necessary. Using Z_FULL_FLUSH too often can
- seriously degrade the compression. If deflate returns with avail_out == 0,
- this function must be called again with the same value of the flush
- parameter and more output space (updated avail_out), until the flush is
- complete (deflate returns with non-zero avail_out).
-
- If the parameter flush is set to Z_PACKET_FLUSH, the compression
- block is terminated, and a zero-length stored block is output,
- omitting the length bytes (the effect of this is that the 3-bit type
- code 000 for a stored block is output, and the output is then
- byte-aligned). This is designed for use at the end of a PPP packet.
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there
- was enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the
- stream are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least
- 0.1% larger than avail_in plus 12 bytes. If deflate does not return
- Z_STREAM_END, then it must be called again as described above.
-
- deflate() may update data_type if it can make a good guess about
- the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect
- the compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible.
-*/
-
-
-extern int EXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case,
- msg may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-extern int EXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- zalloc, zfree and opaque must be initialized before by the caller. If
- zalloc and zfree are set to Z_NULL, inflateInit updates them to use default
- allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_VERSION_ERROR if the zlib library version is incompatible
- with the version assumed by the caller. msg is set to null if there is no
- error message. inflateInit does not perform any decompression: this will be
- done by inflate().
-*/
-
-
-extern int EXPORT inflate OF((z_streamp strm, int flush));
-/*
- Performs one or both of the following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing
- will resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there
- is no more input data or no more space in the output buffer (see below
- about the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating the next_* and avail_* values accordingly.
- The application can consume the uncompressed output when it wants, for
- example when the output buffer is full (avail_out == 0), or after each
- call of inflate(). If inflate returns Z_OK and with zero avail_out, it
- must be called again after making room in the output buffer because there
- might be more output pending.
-
- If the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_FLUSH,
- inflate flushes as much output as possible to the output buffer. The
- flushing behavior of inflate is not specified for values of the flush
- parameter other than Z_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the
- current implementation actually flushes as much output as possible
- anyway. For Z_PACKET_FLUSH, inflate checks that once all the input data
- has been consumed, it is expecting to see the length field of a stored
- block; if not, it returns Z_DATA_ERROR.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step
- (a single call of inflate), the parameter flush should be set to
- Z_FINISH. In this case all pending input is processed and all pending
- output is flushed; avail_out must be large enough to hold all the
- uncompressed data. (The size of the uncompressed data may have been saved
- by the compressor for this purpose.) The next operation on this stream must
- be inflateEnd to deallocate the decompression state. The use of Z_FINISH
- is never required, but can be used to inform inflate that a faster routine
- may be used for the single inflate() call.
-
- inflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if the end of the
- compressed data has been reached and all uncompressed output has been
- produced, Z_NEED_DICT if a preset dictionary is needed at this point (see
- inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted,
- Z_STREAM_ERROR if the stream structure was inconsistent (for example if
- next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
- Z_BUF_ERROR if no progress is possible or if there was not enough room in
- the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the
- application may then call inflateSync to look for a good compression block.
- In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the
- dictionary chosen by the compressor.
-*/
-
-
-extern int EXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-extern int EXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by
- the caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library. (Method 9 will allow a 64K history buffer and
- partial block flushes.)
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library (the value 16 will be allowed for method 9). Larger
- values of this parameter result in better compression at the expense of
- memory usage. The default value is 15 if deflateInit is used instead.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but
- is slow and reduces compression ratio; memLevel=9 uses maximum memory
- for optimal speed. The default value is 8. See zconf.h for total memory
- usage as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match). Filtered data consists mostly of small values with a
- somewhat random distribution. In this case, the compression algorithm is
- tuned to compress them better. The effect of Z_FILTERED is to force more
- Huffman coding and less string matching; it is somewhat intermediate
- between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
- the compression ratio but not the correctness of the compressed output even
- if it is not set appropriately.
-
- If next_in is not null, the library will use this buffer to hold also
- some history information; the buffer must either hold the entire input
- data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in
- is null, the library will allocate its own history buffer (and leave next_in
- null). next_out need not be provided here but must be provided by the
- application for the next call of deflate().
-
- If the history buffer is provided by the application, next_in must
- must never be changed by the application since the compressor maintains
- information inside this buffer from call to call; the application
- must provide more input only by increasing avail_in. next_in is always
- reset by the library in this case.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
- not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
- an invalid method). msg is set to null if there is no error message.
- deflateInit2 does not perform any compression: this will be done by
- deflate().
-*/
-
-extern int EXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary (history buffer) from the given
- byte sequence without producing any compressed output. This function must
- be called immediately after deflateInit or deflateInit2, before any call
- of deflate. The compressor and decompressor must use exactly the same
- dictionary (see inflateSetDictionary).
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and
- can be predicted with good accuracy; the data can then be compressed better
- than with the default empty dictionary. In this version of the library,
- only the last 32K bytes of the dictionary are used.
- Upon return of this function, strm->adler is set to the Adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The Adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.)
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state
- is inconsistent (for example if deflate has already been called for this
- stream). deflateSetDictionary does not perform any compression: this will
- be done by deflate().
-*/
-
-extern int EXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream. If
- the source stream is using an application-supplied history buffer, a new
- buffer is allocated for the destination stream. The compressed output
- buffer is always application-supplied. It's the responsibility of the
- application to provide the correct values of next_out and avail_out for the
- next call of deflate.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and
- can consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-extern int EXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state.
- The stream will keep the same compression level and any other attributes
- that may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy));
-/*
- Dynamically update the compression level and compression strategy.
- This can be used to switch between compression and straight copy of
- the input data, or to switch to a different kind of input data requiring
- a different strategy. If the compression level is changed, the input
- available so far is compressed with the old level (and may be flushed);
- the new level will take effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to
- be compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
- if strm->avail_out was zero.
-*/
-
-extern int EXPORT deflateOutputPending OF((z_streamp strm));
-/*
- Returns the number of bytes of output which are immediately
- available from the compressor (i.e. without any further input
- or flush).
-*/
-
-/*
-extern int EXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with more compression options. The
- fields next_out, zalloc, zfree and opaque must be initialized before by
- the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library (the value 16 will be allowed soon). The
- default value is 15 if inflateInit is used instead. If a compressed stream
- with a larger window size is given as input, inflate() will return with
- the error code Z_DATA_ERROR instead of trying to allocate a larger window.
-
- If next_out is not null, the library will use this buffer for the history
- buffer; the buffer must either be large enough to hold the entire output
- data, or have at least 1<<windowBits bytes. If next_out is null, the
- library will allocate its own buffer (and leave next_out null). next_in
- need not be provided here but must be provided by the application for the
- next call of inflate().
-
- If the history buffer is provided by the application, next_out must
- never be changed by the application since the decompressor maintains
- history information inside this buffer from call to call; the application
- can only reset next_out to the beginning of the history buffer when
- avail_out is zero and all output has been consumed.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
- not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
- windowBits < 8). msg is set to null if there is no error message.
- inflateInit2 does not perform any decompression: this will be done by
- inflate().
-*/
-
-extern int EXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary (history buffer) from the given
- uncompressed byte sequence. This function must be called immediately after
- a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen
- by the compressor can be determined from the Adler32 value returned by this
- call of inflate. The compressor and decompressor must use exactly the same
- dictionary (see deflateSetDictionary).
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect Adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-extern int EXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until the special marker (see deflate()
- above) can be found, or until all available input is skipped. No output
- is provided.
-
- inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no marker has been found,
- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
- case, the application may save the current current value of total_in which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call inflateSync, providing more input each time,
- until success or end of the input data.
-*/
-
-extern int EXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state.
- The stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-extern int inflateIncomp OF((z_stream *strm));
-/*
- This function adds the data at next_in (avail_in bytes) to the output
- history without performing any output. There must be no pending output,
- and the decompressor must be expecting to see the start of a block.
- Calling this function is equivalent to decompressing a stored block
- containing the data at next_in (except that the data is not output).
-*/
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the
- basic stream-oriented functions. To simplify the interface, some
- default options are assumed (compression level, window size,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
-*/
-
-extern int EXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least 0.1% larger than
- sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
- compressed buffer.
- This function can be used to compress a whole file at once if the
- input file is mmap'ed.
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-extern int EXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-
-
-typedef voidp gzFile;
-
-extern gzFile EXPORT gzopen OF((const char *path, const char *mode));
-/*
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9"). gzopen can be used to read a file which is not in gzip format;
- in this case gzread will directly read from the file without decompression.
- gzopen returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR).
-*/
-
-extern gzFile EXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in gzopen.
- The next call of gzclose on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
- gzdopen returns NULL if there was insufficient memory to allocate
- the (de)compression state.
-*/
-
-extern int EXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, gzread copies the given number
- of bytes into the buffer.
- gzread returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error). */
-
-extern int EXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes actually written
- (0 in case of error).
-*/
-
-extern int EXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function. The return value is the zlib
- error number (see function gzerror below). gzflush returns Z_OK if
- the flush parameter is Z_FINISH and all output could be flushed.
- gzflush should be called only when strictly necessary because it can
- degrade compression.
-*/
-
-extern int EXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state. The return value is the zlib
- error number (see function gzerror below).
-*/
-
-extern const char * EXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
-*/
-
-extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-extern uLong EXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running crc with the bytes buf[0..len-1] and return the updated
- crc. If buf is NULL, this function returns the required initial value
- for the crc. Pre- and post-conditioning (one's complement) is performed
- within this function so it shouldn't be done by the application.
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-extern int EXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-extern int EXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-extern int EXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel, int strategy,
- const char *version, int stream_size));
-extern int EXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-
-#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-uLongf *get_crc_table OF((void)); /* can be used by asm versions of crc32() */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ZLIB_H */
-/* --- zlib.h */
diff --git a/mdk-stage1/ppp/configure b/mdk-stage1/ppp/configure
deleted file mode 100755
index 544fb0d71..000000000
--- a/mdk-stage1/ppp/configure
+++ /dev/null
@@ -1,141 +0,0 @@
-#!/bin/sh
-# $Id$
-
-# if [ -d /NextApps ]; then
-# system="NeXTStep"
-# else
- system=`uname -s`
- release=`uname -r`
- machine=`uname -p`
- arch=`uname -m`
-# fi
-state="unknown"
-
-case $system in
- Linux)
- makext="linux";
- ksrc="linux";
- state="known";;
- SunOS)
- case $release in
-# [0-3]*) state="ancient";;
-# 4*) state="known"; ksrc="sunos4"; makext="sunos4";;
- 5.[1-6]*) state="known"; ksrc="solaris"; makext="sol2";;
- 5.[7-9]*) state="known"; ksrc="solaris"; makext="sol2";
- case $arch in
- sun4u) lp64='y';;
- *) ;;
- esac;;
- esac;;
- NetBSD|FreeBSD|ULTRIX|OSF1|NeXTStep|SINIX-?|UNIX_SV|UNIX_System_V)
- state="notincluded";;
-# NetBSD)
-# makext="bsd";
-# case $release in
-# 0.*) state="ancient";;
-# 1.0*) state="ancient";;
-# 1.1*) state="known"; ksrc="netbsd-1.1";;
-# 1.2*) state="known"; ksrc="netbsd-1.2"; makext="netbsd-1.2";;
-# 1.[3-9]*|[2-9]*)
-# state="late"; ksrc="netbsd-1.2";;
-# esac;;
-# ULTRIX)
-# makext="ultrix";
-# case $release in
-# [0-3]*) state="ancient";;
-# 4.[01]*) state="early"; ksrc="ultrix";;
-# 4.[234]) state="known"; ksrc="ultrix";;
-# esac;;
-# OSF1)
-# makext="osf";
-# case $release in
-# V1.*) state="neolithic"; ksrc="osf1";;
-# V[23].*) state="neolithic"; ksrc="osf1";;
-# V4.*) state="known"; ksrc="osf1";;
-# V[5-9]*) state="late"; ksrc="osf1";;
-# esac;;
-# FreeBSD)
-# makext="bsd";
-# case $release in
-# 1.*) state="known"; ksrc="freebsd-old";;
-# 2.[01]*) state="known"; ksrc="freebsd-2.0";;
-# 2.2.[2-7]*) state="late"; ksrc="freebsd-2.0";;
-# 2.2.8*) state="known"; ksrc="freebsd-2.2.8";;
-# 3.[0-1]*) state="known"; ksrc="freebsd-3.0";;
-# esac;;
-# NeXTStep)
-# makext="NeXT";
-# ksrc="NeXT";
-# state="known";;
-# SINIX-?)
-# case $release in
-# 5.4[01]) state=known; ksrc=svr4; makext=svr4;;
-# 5.4[2-9]) state=late; ksrc=svr4; makext=svr4;;
-# esac;;
-# # Intel SVR4 systems come with a bug in the uname program. Unless
-# # your provider fixed the bug, or you get a fix for it, uname -S will
-# # overwrite the system name with the node name!
-# UNIX_SV|UNIX_System_V|`uname -n`)
-# case $release in
-# 4.0) state=known; ksrc=svr4; makext=svr4;;
-# 4.2) state=late; ksrc=svr4; makext=svr4;;
-# esac;;
-esac
-
-if [ -d "$ksrc" ]; then :; else
- state="notincluded"
- unset ksrc
-fi
-
-case $state in
- neolithic)
- echo "This is a newer release on an outdated OS ($system)."
- echo " This software may or may not work on this OS."
- echo " You may want to download an older version of PPP for this OS.";;
- ancient)
- echo "This is an old release of a supported OS ($system)."
- echo "This software cannot be used as-is on this system,"
- echo "but you may be able to port it. Good luck!"
- exit;;
- early)
- echo "This is an old release of a supported OS ($system)."
- echo "This software should install and run on this system,"
- echo "but it hasn't been tested.";;
- late)
- echo "This is a newer release of $system than is supported by"
- echo "this software. It may or may not work.";;
- unknown)
- echo "This software has not been ported to this system. Sorry.";;
- notincluded)
- echo "Support for this system has not been included"
- echo "in this distribution. Sorry.";;
-esac
-
-orig_makext=$makext
-
-if [ -d "$ksrc" ]; then
- echo "Creating links to Makefiles."
- rm -f Makefile
- ln -s $ksrc/Makefile.top Makefile
- echo " Makefile -> $ksrc/Makefile.top"
- if [ "$ksrc" = solaris ]; then
- # Point to 64-bit Makefile extension
- if [ "$lp64" = y ]; then
- makext=$makext-64
- fi
- rm -f $ksrc/Makefile
- ln -s Makefile.$makext $ksrc/Makefile
- echo " $ksrc/Makefile -> Makefile.$makext"
- # Restore extension
- if [ "$lp64" = y ]; then
- makext=$orig_makext
- fi
- fi
- for dir in pppd pppstats chat pppdump; do
- rm -f $dir/Makefile
- if [ -f $dir/Makefile.$makext ]; then
- ln -s Makefile.$makext $dir/Makefile
- echo " $dir/Makefile -> Makefile.$makext"
- fi
- done
-fi
diff --git a/mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux b/mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux
deleted file mode 100644
index 7eb217dac..000000000
--- a/mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux
+++ /dev/null
@@ -1,16 +0,0 @@
-all: pppgetpass.vt pppgetpass.gtk
-
-pppgetpass.vt: pppgetpass.vt.o
-
-pppgetpass.gtk: pppgetpass.gtk.o
- $(CC) $(LDFLAGS) pppgetpass.gtk.o `gtk-config --libs` -o pppgetpass.gtk
-pppgetpass.gtk.o: pppgetpass.gtk.c
- $(CC) $(CFLAGS) -c pppgetpass.gtk.c `gtk-config --cflags`
-
-install: all
- install -m 755 pppgetpass.sh /usr/bin/pppgetpass
- install -m 4755 -o root -g root pppgetpass.vt /usr/bin/
- install -m 755 -o root -g root pppgetpass.gtk /usr/X11/bin/
-
-clean:
- rm -f *.o pppgetpass.gtk pppgetpass.vt core
diff --git a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.8 b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.8
deleted file mode 100644
index ade576970..000000000
--- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.8
+++ /dev/null
@@ -1,18 +0,0 @@
-.TH PPPGETPASS 8 "26 Sep 1999"
-.SH NAME
-pppgetpass \- prompt for PAP password
-.SH SYNOPSIS
-.B pppgetpass
-.I client server fd
-.SH DESCRIPTION
-.B pppgetpass
-the outer half of a plugin for PAP password prompting in pppd.
-If the peer requires PAP, and the
-.B passprompt.so
-plugin is loaded into pppd, it will run
-.B /usr/sbin/pppgetpass
-(or another program specified by the
-.B promptprog
-option) to prompt the user for the password.
-.SH SEE ALSO
-pppd(8)
diff --git a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c
deleted file mode 100644
index 48ca04202..000000000
--- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtksignal.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <syslog.h>
-
-int outfd;
-int err;
-
-static void okpressed(void *widget, void *clientdata)
-{
- GtkWidget *answer=clientdata;
- gchar *pass;
- int passlen;
- ssize_t wrote;
- (void)widget;
-
- pass=gtk_entry_get_text(GTK_ENTRY(answer));
-
- passlen=strlen(pass);
- if(!passlen)
- return;
-
- if((wrote=write(outfd, pass, passlen))!=passlen) {
- if(wrote<0)
- syslog(LOG_ERR, "write error on outpipe: %m");
- else
- syslog(LOG_ERR, "short write on outpipe");
- err=1;
- }
- gtk_main_quit();
-}
-
-int main(int argc, char **argv)
-{
- GtkWidget *mainwindow, *vbox, *question, *answer, *ok;
- char buf[1024];
- gtk_init(&argc, &argv);
-
- openlog(argv[0], LOG_PID, LOG_DAEMON);
- if(argc!=4) {
- syslog(LOG_WARNING, "Usage error");
- return 1;
- }
- outfd=atoi(argv[3]);
- mainwindow=gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(mainwindow), "pppgetpass");
- gtk_signal_connect(GTK_OBJECT(mainwindow), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit), 0);
-
- vbox=gtk_vbox_new(FALSE, 5);
- gtk_container_add(GTK_CONTAINER(mainwindow), vbox);
- gtk_widget_show(vbox);
-
- if(argv[1][0] && argv[2][0])
- snprintf(buf, sizeof buf, "Password for PPP client %s on server %s: ", argv[1], argv[2]);
- else if(argv[1][0] && !argv[2][0])
- snprintf(buf, sizeof buf, "Password for PPP client %s: ", argv[1]);
- else if(!argv[1][0] && argv[2][0])
- snprintf(buf, sizeof buf, "Password for PPP on server %s: ", argv[2]);
- else
- snprintf(buf, sizeof buf, "Enter PPP password: ");
- question=gtk_label_new(buf);
- gtk_box_pack_start(GTK_BOX(vbox), question, FALSE, TRUE, 0);
- gtk_widget_show(question);
-
- answer=gtk_entry_new();
- gtk_entry_set_visibility(GTK_ENTRY(answer), 0);
- gtk_box_pack_start(GTK_BOX(vbox), answer, FALSE, TRUE, 0);
- gtk_widget_show(answer);
-
- ok=gtk_button_new_with_label("OK");
- gtk_box_pack_start(GTK_BOX(vbox), ok, FALSE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT(ok), "clicked",
- GTK_SIGNAL_FUNC(okpressed), answer);
- gtk_widget_show(ok);
-
- gtk_widget_show(mainwindow);
- gtk_main();
-
- return err;
-}
diff --git a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh
deleted file mode 100644
index 09c480519..000000000
--- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ -z "$DISPLAY" ]; then
- exec pppgetpass.vt "$@"
-else
- exec pppgetpass.gtk "$@"
-fi
diff --git a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c
deleted file mode 100644
index a1520883c..000000000
--- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c
+++ /dev/null
@@ -1,218 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <syslog.h>
-#include <termios.h>
-#include <sys/vt.h>
-
-static int console_owner(uid_t, int);
-
-int main(int argc, char **argv)
-{
- int console;
- uid_t uid;
- struct vt_stat origstate;
- int openvtnum;
- char openvtname[256];
- int openvt;
- gid_t gid;
- int chowned;
- FILE *fp;
- struct termios t;
- char pass[256], *nl;
- int outfd, passlen;
- ssize_t wrote;
- console=open("/dev/console", O_RDWR);
-
- uid=getuid();
- gid=getgid();
- seteuid(uid);
-
- openlog(argv[0], LOG_PID, LOG_DAEMON);
-
- if(argc!=4) {
- syslog(LOG_WARNING, "Usage error");
- return 1;
- }
-
- if(console<0) {
- syslog(LOG_ERR, "open(/dev/console): %m");
- return 1;
- }
-
- if(ioctl(console, VT_GETSTATE, &origstate)<0) {
- syslog(LOG_ERR, "VT_GETSTATE: %m");
- return 1;
- }
-
- if(uid) {
- if(!console_owner(uid, origstate.v_active)) {
- int i;
- for(i=0;i<64;++i) {
- if(i!=origstate.v_active && console_owner(uid, i))
- break;
- }
- if(i==64) {
- syslog(LOG_WARNING, "run by uid %lu not at console", (unsigned long)uid);
- return 1;
- }
- }
- }
-
- if(ioctl(console, VT_OPENQRY, &openvtnum)<0) {
- syslog(LOG_ERR, "VT_OPENQRY: %m");
- return 1;
- }
- if(openvtnum==-1) {
- syslog(LOG_ERR, "No free VTs");
- return 1;
- }
-
- snprintf(openvtname, sizeof openvtname, "/dev/tty%d", openvtnum);
- seteuid(0);
- openvt=open(openvtname, O_RDWR);
- if(openvt<0) {
- seteuid(uid);
- syslog(LOG_ERR, "open(%s): %m", openvtname);
- return 1;
- }
-
- chowned=fchown(openvt, uid, gid);
- if(chowned<0) {
- seteuid(uid);
- syslog(LOG_ERR, "fchown(%s): %m", openvtname);
- return 1;
- }
-
- close(console);
-
- if(ioctl(openvt, VT_ACTIVATE, openvtnum)<0) {
- seteuid(uid);
- syslog(LOG_ERR, "VT_ACTIVATE(%d): %m", openvtnum);
- return 1;
- }
-
- while(ioctl(openvt, VT_WAITACTIVE, openvtnum)<0) {
- if(errno!=EINTR) {
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "VT_WAITACTIVE(%d): %m", openvtnum);
- return 1;
- }
- }
-
- seteuid(uid);
- fp=fdopen(openvt, "r+");
- if(!fp) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "fdopen(%s): %m", openvtname);
- return 1;
- }
-
- if(tcgetattr(openvt, &t)<0) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "tcgetattr(%s): %m", openvtname);
- return 1;
- }
- t.c_lflag &= ~ECHO;
- if(tcsetattr(openvt, TCSANOW, &t)<0) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "tcsetattr(%s): %m", openvtname);
- return 1;
- }
-
- if(fprintf(fp, "\033[2J\033[H")<0) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "write error on %s: %m", openvtname);
- return 1;
- }
- if(argv[1][0] && argv[2][0]) {
- if(fprintf(fp, "Password for PPP client %s on server %s: ", argv[1], argv[2])<0) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "write error on %s: %m", openvtname);
- return 1;
- }
- } else if(argv[1][0] && !argv[2][0]) {
- if(fprintf(fp, "Password for PPP client %s: ", argv[1])<0) {
- syslog(LOG_ERR, "write error on %s: %m", openvtname);
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- return 1;
- }
- } else if(!argv[1][0] && argv[2][0]) {
- if(fprintf(fp, "Password for PPP on server %s: ", argv[2])<0) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "write error on %s: %m", openvtname);
- return 1;
- }
- } else {
- if(fprintf(fp, "Enter PPP password: ")<0) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- syslog(LOG_ERR, "write error on %s: %m", openvtname);
- return 1;
- }
- }
-
- if(!fgets(pass, sizeof pass, fp)) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- if(ferror(fp)) {
- syslog(LOG_ERR, "read error on %s: %m", openvtname);
- }
- return 1;
- }
- if((nl=strchr(pass, '\n')))
- *nl=0;
- passlen=strlen(pass);
-
- outfd=atoi(argv[3]);
- if((wrote=write(outfd, pass, passlen))!=passlen) {
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- if(wrote<0)
- syslog(LOG_ERR, "write error on outpipe: %m");
- else
- syslog(LOG_ERR, "short write on outpipe");
- return 1;
- }
-
- seteuid(0);
- ioctl(openvt, VT_ACTIVATE, origstate.v_active);
- seteuid(uid);
- return 0;
-}
-
-static int console_owner(uid_t uid, int cons)
-{
- char name[256];
- struct stat st;
- snprintf(name, sizeof name, "/dev/tty%d", cons);
- if(stat(name, &st)<0) {
- if(errno!=ENOENT)
- syslog(LOG_ERR, "stat(%s): %m", name);
- return 0;
- }
- return uid==st.st_uid;
-}
diff --git a/mdk-stage1/ppp/etc.ppp/chap-secrets b/mdk-stage1/ppp/etc.ppp/chap-secrets
deleted file mode 100644
index 7d1c3cd7c..000000000
--- a/mdk-stage1/ppp/etc.ppp/chap-secrets
+++ /dev/null
@@ -1,2 +0,0 @@
-# Secrets for authentication using CHAP
-# client server secret IP addresses
diff --git a/mdk-stage1/ppp/etc.ppp/options b/mdk-stage1/ppp/etc.ppp/options
deleted file mode 100644
index 0f77a9aa0..000000000
--- a/mdk-stage1/ppp/etc.ppp/options
+++ /dev/null
@@ -1,5 +0,0 @@
-lock
-noauth
-noipdefault
-usepeerdns
-
diff --git a/mdk-stage1/ppp/etc.ppp/options.options b/mdk-stage1/ppp/etc.ppp/options.options
deleted file mode 100644
index 4b67b6a0d..000000000
--- a/mdk-stage1/ppp/etc.ppp/options.options
+++ /dev/null
@@ -1 +0,0 @@
-lock
diff --git a/mdk-stage1/ppp/etc.ppp/pap-secrets b/mdk-stage1/ppp/etc.ppp/pap-secrets
deleted file mode 100644
index f8b7dce3c..000000000
--- a/mdk-stage1/ppp/etc.ppp/pap-secrets
+++ /dev/null
@@ -1,2 +0,0 @@
-# Secrets for authentication using PAP
-# client server secret IP addresses
diff --git a/mdk-stage1/ppp/include/linux/if_ppp.h b/mdk-stage1/ppp/include/linux/if_ppp.h
deleted file mode 100644
index 1febf0931..000000000
--- a/mdk-stage1/ppp/include/linux/if_ppp.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $Id$ */
-
-/*
- * if_ppp.h - Point-to-Point Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-
-/*
- * ==FILEVERSION 20000724==
- *
- * NOTE TO MAINTAINERS:
- * If you modify this file at all, please set the above date.
- * if_ppp.h is shipped with a PPP distribution as well as with the kernel;
- * if everyone increases the FILEVERSION number above, then scripts
- * can do the right thing when deciding whether to install a new if_ppp.h
- * file. Don't change the format of that line otherwise, so the
- * installation script can recognize it.
- */
-
-#ifndef _IF_PPP_H_
-#define _IF_PPP_H_
-
-/*
- * Packet sizes
- */
-
-#define PPP_MTU 1500 /* Default MTU (size of Info field) */
-#define PPP_MAXMRU 65000 /* Largest MRU we allow */
-#define PROTO_IPX 0x002b /* protocol numbers */
-#define PROTO_DNA_RT 0x0027 /* DNA Routing */
-
-
-/*
- * Bit definitions for flags.
- */
-
-#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
-#define SC_COMP_AC 0x00000002 /* header compression (output) */
-#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
-#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
-#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
-#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
-#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
-#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
-#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
-#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */
-#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */
-#define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */
-#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
-#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
-#define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */
-#define SC_DEBUG 0x00010000 /* enable debug messages */
-#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
-#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
-#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
-#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
-#define SC_SYNC 0x00200000 /* synchronous serial mode */
-#define SC_MASK 0x0f200fff /* bits that user can change */
-
-/* state bits */
-#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */
-#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
-#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
-#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
-#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
-#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
-#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
-
-/*
- * Ioctl definitions.
- */
-
-struct npioctl {
- int protocol; /* PPP protocol, e.g. PPP_IP */
- enum NPmode mode;
-};
-
-/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
-struct ppp_option_data {
- __u8 *ptr;
- __u32 length;
- int transmit;
-};
-
-struct ifpppstatsreq {
- struct ifreq b;
- struct ppp_stats stats; /* statistic information */
-};
-
-struct ifpppcstatsreq {
- struct ifreq b;
- struct ppp_comp_stats stats;
-};
-
-#define ifr__name b.ifr_ifrn.ifrn_name
-#define stats_ptr b.ifr_ifru.ifru_data
-
-/*
- * Ioctl definitions.
- */
-
-#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
-#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
-#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
-#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
-#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
-#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
-#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
-#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
-#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
-#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
-#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
-#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
-#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
-#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
-#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
-#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
-#define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */
-#define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */
-#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
-#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
-#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
-#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */
-#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */
-#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */
-#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */
-#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */
-#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */
-#define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */
-#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */
-
-#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
-#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
-#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
-
-#if !defined(ifr_mtu)
-#define ifr_mtu ifr_ifru.ifru_metric
-#endif
-
-#endif /* _IF_PPP_H_ */
diff --git a/mdk-stage1/ppp/include/linux/if_pppvar.h b/mdk-stage1/ppp/include/linux/if_pppvar.h
deleted file mode 100644
index b2485cd9d..000000000
--- a/mdk-stage1/ppp/include/linux/if_pppvar.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* From: if_pppvar.h,v 1.2 1995/06/12 11:36:51 paulus Exp */
-/*
- * if_pppvar.h - private structures and declarations for PPP.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- * ==FILEVERSION 990911==
- *
- * NOTE TO MAINTAINERS:
- * If you modify this file at all, please set the above date.
- * if_pppvar.h is shipped with a PPP distribution as well as with the kernel;
- * if everyone increases the FILEVERSION number above, then scripts
- * can do the right thing when deciding whether to install a new if_pppvar.h
- * file. Don't change the format of that line otherwise, so the
- * installation script can recognize it.
- */
-
-/*
- * Supported network protocols. These values are used for
- * indexing sc_npmode.
- */
-
-#define NP_IP 0 /* Internet Protocol */
-#define NP_IPX 1 /* IPX protocol */
-#define NP_AT 2 /* Appletalk protocol */
-#define NP_IPV6 3 /* Internet Protocol */
-#define NUM_NP 4 /* Number of NPs. */
-
-#define OBUFSIZE 256 /* # chars of output buffering */
-
-/*
- * Structure describing each ppp unit.
- */
-
-struct ppp {
- int magic; /* magic value for structure */
- struct ppp *next; /* unit with next index */
- unsigned long inuse; /* are we allocated? */
- int line; /* network interface unit # */
- __u32 flags; /* miscellaneous control flags */
- int mtu; /* maximum xmit frame size */
- int mru; /* maximum receive frame size */
- struct slcompress *slcomp; /* for TCP header compression */
- struct sk_buff_head xmt_q; /* frames to send from pppd */
- struct sk_buff_head rcv_q; /* frames for pppd to read */
- unsigned long xmit_busy; /* bit 0 set when xmitter busy */
-
- /* Information specific to using ppp on async serial lines. */
- struct tty_struct *tty; /* ptr to TTY structure */
- struct tty_struct *backup_tty; /* TTY to use if tty gets closed */
- __u8 escape; /* 0x20 if prev char was PPP_ESC */
- __u8 toss; /* toss this frame */
- volatile __u8 tty_pushing; /* internal state flag */
- volatile __u8 woke_up; /* internal state flag */
- __u32 xmit_async_map[8]; /* 1 bit means that given control
- character is quoted on output*/
- __u32 recv_async_map; /* 1 bit means that given control
- character is ignored on input*/
- __u32 bytes_sent; /* Bytes sent on frame */
- __u32 bytes_rcvd; /* Bytes recvd on frame */
-
- /* Async transmission information */
- struct sk_buff *tpkt; /* frame currently being sent */
- int tpkt_pos; /* how much of it we've done */
- __u16 tfcs; /* FCS so far for it */
- unsigned char *optr; /* where we're up to in sending */
- unsigned char *olim; /* points past last valid char */
-
- /* Async reception information */
- struct sk_buff *rpkt; /* frame currently being rcvd */
- __u16 rfcs; /* FCS so far of rpkt */
-
- /* Queues for select() functionality */
- struct wait_queue *read_wait; /* queue for reading processes */
-
- /* info for detecting idle channels */
- unsigned long last_xmit; /* time of last transmission */
- unsigned long last_recv; /* time last packet received */
-
- /* Statistic information */
- struct pppstat stats; /* statistic information */
-
- /* PPP compression protocol information */
- struct compressor *sc_xcomp; /* transmit compressor */
- void *sc_xc_state; /* transmit compressor state */
- struct compressor *sc_rcomp; /* receive decompressor */
- void *sc_rc_state; /* receive decompressor state */
-
- enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
- int sc_xfer; /* PID of reserved PPP table */
- char name[8]; /* space for unit name */
- struct device dev; /* net device structure */
- struct enet_statistics estats; /* more detailed stats */
-
- /* tty output buffer */
- unsigned char obuf[OBUFSIZE]; /* buffer for characters to send */
-};
-
-#define PPP_MAGIC 0x5002
-#define PPP_VERSION "2.3.11"
diff --git a/mdk-stage1/ppp/include/linux/ppp-comp.h b/mdk-stage1/ppp/include/linux/ppp-comp.h
deleted file mode 100644
index 3184d0731..000000000
--- a/mdk-stage1/ppp/include/linux/ppp-comp.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * ppp-comp.h - Definitions for doing PPP packet compression.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-/*
- * ==FILEVERSION 980319==
- *
- * NOTE TO MAINTAINERS:
- * If you modify this file at all, please set the above date.
- * ppp-comp.h is shipped with a PPP distribution as well as with the kernel;
- * if everyone increases the FILEVERSION number above, then scripts
- * can do the right thing when deciding whether to install a new ppp-comp.h
- * file. Don't change the format of that line otherwise, so the
- * installation script can recognize it.
- */
-
-#ifndef _NET_PPP_COMP_H
-#define _NET_PPP_COMP_H
-
-/*
- * The following symbols control whether we include code for
- * various compression methods.
- */
-
-#ifndef DO_BSD_COMPRESS
-#define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */
-#endif
-#ifndef DO_DEFLATE
-#define DO_DEFLATE 1 /* by default, include Deflate */
-#endif
-#define DO_PREDICTOR_1 0
-#define DO_PREDICTOR_2 0
-
-/*
- * Structure giving methods for compression/decompression.
- */
-
-struct compressor {
- int compress_proto; /* CCP compression protocol number */
-
- /* Allocate space for a compressor (transmit side) */
- void *(*comp_alloc) (unsigned char *options, int opt_len);
-
- /* Free space used by a compressor */
- void (*comp_free) (void *state);
-
- /* Initialize a compressor */
- int (*comp_init) (void *state, unsigned char *options,
- int opt_len, int unit, int opthdr, int debug);
-
- /* Reset a compressor */
- void (*comp_reset) (void *state);
-
- /* Compress a packet */
- int (*compress) (void *state, unsigned char *rptr,
- unsigned char *obuf, int isize, int osize);
-
- /* Return compression statistics */
- void (*comp_stat) (void *state, struct compstat *stats);
-
- /* Allocate space for a decompressor (receive side) */
- void *(*decomp_alloc) (unsigned char *options, int opt_len);
-
- /* Free space used by a decompressor */
- void (*decomp_free) (void *state);
-
- /* Initialize a decompressor */
- int (*decomp_init) (void *state, unsigned char *options,
- int opt_len, int unit, int opthdr, int mru,
- int debug);
-
- /* Reset a decompressor */
- void (*decomp_reset) (void *state);
-
- /* Decompress a packet. */
- int (*decompress) (void *state, unsigned char *ibuf, int isize,
- unsigned char *obuf, int osize);
-
- /* Update state for an incompressible packet received */
- void (*incomp) (void *state, unsigned char *ibuf, int icnt);
-
- /* Return decompression statistics */
- void (*decomp_stat) (void *state, struct compstat *stats);
-};
-
-/*
- * The return value from decompress routine is the length of the
- * decompressed packet if successful, otherwise DECOMP_ERROR
- * or DECOMP_FATALERROR if an error occurred.
- *
- * We need to make this distinction so that we can disable certain
- * useful functionality, namely sending a CCP reset-request as a result
- * of an error detected after decompression. This is to avoid infringing
- * a patent held by Motorola.
- * Don't you just lurve software patents.
- */
-
-#define DECOMP_ERROR -1 /* error detected before decomp. */
-#define DECOMP_FATALERROR -2 /* error detected after decomp. */
-
-/*
- * CCP codes.
- */
-
-#define CCP_CONFREQ 1
-#define CCP_CONFACK 2
-#define CCP_TERMREQ 5
-#define CCP_TERMACK 6
-#define CCP_RESETREQ 14
-#define CCP_RESETACK 15
-
-/*
- * Max # bytes for a CCP option
- */
-
-#define CCP_MAX_OPTION_LENGTH 32
-
-/*
- * Parts of a CCP packet.
- */
-
-#define CCP_CODE(dp) ((dp)[0])
-#define CCP_ID(dp) ((dp)[1])
-#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
-#define CCP_HDRLEN 4
-
-#define CCP_OPT_CODE(dp) ((dp)[0])
-#define CCP_OPT_LENGTH(dp) ((dp)[1])
-#define CCP_OPT_MINLEN 2
-
-/*
- * Definitions for BSD-Compress.
- */
-
-#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */
-#define CILEN_BSD_COMPRESS 3 /* length of config. option */
-
-/* Macros for handling the 3rd byte of the BSD-Compress config option. */
-#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */
-#define BSD_VERSION(x) ((x) >> 5) /* version of option format */
-#define BSD_CURRENT_VERSION 1 /* current version number */
-#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
-
-#define BSD_MIN_BITS 9 /* smallest code size supported */
-#define BSD_MAX_BITS 15 /* largest code size supported */
-
-/*
- * Definitions for Deflate.
- */
-
-#define CI_DEFLATE 26 /* config option for Deflate */
-#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */
-#define CILEN_DEFLATE 4 /* length of its config option */
-
-#define DEFLATE_MIN_SIZE 8
-#define DEFLATE_MAX_SIZE 15
-#define DEFLATE_METHOD_VAL 8
-#define DEFLATE_SIZE(x) (((x) >> 4) + DEFLATE_MIN_SIZE)
-#define DEFLATE_METHOD(x) ((x) & 0x0F)
-#define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \
- + DEFLATE_METHOD_VAL)
-#define DEFLATE_CHK_SEQUENCE 0
-
-/*
- * Definitions for other, as yet unsupported, compression methods.
- */
-
-#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */
-#define CILEN_PREDICTOR_1 2 /* length of its config option */
-#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */
-#define CILEN_PREDICTOR_2 2 /* length of its config option */
-
-#ifdef __KERNEL__
-extern int ppp_register_compressor(struct compressor *);
-extern void ppp_unregister_compressor(struct compressor *);
-#endif /* __KERNEL__ */
-
-#endif /* _NET_PPP_COMP_H */
diff --git a/mdk-stage1/ppp/include/linux/ppp_defs.h b/mdk-stage1/ppp/include/linux/ppp_defs.h
deleted file mode 100644
index 46946fbdc..000000000
--- a/mdk-stage1/ppp/include/linux/ppp_defs.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/* $Id$ */
-
-/*
- * ppp_defs.h - PPP definitions.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- */
-
-/*
- * ==FILEVERSION 20000114==
- *
- * NOTE TO MAINTAINERS:
- * If you modify this file at all, please set the above date.
- * ppp_defs.h is shipped with a PPP distribution as well as with the kernel;
- * if everyone increases the FILEVERSION number above, then scripts
- * can do the right thing when deciding whether to install a new ppp_defs.h
- * file. Don't change the format of that line otherwise, so the
- * installation script can recognize it.
- */
-
-#ifndef _PPP_DEFS_H_
-#define _PPP_DEFS_H_
-
-/*
- * The basic PPP frame.
- */
-#define PPP_HDRLEN 4 /* octets for standard ppp header */
-#define PPP_FCSLEN 2 /* octets for FCS */
-#define PPP_MRU 1500 /* default MRU = max length of info field */
-
-#define PPP_ADDRESS(p) (((__u8 *)(p))[0])
-#define PPP_CONTROL(p) (((__u8 *)(p))[1])
-#define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3])
-
-/*
- * Significant octet values.
- */
-#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
-#define PPP_UI 0x03 /* Unnumbered Information */
-#define PPP_FLAG 0x7e /* Flag Sequence */
-#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
-#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
-
-/*
- * Protocol field values.
- */
-#define PPP_IP 0x21 /* Internet Protocol */
-#define PPP_AT 0x29 /* AppleTalk Protocol */
-#define PPP_IPX 0x2b /* IPX protocol */
-#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
-#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
-#define PPP_MP 0x3d /* Multilink protocol */
-#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
-#define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */
-#define PPP_COMP 0xfd /* compressed packet */
-#define PPP_IPCP 0x8021 /* IP Control Protocol */
-#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
-#define PPP_IPXCP 0x802b /* IPX Control Protocol */
-#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
-#define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */
-#define PPP_CCP 0x80fd /* Compression Control Protocol */
-#define PPP_LCP 0xc021 /* Link Control Protocol */
-#define PPP_PAP 0xc023 /* Password Authentication Protocol */
-#define PPP_LQR 0xc025 /* Link Quality Report protocol */
-#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
-#define PPP_CBCP 0xc029 /* Callback Control Protocol */
-
-/*
- * Values for FCS calculations.
- */
-
-#define PPP_INITFCS 0xffff /* Initial FCS value */
-#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
-#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
-
-/*
- * Extended asyncmap - allows any character to be escaped.
- */
-
-typedef __u32 ext_accm[8];
-
-/*
- * What to do with network protocol (NP) packets.
- */
-enum NPmode {
- NPMODE_PASS, /* pass the packet through */
- NPMODE_DROP, /* silently drop the packet */
- NPMODE_ERROR, /* return an error */
- NPMODE_QUEUE /* save it up for later. */
-};
-
-/*
- * Statistics for LQRP and pppstats
- */
-struct pppstat {
- __u32 ppp_discards; /* # frames discarded */
-
- __u32 ppp_ibytes; /* bytes received */
- __u32 ppp_ioctects; /* bytes received not in error */
- __u32 ppp_ipackets; /* packets received */
- __u32 ppp_ierrors; /* receive errors */
- __u32 ppp_ilqrs; /* # LQR frames received */
-
- __u32 ppp_obytes; /* raw bytes sent */
- __u32 ppp_ooctects; /* frame bytes sent */
- __u32 ppp_opackets; /* packets sent */
- __u32 ppp_oerrors; /* transmit errors */
- __u32 ppp_olqrs; /* # LQR frames sent */
-};
-
-struct vjstat {
- __u32 vjs_packets; /* outbound packets */
- __u32 vjs_compressed; /* outbound compressed packets */
- __u32 vjs_searches; /* searches for connection state */
- __u32 vjs_misses; /* times couldn't find conn. state */
- __u32 vjs_uncompressedin; /* inbound uncompressed packets */
- __u32 vjs_compressedin; /* inbound compressed packets */
- __u32 vjs_errorin; /* inbound unknown type packets */
- __u32 vjs_tossed; /* inbound packets tossed because of error */
-};
-
-struct compstat {
- __u32 unc_bytes; /* total uncompressed bytes */
- __u32 unc_packets; /* total uncompressed packets */
- __u32 comp_bytes; /* compressed bytes */
- __u32 comp_packets; /* compressed packets */
- __u32 inc_bytes; /* incompressible bytes */
- __u32 inc_packets; /* incompressible packets */
-
- /* the compression ratio is defined as in_count / bytes_out */
- __u32 in_count; /* Bytes received */
- __u32 bytes_out; /* Bytes transmitted */
-
- double ratio; /* not computed in kernel. */
-};
-
-struct ppp_stats {
- struct pppstat p; /* basic PPP statistics */
- struct vjstat vj; /* VJ header compression statistics */
-};
-
-struct ppp_comp_stats {
- struct compstat c; /* packet compression statistics */
- struct compstat d; /* packet decompression statistics */
-};
-
-/*
- * The following structure records the time in seconds since
- * the last NP packet was sent or received.
- */
-struct ppp_idle {
- time_t xmit_idle; /* time since last NP packet sent */
- time_t recv_idle; /* time since last NP packet received */
-};
-
-#ifndef __P
-#ifdef __STDC__
-#define __P(x) x
-#else
-#define __P(x) ()
-#endif
-#endif
-
-#endif /* _PPP_DEFS_H_ */
diff --git a/mdk-stage1/ppp/include/net/if_ppp.h b/mdk-stage1/ppp/include/net/if_ppp.h
deleted file mode 100644
index 1527ecf3f..000000000
--- a/mdk-stage1/ppp/include/net/if_ppp.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id$ */
-
-/*
- * if_ppp.h - Point-to-Point Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef _IF_PPP_H_
-#define _IF_PPP_H_
-
-/*
- * Bit definitions for flags.
- */
-#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
-#define SC_COMP_AC 0x00000002 /* header compression (output) */
-#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
-#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
-#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
-#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
-#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
-#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
-#define SC_DEBUG 0x00010000 /* enable debug messages */
-#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
-#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
-#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
-#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
-#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
-#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
-#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
-#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
-#define SC_SYNC 0x00200000 /* use synchronous HDLC framing */
-#define SC_MASK 0x0fff00ff /* bits that user can change */
-
-/*
- * State bits in sc_flags, not changeable by user.
- */
-#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */
-#define SC_VJ_RESET 0x00000800 /* need to reset VJ decomp */
-#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
-#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
-#define SC_DC_ERROR 0x00004000 /* non-fatal decomp error detected */
-#define SC_DC_FERROR 0x00008000 /* fatal decomp error detected */
-#define SC_TBUSY 0x10000000 /* xmitter doesn't need a packet yet */
-#define SC_PKTLOST 0x20000000 /* have lost or dropped a packet */
-#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
-#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
-
-/*
- * Ioctl definitions.
- */
-
-struct npioctl {
- int protocol; /* PPP procotol, e.g. PPP_IP */
- enum NPmode mode;
-};
-
-/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
-struct ppp_option_data {
- u_char *ptr;
- u_int length;
- int transmit;
-};
-
-struct ifpppstatsreq {
- char ifr_name[IFNAMSIZ];
- struct ppp_stats stats;
-};
-
-struct ifpppcstatsreq {
- char ifr_name[IFNAMSIZ];
- struct ppp_comp_stats stats;
-};
-
-/*
- * Ioctl definitions.
- */
-
-#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
-#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
-#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
-#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
-#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
-#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
-#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
-#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
-#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
-#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
-#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
-#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
-#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
-#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
-#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
-#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
-#define PPPIOCGIDLE _IOR('t', 74, struct ppp_idle) /* get idle time */
-#ifdef PPP_FILTER
-#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
-#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
-#endif /* PPP_FILTER */
-
-/* PPPIOC[GS]MTU are alternatives to SIOC[GS]IFMTU, used under Ultrix */
-#define PPPIOCGMTU _IOR('t', 73, int) /* get interface MTU */
-#define PPPIOCSMTU _IOW('t', 72, int) /* set interface MTU */
-
-/*
- * These two are interface ioctls so that pppstats can do them on
- * a socket without having to open the serial device.
- */
-#define SIOCGPPPSTATS _IOWR('i', 123, struct ifpppstatsreq)
-#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq)
-
-#if !defined(ifr_mtu)
-#define ifr_mtu ifr_ifru.ifru_metric
-#endif
-
-#if (defined(_KERNEL) || defined(KERNEL)) && !defined(NeXT)
-void pppattach __P((void));
-void pppintr __P((void));
-#endif
-#endif /* _IF_PPP_H_ */
diff --git a/mdk-stage1/ppp/include/net/ppp-comp.h b/mdk-stage1/ppp/include/net/ppp-comp.h
deleted file mode 100644
index 0e6a9c672..000000000
--- a/mdk-stage1/ppp/include/net/ppp-comp.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * ppp-comp.h - Definitions for doing PPP packet compression.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-#ifndef _NET_PPP_COMP_H
-#define _NET_PPP_COMP_H
-
-/*
- * The following symbols control whether we include code for
- * various compression methods.
- */
-#ifndef DO_BSD_COMPRESS
-#define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */
-#endif
-#ifndef DO_DEFLATE
-#define DO_DEFLATE 1 /* by default, include Deflate */
-#endif
-#define DO_PREDICTOR_1 0
-#define DO_PREDICTOR_2 0
-
-/*
- * Structure giving methods for compression/decompression.
- */
-#ifdef PACKETPTR
-struct compressor {
- int compress_proto; /* CCP compression protocol number */
-
- /* Allocate space for a compressor (transmit side) */
- void *(*comp_alloc) __P((u_char *options, int opt_len));
- /* Free space used by a compressor */
- void (*comp_free) __P((void *state));
- /* Initialize a compressor */
- int (*comp_init) __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int debug));
- /* Reset a compressor */
- void (*comp_reset) __P((void *state));
- /* Compress a packet */
- int (*compress) __P((void *state, PACKETPTR *mret,
- PACKETPTR mp, int orig_len, int max_len));
- /* Return compression statistics */
- void (*comp_stat) __P((void *state, struct compstat *stats));
-
- /* Allocate space for a decompressor (receive side) */
- void *(*decomp_alloc) __P((u_char *options, int opt_len));
- /* Free space used by a decompressor */
- void (*decomp_free) __P((void *state));
- /* Initialize a decompressor */
- int (*decomp_init) __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int mru, int debug));
- /* Reset a decompressor */
- void (*decomp_reset) __P((void *state));
- /* Decompress a packet. */
- int (*decompress) __P((void *state, PACKETPTR mp,
- PACKETPTR *dmpp));
- /* Update state for an incompressible packet received */
- void (*incomp) __P((void *state, PACKETPTR mp));
- /* Return decompression statistics */
- void (*decomp_stat) __P((void *state, struct compstat *stats));
-};
-#endif /* PACKETPTR */
-
-/*
- * Return values for decompress routine.
- * We need to make these distinctions so that we can disable certain
- * useful functionality, namely sending a CCP reset-request as a result
- * of an error detected after decompression. This is to avoid infringing
- * a patent held by Motorola.
- * Don't you just lurve software patents.
- */
-#define DECOMP_OK 0 /* everything went OK */
-#define DECOMP_ERROR 1 /* error detected before decomp. */
-#define DECOMP_FATALERROR 2 /* error detected after decomp. */
-
-/*
- * CCP codes.
- */
-#define CCP_CONFREQ 1
-#define CCP_CONFACK 2
-#define CCP_TERMREQ 5
-#define CCP_TERMACK 6
-#define CCP_RESETREQ 14
-#define CCP_RESETACK 15
-
-/*
- * Max # bytes for a CCP option
- */
-#define CCP_MAX_OPTION_LENGTH 32
-
-/*
- * Parts of a CCP packet.
- */
-#define CCP_CODE(dp) ((dp)[0])
-#define CCP_ID(dp) ((dp)[1])
-#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
-#define CCP_HDRLEN 4
-
-#define CCP_OPT_CODE(dp) ((dp)[0])
-#define CCP_OPT_LENGTH(dp) ((dp)[1])
-#define CCP_OPT_MINLEN 2
-
-/*
- * Definitions for BSD-Compress.
- */
-#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */
-#define CILEN_BSD_COMPRESS 3 /* length of config. option */
-
-/* Macros for handling the 3rd byte of the BSD-Compress config option. */
-#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */
-#define BSD_VERSION(x) ((x) >> 5) /* version of option format */
-#define BSD_CURRENT_VERSION 1 /* current version number */
-#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
-
-#define BSD_MIN_BITS 9 /* smallest code size supported */
-#define BSD_MAX_BITS 15 /* largest code size supported */
-
-/*
- * Definitions for Deflate.
- */
-#define CI_DEFLATE 26 /* config option for Deflate */
-#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */
-#define CILEN_DEFLATE 4 /* length of its config option */
-
-#define DEFLATE_MIN_SIZE 8
-#define DEFLATE_MAX_SIZE 15
-#define DEFLATE_METHOD_VAL 8
-#define DEFLATE_SIZE(x) (((x) >> 4) + DEFLATE_MIN_SIZE)
-#define DEFLATE_METHOD(x) ((x) & 0x0F)
-#define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \
- + DEFLATE_METHOD_VAL)
-#define DEFLATE_CHK_SEQUENCE 0
-
-/*
- * Definitions for other, as yet unsupported, compression methods.
- */
-#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */
-#define CILEN_PREDICTOR_1 2 /* length of its config option */
-#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */
-#define CILEN_PREDICTOR_2 2 /* length of its config option */
-
-#endif /* _NET_PPP_COMP_H */
diff --git a/mdk-stage1/ppp/include/net/ppp_defs.h b/mdk-stage1/ppp/include/net/ppp_defs.h
deleted file mode 100644
index 46bef52bb..000000000
--- a/mdk-stage1/ppp/include/net/ppp_defs.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $Id$ */
-
-/*
- * ppp_defs.h - PPP definitions.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- */
-
-#ifndef _PPP_DEFS_H_
-#define _PPP_DEFS_H_
-
-/*
- * The basic PPP frame.
- */
-#define PPP_HDRLEN 4 /* octets for standard ppp header */
-#define PPP_FCSLEN 2 /* octets for FCS */
-
-/*
- * Packet sizes
- *
- * Note - lcp shouldn't be allowed to negotiate stuff outside these
- * limits. See lcp.h in the pppd directory.
- * (XXX - these constants should simply be shared by lcp.c instead
- * of living in lcp.h)
- */
-#define PPP_MTU 1500 /* Default MTU (size of Info field) */
-#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
-#define PPP_MINMTU 64
-#define PPP_MRU 1500 /* default MRU = max length of info field */
-#define PPP_MAXMRU 65000 /* Largest MRU we allow */
-#define PPP_MINMRU 128
-
-#define PPP_ADDRESS(p) (((u_char *)(p))[0])
-#define PPP_CONTROL(p) (((u_char *)(p))[1])
-#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
-
-/*
- * Significant octet values.
- */
-#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
-#define PPP_UI 0x03 /* Unnumbered Information */
-#define PPP_FLAG 0x7e /* Flag Sequence */
-#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
-#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
-
-/*
- * Protocol field values.
- */
-#define PPP_IP 0x21 /* Internet Protocol */
-#define PPP_AT 0x29 /* AppleTalk Protocol */
-#define PPP_IPX 0x2b /* IPX protocol */
-#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
-#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
-#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
-#define PPP_COMP 0xfd /* compressed packet */
-#define PPP_IPCP 0x8021 /* IP Control Protocol */
-#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
-#define PPP_IPXCP 0x802b /* IPX Control Protocol */
-#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
-#define PPP_CCP 0x80fd /* Compression Control Protocol */
-#define PPP_LCP 0xc021 /* Link Control Protocol */
-#define PPP_PAP 0xc023 /* Password Authentication Protocol */
-#define PPP_LQR 0xc025 /* Link Quality Report protocol */
-#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
-#define PPP_CBCP 0xc029 /* Callback Control Protocol */
-
-/*
- * Values for FCS calculations.
- */
-#define PPP_INITFCS 0xffff /* Initial FCS value */
-#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
-#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
-
-/*
- * A 32-bit unsigned integral type.
- */
-
-#if !defined(__BIT_TYPES_DEFINED__) && !defined(_BITYPES) \
- && !defined(__FreeBSD__) && (NS_TARGET < 40) && !defined(__dietlibc__)
-#ifdef UINT32_T
-typedef UINT32_T u_int32_t;
-#else
-typedef unsigned int u_int32_t;
-typedef unsigned short u_int16_t;
-#endif
-#endif
-
-/*
- * Extended asyncmap - allows any character to be escaped.
- */
-typedef u_int32_t ext_accm[8];
-
-/*
- * What to do with network protocol (NP) packets.
- */
-enum NPmode {
- NPMODE_PASS, /* pass the packet through */
- NPMODE_DROP, /* silently drop the packet */
- NPMODE_ERROR, /* return an error */
- NPMODE_QUEUE /* save it up for later. */
-};
-
-/*
- * Statistics.
- */
-struct pppstat {
- unsigned int ppp_ibytes; /* bytes received */
- unsigned int ppp_ipackets; /* packets received */
- unsigned int ppp_ierrors; /* receive errors */
- unsigned int ppp_obytes; /* bytes sent */
- unsigned int ppp_opackets; /* packets sent */
- unsigned int ppp_oerrors; /* transmit errors */
-};
-
-struct vjstat {
- unsigned int vjs_packets; /* outbound packets */
- unsigned int vjs_compressed; /* outbound compressed packets */
- unsigned int vjs_searches; /* searches for connection state */
- unsigned int vjs_misses; /* times couldn't find conn. state */
- unsigned int vjs_uncompressedin; /* inbound uncompressed packets */
- unsigned int vjs_compressedin; /* inbound compressed packets */
- unsigned int vjs_errorin; /* inbound unknown type packets */
- unsigned int vjs_tossed; /* inbound packets tossed because of error */
-};
-
-struct ppp_stats {
- struct pppstat p; /* basic PPP statistics */
- struct vjstat vj; /* VJ header compression statistics */
-};
-
-struct compstat {
- unsigned int unc_bytes; /* total uncompressed bytes */
- unsigned int unc_packets; /* total uncompressed packets */
- unsigned int comp_bytes; /* compressed bytes */
- unsigned int comp_packets; /* compressed packets */
- unsigned int inc_bytes; /* incompressible bytes */
- unsigned int inc_packets; /* incompressible packets */
- unsigned int ratio; /* recent compression ratio << 8 */
-};
-
-struct ppp_comp_stats {
- struct compstat c; /* packet compression statistics */
- struct compstat d; /* packet decompression statistics */
-};
-
-/*
- * The following structure records the time in seconds since
- * the last NP packet was sent or received.
- */
-struct ppp_idle {
- time_t xmit_idle; /* time since last NP packet sent */
- time_t recv_idle; /* time since last NP packet received */
-};
-
-#ifndef __P
-#ifdef __STDC__
-#define __P(x) x
-#else
-#define __P(x) ()
-#endif
-#endif
-
-#endif /* _PPP_DEFS_H_ */
diff --git a/mdk-stage1/ppp/include/net/pppio.h b/mdk-stage1/ppp/include/net/pppio.h
deleted file mode 100644
index 9db1ca9ab..000000000
--- a/mdk-stage1/ppp/include/net/pppio.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * pppio.h - ioctl and other misc. definitions for STREAMS modules.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-#define _PPPIO(n) (('p' << 8) + (n))
-
-#define PPPIO_NEWPPA _PPPIO(130) /* allocate a new PPP unit */
-#define PPPIO_GETSTAT _PPPIO(131) /* get PPP statistics */
-#define PPPIO_GETCSTAT _PPPIO(132) /* get PPP compression stats */
-#define PPPIO_MTU _PPPIO(133) /* set max transmission unit */
-#define PPPIO_MRU _PPPIO(134) /* set max receive unit */
-#define PPPIO_CFLAGS _PPPIO(135) /* set/clear/get compression flags */
-#define PPPIO_XCOMP _PPPIO(136) /* alloc transmit compressor */
-#define PPPIO_RCOMP _PPPIO(137) /* alloc receive decompressor */
-#define PPPIO_XACCM _PPPIO(138) /* set transmit asyncmap */
-#define PPPIO_RACCM _PPPIO(139) /* set receive asyncmap */
-#define PPPIO_VJINIT _PPPIO(140) /* initialize VJ comp/decomp */
-#define PPPIO_ATTACH _PPPIO(141) /* attach to a ppa (without putmsg) */
-#define PPPIO_LASTMOD _PPPIO(142) /* mark last ppp module */
-#define PPPIO_GCLEAN _PPPIO(143) /* get 8-bit-clean flags */
-#define PPPIO_DEBUG _PPPIO(144) /* request debug information */
-#define PPPIO_BIND _PPPIO(145) /* bind to SAP */
-#define PPPIO_NPMODE _PPPIO(146) /* set mode for handling data pkts */
-#define PPPIO_GIDLE _PPPIO(147) /* get time since last data pkt */
-#define PPPIO_PASSFILT _PPPIO(148) /* set filter for packets to pass */
-#define PPPIO_ACTIVEFILT _PPPIO(149) /* set filter for "link active" pkts */
-
-/*
- * Values for PPPIO_CFLAGS
- */
-#define COMP_AC 0x1 /* compress address/control */
-#define DECOMP_AC 0x2 /* decompress address/control */
-#define COMP_PROT 0x4 /* compress PPP protocol */
-#define DECOMP_PROT 0x8 /* decompress PPP protocol */
-
-#define COMP_VJC 0x10 /* compress TCP/IP headers */
-#define COMP_VJCCID 0x20 /* compress connection ID as well */
-#define DECOMP_VJC 0x40 /* decompress TCP/IP headers */
-#define DECOMP_VJCCID 0x80 /* accept compressed connection ID */
-
-#define CCP_ISOPEN 0x100 /* look at CCP packets */
-#define CCP_ISUP 0x200 /* do packet comp/decomp */
-#define CCP_ERROR 0x400 /* (status) error in packet decomp */
-#define CCP_FATALERROR 0x800 /* (status) fatal error ditto */
-#define CCP_COMP_RUN 0x1000 /* (status) seen CCP ack sent */
-#define CCP_DECOMP_RUN 0x2000 /* (status) seen CCP ack rcvd */
-
-/*
- * Values for 8-bit-clean flags.
- */
-#define RCV_B7_0 1 /* have rcvd char with bit 7 = 0 */
-#define RCV_B7_1 2 /* have rcvd char with bit 7 = 1 */
-#define RCV_EVNP 4 /* have rcvd char with even parity */
-#define RCV_ODDP 8 /* have rcvd char with odd parity */
-
-/*
- * Values for the first byte of M_CTL messages passed between
- * PPP modules.
- */
-#define PPPCTL_OERROR 0xe0 /* output error [up] */
-#define PPPCTL_IERROR 0xe1 /* input error (e.g. FCS) [up] */
-#define PPPCTL_MTU 0xe2 /* set MTU [down] */
-#define PPPCTL_MRU 0xe3 /* set MRU [down] */
-#define PPPCTL_UNIT 0xe4 /* note PPP unit number [down] */
-
-/*
- * Values for the integer argument to PPPIO_DEBUG.
- */
-#define PPPDBG_DUMP 0x10000 /* print out debug info now */
-#define PPPDBG_LOG 0x100 /* log various things */
-#define PPPDBG_DRIVER 0 /* identifies ppp driver as target */
-#define PPPDBG_IF 1 /* identifies ppp network i/f target */
-#define PPPDBG_COMP 2 /* identifies ppp compression target */
-#define PPPDBG_AHDLC 3 /* identifies ppp async hdlc target */
diff --git a/mdk-stage1/ppp/include/net/slcompress.h b/mdk-stage1/ppp/include/net/slcompress.h
deleted file mode 100644
index 9e19bc0ed..000000000
--- a/mdk-stage1/ppp/include/net/slcompress.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Definitions for tcp compression routines.
- *
- * $Id$
- *
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
- * - Initial distribution.
- */
-
-#ifndef _SLCOMPRESS_H_
-#define _SLCOMPRESS_H_
-
-#define MAX_STATES 16 /* must be > 2 and < 256 */
-#define MAX_HDR MLEN /* XXX 4bsd-ism: should really be 128 */
-
-/*
- * Compressed packet format:
- *
- * The first octet contains the packet type (top 3 bits), TCP
- * 'push' bit, and flags that indicate which of the 4 TCP sequence
- * numbers have changed (bottom 5 bits). The next octet is a
- * conversation number that associates a saved IP/TCP header with
- * the compressed packet. The next two octets are the TCP checksum
- * from the original datagram. The next 0 to 15 octets are
- * sequence number changes, one change per bit set in the header
- * (there may be no changes and there are two special cases where
- * the receiver implicitly knows what changed -- see below).
- *
- * There are 5 numbers which can change (they are always inserted
- * in the following order): TCP urgent pointer, window,
- * acknowlegement, sequence number and IP ID. (The urgent pointer
- * is different from the others in that its value is sent, not the
- * change in value.) Since typical use of SLIP links is biased
- * toward small packets (see comments on MTU/MSS below), changes
- * use a variable length coding with one octet for numbers in the
- * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the
- * range 256 - 65535 or 0. (If the change in sequence number or
- * ack is more than 65535, an uncompressed packet is sent.)
- */
-
-/*
- * Packet types (must not conflict with IP protocol version)
- *
- * The top nibble of the first octet is the packet type. There are
- * three possible types: IP (not proto TCP or tcp with one of the
- * control flags set); uncompressed TCP (a normal IP/TCP packet but
- * with the 8-bit protocol field replaced by an 8-bit connection id --
- * this type of packet syncs the sender & receiver); and compressed
- * TCP (described above).
- *
- * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and
- * is logically part of the 4-bit "changes" field that follows. Top
- * three bits are actual packet type. For backward compatibility
- * and in the interest of conserving bits, numbers are chosen so the
- * IP protocol version number (4) which normally appears in this nibble
- * means "IP packet".
- */
-
-/* packet types */
-#define TYPE_IP 0x40
-#define TYPE_UNCOMPRESSED_TCP 0x70
-#define TYPE_COMPRESSED_TCP 0x80
-#define TYPE_ERROR 0x00
-
-/* Bits in first octet of compressed packet */
-#define NEW_C 0x40 /* flag bits for what changed in a packet */
-#define NEW_I 0x20
-#define NEW_S 0x08
-#define NEW_A 0x04
-#define NEW_W 0x02
-#define NEW_U 0x01
-
-/* reserved, special-case values of above */
-#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */
-#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */
-#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
-
-#define TCP_PUSH_BIT 0x10
-
-
-/*
- * "state" data for each active tcp conversation on the wire. This is
- * basically a copy of the entire IP/TCP header from the last packet
- * we saw from the conversation together with a small identifier
- * the transmit & receive ends of the line use to locate saved header.
- */
-struct cstate {
- struct cstate *cs_next; /* next most recently used cstate (xmit only) */
- u_short cs_hlen; /* size of hdr (receive only) */
- u_char cs_id; /* connection # associated with this state */
- u_char cs_filler;
- union {
- char csu_hdr[MAX_HDR];
- struct ip csu_ip; /* ip/tcp hdr from most recent packet */
- } slcs_u;
-};
-#define cs_ip slcs_u.csu_ip
-#define cs_hdr slcs_u.csu_hdr
-
-/*
- * all the state data for one serial line (we need one of these
- * per line).
- */
-struct slcompress {
- struct cstate *last_cs; /* most recently used tstate */
- u_char last_recv; /* last rcvd conn. id */
- u_char last_xmit; /* last sent conn. id */
- u_short flags;
-#ifndef SL_NO_STATS
- int sls_packets; /* outbound packets */
- int sls_compressed; /* outbound compressed packets */
- int sls_searches; /* searches for connection state */
- int sls_misses; /* times couldn't find conn. state */
- int sls_uncompressedin; /* inbound uncompressed packets */
- int sls_compressedin; /* inbound compressed packets */
- int sls_errorin; /* inbound unknown type packets */
- int sls_tossed; /* inbound packets tossed because of error */
-#endif
- struct cstate tstate[MAX_STATES]; /* xmit connection states */
- struct cstate rstate[MAX_STATES]; /* receive connection states */
-};
-/* flag values */
-#define SLF_TOSS 1 /* tossing rcvd frames because of input err */
-
-void sl_compress_init __P((struct slcompress *));
-void sl_compress_setup __P((struct slcompress *, int));
-u_int sl_compress_tcp __P((struct mbuf *,
- struct ip *, struct slcompress *, int));
-int sl_uncompress_tcp __P((u_char **, int, u_int, struct slcompress *));
-int sl_uncompress_tcp_core __P((u_char *, int, int, u_int,
- struct slcompress *, u_char **, u_int *));
-
-#endif /* _SLCOMPRESS_H_ */
diff --git a/mdk-stage1/ppp/include/net/vjcompress.h b/mdk-stage1/ppp/include/net/vjcompress.h
deleted file mode 100644
index c64596926..000000000
--- a/mdk-stage1/ppp/include/net/vjcompress.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Definitions for tcp compression routines.
- *
- * $Id$
- *
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
- * - Initial distribution.
- */
-
-#ifndef _VJCOMPRESS_H_
-#define _VJCOMPRESS_H_
-
-#define MAX_STATES 16 /* must be > 2 and < 256 */
-#define MAX_HDR 128
-
-/*
- * Compressed packet format:
- *
- * The first octet contains the packet type (top 3 bits), TCP
- * 'push' bit, and flags that indicate which of the 4 TCP sequence
- * numbers have changed (bottom 5 bits). The next octet is a
- * conversation number that associates a saved IP/TCP header with
- * the compressed packet. The next two octets are the TCP checksum
- * from the original datagram. The next 0 to 15 octets are
- * sequence number changes, one change per bit set in the header
- * (there may be no changes and there are two special cases where
- * the receiver implicitly knows what changed -- see below).
- *
- * There are 5 numbers which can change (they are always inserted
- * in the following order): TCP urgent pointer, window,
- * acknowlegement, sequence number and IP ID. (The urgent pointer
- * is different from the others in that its value is sent, not the
- * change in value.) Since typical use of SLIP links is biased
- * toward small packets (see comments on MTU/MSS below), changes
- * use a variable length coding with one octet for numbers in the
- * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the
- * range 256 - 65535 or 0. (If the change in sequence number or
- * ack is more than 65535, an uncompressed packet is sent.)
- */
-
-/*
- * Packet types (must not conflict with IP protocol version)
- *
- * The top nibble of the first octet is the packet type. There are
- * three possible types: IP (not proto TCP or tcp with one of the
- * control flags set); uncompressed TCP (a normal IP/TCP packet but
- * with the 8-bit protocol field replaced by an 8-bit connection id --
- * this type of packet syncs the sender & receiver); and compressed
- * TCP (described above).
- *
- * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and
- * is logically part of the 4-bit "changes" field that follows. Top
- * three bits are actual packet type. For backward compatibility
- * and in the interest of conserving bits, numbers are chosen so the
- * IP protocol version number (4) which normally appears in this nibble
- * means "IP packet".
- */
-
-/* packet types */
-#define TYPE_IP 0x40
-#define TYPE_UNCOMPRESSED_TCP 0x70
-#define TYPE_COMPRESSED_TCP 0x80
-#define TYPE_ERROR 0x00
-
-/* Bits in first octet of compressed packet */
-#define NEW_C 0x40 /* flag bits for what changed in a packet */
-#define NEW_I 0x20
-#define NEW_S 0x08
-#define NEW_A 0x04
-#define NEW_W 0x02
-#define NEW_U 0x01
-
-/* reserved, special-case values of above */
-#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */
-#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */
-#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
-
-#define TCP_PUSH_BIT 0x10
-
-
-/*
- * "state" data for each active tcp conversation on the wire. This is
- * basically a copy of the entire IP/TCP header from the last packet
- * we saw from the conversation together with a small identifier
- * the transmit & receive ends of the line use to locate saved header.
- */
-struct cstate {
- struct cstate *cs_next; /* next most recently used state (xmit only) */
- u_short cs_hlen; /* size of hdr (receive only) */
- u_char cs_id; /* connection # associated with this state */
- u_char cs_filler;
- union {
- char csu_hdr[MAX_HDR];
- struct ip csu_ip; /* ip/tcp hdr from most recent packet */
- } vjcs_u;
-};
-#define cs_ip vjcs_u.csu_ip
-#define cs_hdr vjcs_u.csu_hdr
-
-/*
- * all the state data for one serial line (we need one of these per line).
- */
-struct vjcompress {
- struct cstate *last_cs; /* most recently used tstate */
- u_char last_recv; /* last rcvd conn. id */
- u_char last_xmit; /* last sent conn. id */
- u_short flags;
-#ifndef VJ_NO_STATS
- struct vjstat stats;
-#endif
- struct cstate tstate[MAX_STATES]; /* xmit connection states */
- struct cstate rstate[MAX_STATES]; /* receive connection states */
-};
-
-/* flag values */
-#define VJF_TOSS 1 /* tossing rcvd frames because of input err */
-
-extern void vj_compress_init __P((struct vjcompress *comp, int max_state));
-extern u_int vj_compress_tcp __P((struct ip *ip, u_int mlen,
- struct vjcompress *comp, int compress_cid_flag,
- u_char **vjhdrp));
-extern void vj_uncompress_err __P((struct vjcompress *comp));
-extern int vj_uncompress_uncomp __P((u_char *buf, int buflen,
- struct vjcompress *comp));
-extern int vj_uncompress_tcp __P((u_char *buf, int buflen, int total_len,
- struct vjcompress *comp, u_char **hdrp,
- u_int *hlenp));
-
-#endif /* _VJCOMPRESS_H_ */
diff --git a/mdk-stage1/ppp/include/pcap-int.h b/mdk-stage1/ppp/include/pcap-int.h
deleted file mode 100644
index 323994929..000000000
--- a/mdk-stage1/ppp/include/pcap-int.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1994, 1995, 1996
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Computer Systems
- * Engineering Group at Lawrence Berkeley Laboratory.
- * 4. Neither the name of the University nor of the Laboratory may be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#) $Header$ (LBL)
- */
-
-#ifndef pcap_int_h
-#define pcap_int_h
-
-#include <pcap.h>
-
-/*
- * Savefile
- */
-struct pcap_sf {
- FILE *rfile;
- int swapped;
- int version_major;
- int version_minor;
- u_char *base;
-};
-
-struct pcap_md {
- struct pcap_stat stat;
- /*XXX*/
- int use_bpf;
- u_long TotPkts; /* can't oflow for 79 hrs on ether */
- u_long TotAccepted; /* count accepted by filter */
- u_long TotDrops; /* count of dropped packets */
- long TotMissed; /* missed by i/f during this run */
- long OrigMissed; /* missed by i/f before this run */
-#ifdef linux
- int pad;
- int skip;
- char *device;
-#endif
-};
-
-struct pcap {
- int fd;
- int snapshot;
- int linktype;
- int tzoff; /* timezone offset */
- int offset; /* offset for proper alignment */
-
- struct pcap_sf sf;
- struct pcap_md md;
-
- /*
- * Read buffer.
- */
- int bufsize;
- u_char *buffer;
- u_char *bp;
- int cc;
-
- /*
- * Place holder for pcap_next().
- */
- u_char *pkt;
-
-
- /*
- * Placeholder for filter code if bpf not in kernel.
- */
- struct bpf_program fcode;
-
- char errbuf[PCAP_ERRBUF_SIZE];
-};
-
-int yylex(void);
-
-#ifndef min
-#define min(a, b) ((a) > (b) ? (b) : (a))
-#endif
-
-/* XXX should these be in pcap.h? */
-int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *);
-int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *);
-
-/* Ultrix pads to make everything line up on a nice boundary */
-#if defined(ultrix) || defined(__alpha)
-#define PCAP_FDDIPAD 3
-#endif
-
-/* XXX */
-extern int pcap_fddipad;
-#endif
diff --git a/mdk-stage1/ppp/linux/Makefile.top b/mdk-stage1/ppp/linux/Makefile.top
deleted file mode 100644
index fa34ce59f..000000000
--- a/mdk-stage1/ppp/linux/Makefile.top
+++ /dev/null
@@ -1,55 +0,0 @@
-# PPP top-level Makefile for Linux.
-
-
-BINDIR = $(DESTDIR)/usr/sbin
-MANDIR = $(DESTDIR)/usr/man
-ETCDIR = $(DESTDIR)/etc/ppp
-
-# uid 0 = root
-INSTALL= install
-
-all:
- cd chat; $(MAKE) $(MFLAGS) all
- cd pppd; $(MAKE) $(MFLAGS) all
- cd pppstats; $(MAKE) $(MFLAGS) all
- cd pppdump; $(MAKE) $(MFLAGS) all
-
-install: $(BINDIR) $(MANDIR)/man8 install-progs install-etcppp
-
-install-progs:
- cd chat; $(MAKE) BINDIR=$(BINDIR) MANDIR=$(MANDIR) $(MFLAGS) install
- cd pppd; $(MAKE) BINDIR=$(BINDIR) MANDIR=$(MANDIR) $(MFLAGS) install
- cd pppstats; $(MAKE) BINDIR=$(BINDIR) MANDIR=$(MANDIR) $(MFLAGS) install
- cd pppdump; $(MAKE) BINDIR=$(BINDIR) MANDIR=$(MANDIR) $(MFLAGS) install
-
-install-etcppp: $(ETCDIR) $(ETCDIR)/options $(ETCDIR)/pap-secrets \
- $(ETCDIR)/chap-secrets
-
-$(ETCDIR)/options:
- $(INSTALL) -c -m 644 etc.ppp/options $@
-$(ETCDIR)/pap-secrets:
- $(INSTALL) -c -m 600 etc.ppp/pap-secrets $@
-$(ETCDIR)/chap-secrets:
- $(INSTALL) -c -m 600 etc.ppp/chap-secrets $@
-
-$(BINDIR):
- $(INSTALL) -d -m 755 $@
-$(MANDIR)/man8:
- $(INSTALL) -d -m 755 $@
-$(ETCDIR):
- $(INSTALL) -d -m 755 $@
-
-clean:
- rm -f `find . -name '*.[oas]' -print`
- rm -f `find . -name 'core' -print`
- rm -f `find . -name '*~' -print`
- cd chat; $(MAKE) clean
- cd pppd; $(MAKE) clean
- cd pppstats; $(MAKE) clean
- cd pppdump; $(MAKE) clean
-
-dist-clean: clean
- rm -f Makefile `find . -name Makefile -print`
-
-#kernel:
-# cd linux; ./kinstall.sh
diff --git a/mdk-stage1/ppp/modules/bsd-comp.c b/mdk-stage1/ppp/modules/bsd-comp.c
deleted file mode 100644
index b1b9325c7..000000000
--- a/mdk-stage1/ppp/modules/bsd-comp.c
+++ /dev/null
@@ -1,1116 +0,0 @@
-/* Because this code is derived from the 4.3BSD compress source:
- *
- *
- * Copyright (c) 1985, 1986 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * James A. Woods, derived from original work by Spencer Thomas
- * and Joseph Orost.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * This version is for use with STREAMS under SunOS 4.x,
- * Digital UNIX, AIX 4.x, and SVR4 systems including Solaris 2.
- *
- * $Id$
- */
-
-#ifdef AIX4
-#include <net/net_globals.h>
-#endif
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <net/ppp_defs.h>
-#include "ppp_mod.h"
-
-#ifdef SVR4
-#include <sys/byteorder.h>
-#ifndef _BIG_ENDIAN
-#define BSD_LITTLE_ENDIAN
-#endif
-#endif
-
-#ifdef __osf__
-#undef FIRST
-#undef LAST
-#define BSD_LITTLE_ENDIAN
-#endif
-
-#define PACKETPTR mblk_t *
-#include <net/ppp-comp.h>
-
-#if DO_BSD_COMPRESS
-
-/*
- * PPP "BSD compress" compression
- * The differences between this compression and the classic BSD LZW
- * source are obvious from the requirement that the classic code worked
- * with files while this handles arbitrarily long streams that
- * are broken into packets. They are:
- *
- * When the code size expands, a block of junk is not emitted by
- * the compressor and not expected by the decompressor.
- *
- * New codes are not necessarily assigned every time an old
- * code is output by the compressor. This is because a packet
- * end forces a code to be emitted, but does not imply that a
- * new sequence has been seen.
- *
- * The compression ratio is checked at the first end of a packet
- * after the appropriate gap. Besides simplifying and speeding
- * things up, this makes it more likely that the transmitter
- * and receiver will agree when the dictionary is cleared when
- * compression is not going well.
- */
-
-/*
- * A dictionary for doing BSD compress.
- */
-struct bsd_db {
- int totlen; /* length of this structure */
- u_int hsize; /* size of the hash table */
- u_char hshift; /* used in hash function */
- u_char n_bits; /* current bits/code */
- u_char maxbits;
- u_char debug;
- u_char unit;
- u_short seqno; /* sequence number of next packet */
- u_int hdrlen; /* header length to preallocate */
- u_int mru;
- u_int maxmaxcode; /* largest valid code */
- u_int max_ent; /* largest code in use */
- u_int in_count; /* uncompressed bytes, aged */
- u_int bytes_out; /* compressed bytes, aged */
- u_int ratio; /* recent compression ratio */
- u_int checkpoint; /* when to next check the ratio */
- u_int clear_count; /* times dictionary cleared */
- u_int incomp_count; /* incompressible packets */
- u_int incomp_bytes; /* incompressible bytes */
- u_int uncomp_count; /* uncompressed packets */
- u_int uncomp_bytes; /* uncompressed bytes */
- u_int comp_count; /* compressed packets */
- u_int comp_bytes; /* compressed bytes */
- u_short *lens; /* array of lengths of codes */
- struct bsd_dict {
- union { /* hash value */
- u_int32_t fcode;
- struct {
-#ifdef BSD_LITTLE_ENDIAN
- u_short prefix; /* preceding code */
- u_char suffix; /* last character of new code */
- u_char pad;
-#else
- u_char pad;
- u_char suffix; /* last character of new code */
- u_short prefix; /* preceding code */
-#endif
- } hs;
- } f;
- u_short codem1; /* output of hash table -1 */
- u_short cptr; /* map code to hash table entry */
- } dict[1];
-};
-
-#define BSD_OVHD 2 /* BSD compress overhead/packet */
-#define BSD_INIT_BITS BSD_MIN_BITS
-
-static void *bsd_comp_alloc __P((u_char *options, int opt_len));
-static void *bsd_decomp_alloc __P((u_char *options, int opt_len));
-static void bsd_free __P((void *state));
-static int bsd_comp_init __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int debug));
-static int bsd_decomp_init __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int mru, int debug));
-static int bsd_compress __P((void *state, mblk_t **mret,
- mblk_t *mp, int slen, int maxolen));
-static void bsd_incomp __P((void *state, mblk_t *dmsg));
-static int bsd_decompress __P((void *state, mblk_t *cmp, mblk_t **dmpp));
-static void bsd_reset __P((void *state));
-static void bsd_comp_stats __P((void *state, struct compstat *stats));
-
-/*
- * Procedures exported to ppp_comp.c.
- */
-struct compressor ppp_bsd_compress = {
- CI_BSD_COMPRESS, /* compress_proto */
- bsd_comp_alloc, /* comp_alloc */
- bsd_free, /* comp_free */
- bsd_comp_init, /* comp_init */
- bsd_reset, /* comp_reset */
- bsd_compress, /* compress */
- bsd_comp_stats, /* comp_stat */
- bsd_decomp_alloc, /* decomp_alloc */
- bsd_free, /* decomp_free */
- bsd_decomp_init, /* decomp_init */
- bsd_reset, /* decomp_reset */
- bsd_decompress, /* decompress */
- bsd_incomp, /* incomp */
- bsd_comp_stats, /* decomp_stat */
-};
-
-/*
- * the next two codes should not be changed lightly, as they must not
- * lie within the contiguous general code space.
- */
-#define CLEAR 256 /* table clear output code */
-#define FIRST 257 /* first free entry */
-#define LAST 255
-
-#define MAXCODE(b) ((1 << (b)) - 1)
-#define BADCODEM1 MAXCODE(BSD_MAX_BITS)
-
-#define BSD_HASH(prefix,suffix,hshift) ((((u_int32_t)(suffix)) << (hshift)) \
- ^ (u_int32_t)(prefix))
-#define BSD_KEY(prefix,suffix) ((((u_int32_t)(suffix)) << 16) \
- + (u_int32_t)(prefix))
-
-#define CHECK_GAP 10000 /* Ratio check interval */
-
-#define RATIO_SCALE_LOG 8
-#define RATIO_SCALE (1<<RATIO_SCALE_LOG)
-#define RATIO_MAX (0x7fffffff>>RATIO_SCALE_LOG)
-
-#define DECOMP_CHUNK 256
-
-/*
- * clear the dictionary
- */
-static void
-bsd_clear(db)
- struct bsd_db *db;
-{
- db->clear_count++;
- db->max_ent = FIRST-1;
- db->n_bits = BSD_INIT_BITS;
- db->ratio = 0;
- db->bytes_out = 0;
- db->in_count = 0;
- db->checkpoint = CHECK_GAP;
-}
-
-/*
- * If the dictionary is full, then see if it is time to reset it.
- *
- * Compute the compression ratio using fixed-point arithmetic
- * with 8 fractional bits.
- *
- * Since we have an infinite stream instead of a single file,
- * watch only the local compression ratio.
- *
- * Since both peers must reset the dictionary at the same time even in
- * the absence of CLEAR codes (while packets are incompressible), they
- * must compute the same ratio.
- */
-static int /* 1=output CLEAR */
-bsd_check(db)
- struct bsd_db *db;
-{
- u_int new_ratio;
-
- if (db->in_count >= db->checkpoint) {
- /* age the ratio by limiting the size of the counts */
- if (db->in_count >= RATIO_MAX
- || db->bytes_out >= RATIO_MAX) {
- db->in_count -= db->in_count/4;
- db->bytes_out -= db->bytes_out/4;
- }
-
- db->checkpoint = db->in_count + CHECK_GAP;
-
- if (db->max_ent >= db->maxmaxcode) {
- /* Reset the dictionary only if the ratio is worse,
- * or if it looks as if it has been poisoned
- * by incompressible data.
- *
- * This does not overflow, because
- * db->in_count <= RATIO_MAX.
- */
- new_ratio = db->in_count << RATIO_SCALE_LOG;
- if (db->bytes_out != 0)
- new_ratio /= db->bytes_out;
-
- if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE) {
- bsd_clear(db);
- return 1;
- }
- db->ratio = new_ratio;
- }
- }
- return 0;
-}
-
-/*
- * Return statistics.
- */
-static void
-bsd_comp_stats(state, stats)
- void *state;
- struct compstat *stats;
-{
- struct bsd_db *db = (struct bsd_db *) state;
- u_int out;
-
- stats->unc_bytes = db->uncomp_bytes;
- stats->unc_packets = db->uncomp_count;
- stats->comp_bytes = db->comp_bytes;
- stats->comp_packets = db->comp_count;
- stats->inc_bytes = db->incomp_bytes;
- stats->inc_packets = db->incomp_count;
- stats->ratio = db->in_count;
- out = db->bytes_out;
- if (stats->ratio <= 0x7fffff)
- stats->ratio <<= 8;
- else
- out >>= 8;
- if (out != 0)
- stats->ratio /= out;
-}
-
-/*
- * Reset state, as on a CCP ResetReq.
- */
-static void
-bsd_reset(state)
- void *state;
-{
- struct bsd_db *db = (struct bsd_db *) state;
-
- db->seqno = 0;
- bsd_clear(db);
- db->clear_count = 0;
-}
-
-/*
- * Allocate space for a (de) compressor.
- */
-static void *
-bsd_alloc(options, opt_len, decomp)
- u_char *options;
- int opt_len, decomp;
-{
- int bits;
- u_int newlen, hsize, hshift, maxmaxcode;
- struct bsd_db *db;
-
- if (opt_len != 3 || options[0] != CI_BSD_COMPRESS || options[1] != 3
- || BSD_VERSION(options[2]) != BSD_CURRENT_VERSION)
- return NULL;
-
- bits = BSD_NBITS(options[2]);
- switch (bits) {
- case 9: /* needs 82152 for both directions */
- case 10: /* needs 84144 */
- case 11: /* needs 88240 */
- case 12: /* needs 96432 */
- hsize = 5003;
- hshift = 4;
- break;
- case 13: /* needs 176784 */
- hsize = 9001;
- hshift = 5;
- break;
- case 14: /* needs 353744 */
- hsize = 18013;
- hshift = 6;
- break;
- case 15: /* needs 691440 */
- hsize = 35023;
- hshift = 7;
- break;
- case 16: /* needs 1366160--far too much, */
- /* hsize = 69001; */ /* and 69001 is too big for cptr */
- /* hshift = 8; */ /* in struct bsd_db */
- /* break; */
- default:
- return NULL;
- }
-
- maxmaxcode = MAXCODE(bits);
- newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0]));
-#ifdef __osf__
- db = (struct bsd_db *) ALLOC_SLEEP(newlen);
-#else
- db = (struct bsd_db *) ALLOC_NOSLEEP(newlen);
-#endif
- if (!db)
- return NULL;
- bzero(db, sizeof(*db) - sizeof(db->dict));
-
- if (!decomp) {
- db->lens = NULL;
- } else {
-#ifdef __osf__
- db->lens = (u_short *) ALLOC_SLEEP((maxmaxcode+1) * sizeof(db->lens[0]));
-#else
- db->lens = (u_short *) ALLOC_NOSLEEP((maxmaxcode+1) * sizeof(db->lens[0]));
-#endif
- if (!db->lens) {
- FREE(db, newlen);
- return NULL;
- }
- }
-
- db->totlen = newlen;
- db->hsize = hsize;
- db->hshift = hshift;
- db->maxmaxcode = maxmaxcode;
- db->maxbits = bits;
-
- return (void *) db;
-}
-
-static void
-bsd_free(state)
- void *state;
-{
- struct bsd_db *db = (struct bsd_db *) state;
-
- if (db->lens)
- FREE(db->lens, (db->maxmaxcode+1) * sizeof(db->lens[0]));
- FREE(db, db->totlen);
-}
-
-static void *
-bsd_comp_alloc(options, opt_len)
- u_char *options;
- int opt_len;
-{
- return bsd_alloc(options, opt_len, 0);
-}
-
-static void *
-bsd_decomp_alloc(options, opt_len)
- u_char *options;
- int opt_len;
-{
- return bsd_alloc(options, opt_len, 1);
-}
-
-/*
- * Initialize the database.
- */
-static int
-bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp)
- struct bsd_db *db;
- u_char *options;
- int opt_len, unit, hdrlen, mru, debug, decomp;
-{
- int i;
-
- if (opt_len < CILEN_BSD_COMPRESS
- || options[0] != CI_BSD_COMPRESS || options[1] != CILEN_BSD_COMPRESS
- || BSD_VERSION(options[2]) != BSD_CURRENT_VERSION
- || BSD_NBITS(options[2]) != db->maxbits
- || decomp && db->lens == NULL)
- return 0;
-
- if (decomp) {
- i = LAST+1;
- while (i != 0)
- db->lens[--i] = 1;
- }
- i = db->hsize;
- while (i != 0) {
- db->dict[--i].codem1 = BADCODEM1;
- db->dict[i].cptr = 0;
- }
-
- db->unit = unit;
- db->hdrlen = hdrlen;
- db->mru = mru;
- if (debug)
- db->debug = 1;
-
- bsd_reset(db);
-
- return 1;
-}
-
-static int
-bsd_comp_init(state, options, opt_len, unit, hdrlen, debug)
- void *state;
- u_char *options;
- int opt_len, unit, hdrlen, debug;
-{
- return bsd_init((struct bsd_db *) state, options, opt_len,
- unit, hdrlen, 0, debug, 0);
-}
-
-static int
-bsd_decomp_init(state, options, opt_len, unit, hdrlen, mru, debug)
- void *state;
- u_char *options;
- int opt_len, unit, hdrlen, mru, debug;
-{
- return bsd_init((struct bsd_db *) state, options, opt_len,
- unit, hdrlen, mru, debug, 1);
-}
-
-
-/*
- * compress a packet
- * One change from the BSD compress command is that when the
- * code size expands, we do not output a bunch of padding.
- *
- * N.B. at present, we ignore the hdrlen specified in the comp_init call.
- */
-static int /* new slen */
-bsd_compress(state, mretp, mp, slen, maxolen)
- void *state;
- mblk_t **mretp; /* return compressed mbuf chain here */
- mblk_t *mp; /* from here */
- int slen; /* uncompressed length */
- int maxolen; /* max compressed length */
-{
- struct bsd_db *db = (struct bsd_db *) state;
- int hshift = db->hshift;
- u_int max_ent = db->max_ent;
- u_int n_bits = db->n_bits;
- u_int bitno = 32;
- u_int32_t accm = 0, fcode;
- struct bsd_dict *dictp;
- u_char c;
- int hval, disp, ent, ilen;
- mblk_t *np, *mret;
- u_char *rptr, *wptr;
- u_char *cp_end;
- int olen;
- mblk_t *m, **mnp;
-
-#define PUTBYTE(v) { \
- if (wptr) { \
- *wptr++ = (v); \
- if (wptr >= cp_end) { \
- m->b_wptr = wptr; \
- m = m->b_cont; \
- if (m) { \
- wptr = m->b_wptr; \
- cp_end = m->b_datap->db_lim; \
- } else \
- wptr = NULL; \
- } \
- } \
- ++olen; \
-}
-
-#define OUTPUT(ent) { \
- bitno -= n_bits; \
- accm |= ((ent) << bitno); \
- do { \
- PUTBYTE(accm >> 24); \
- accm <<= 8; \
- bitno += 8; \
- } while (bitno <= 24); \
-}
-
- /*
- * First get the protocol and check that we're
- * interested in this packet.
- */
- *mretp = NULL;
- rptr = mp->b_rptr;
- if (rptr + PPP_HDRLEN > mp->b_wptr) {
- if (!pullupmsg(mp, PPP_HDRLEN))
- return 0;
- rptr = mp->b_rptr;
- }
- ent = PPP_PROTOCOL(rptr); /* get the protocol */
- if (ent < 0x21 || ent > 0xf9)
- return 0;
-
- /* Don't generate compressed packets which are larger than
- the uncompressed packet. */
- if (maxolen > slen)
- maxolen = slen;
-
- /* Allocate enough message blocks to give maxolen total space. */
- mnp = &mret;
- for (olen = maxolen; olen > 0; ) {
- m = allocb((olen < 4096? olen: 4096), BPRI_MED);
- *mnp = m;
- if (m == NULL) {
- if (mret != NULL) {
- freemsg(mret);
- mnp = &mret;
- }
- break;
- }
- mnp = &m->b_cont;
- olen -= m->b_datap->db_lim - m->b_wptr;
- }
- *mnp = NULL;
-
- if ((m = mret) != NULL) {
- wptr = m->b_wptr;
- cp_end = m->b_datap->db_lim;
- } else
- wptr = cp_end = NULL;
- olen = 0;
-
- /*
- * Copy the PPP header over, changing the protocol,
- * and install the 2-byte sequence number.
- */
- if (wptr) {
- wptr[0] = PPP_ADDRESS(rptr);
- wptr[1] = PPP_CONTROL(rptr);
- wptr[2] = 0; /* change the protocol */
- wptr[3] = PPP_COMP;
- wptr[4] = db->seqno >> 8;
- wptr[5] = db->seqno;
- wptr += PPP_HDRLEN + BSD_OVHD;
- }
- ++db->seqno;
- rptr += PPP_HDRLEN;
-
- slen = mp->b_wptr - rptr;
- ilen = slen + 1;
- np = mp->b_cont;
- for (;;) {
- if (slen <= 0) {
- if (!np)
- break;
- rptr = np->b_rptr;
- slen = np->b_wptr - rptr;
- np = np->b_cont;
- if (!slen)
- continue; /* handle 0-length buffers */
- ilen += slen;
- }
-
- slen--;
- c = *rptr++;
- fcode = BSD_KEY(ent, c);
- hval = BSD_HASH(ent, c, hshift);
- dictp = &db->dict[hval];
-
- /* Validate and then check the entry. */
- if (dictp->codem1 >= max_ent)
- goto nomatch;
- if (dictp->f.fcode == fcode) {
- ent = dictp->codem1+1;
- continue; /* found (prefix,suffix) */
- }
-
- /* continue probing until a match or invalid entry */
- disp = (hval == 0) ? 1 : hval;
- do {
- hval += disp;
- if (hval >= db->hsize)
- hval -= db->hsize;
- dictp = &db->dict[hval];
- if (dictp->codem1 >= max_ent)
- goto nomatch;
- } while (dictp->f.fcode != fcode);
- ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */
- continue;
-
- nomatch:
- OUTPUT(ent); /* output the prefix */
-
- /* code -> hashtable */
- if (max_ent < db->maxmaxcode) {
- struct bsd_dict *dictp2;
- /* expand code size if needed */
- if (max_ent >= MAXCODE(n_bits))
- db->n_bits = ++n_bits;
-
- /* Invalidate old hash table entry using
- * this code, and then take it over.
- */
- dictp2 = &db->dict[max_ent+1];
- if (db->dict[dictp2->cptr].codem1 == max_ent)
- db->dict[dictp2->cptr].codem1 = BADCODEM1;
- dictp2->cptr = hval;
- dictp->codem1 = max_ent;
- dictp->f.fcode = fcode;
-
- db->max_ent = ++max_ent;
- }
- ent = c;
- }
-
- OUTPUT(ent); /* output the last code */
- db->bytes_out += olen;
- db->in_count += ilen;
- if (bitno < 32)
- ++db->bytes_out; /* count complete bytes */
-
- if (bsd_check(db))
- OUTPUT(CLEAR); /* do not count the CLEAR */
-
- /*
- * Pad dribble bits of last code with ones.
- * Do not emit a completely useless byte of ones.
- */
- if (bitno != 32)
- PUTBYTE((accm | (0xff << (bitno-8))) >> 24);
-
- /*
- * Increase code size if we would have without the packet
- * boundary and as the decompressor will.
- */
- if (max_ent >= MAXCODE(n_bits) && max_ent < db->maxmaxcode)
- db->n_bits++;
-
- db->uncomp_bytes += ilen;
- ++db->uncomp_count;
- if (olen + PPP_HDRLEN + BSD_OVHD > maxolen && mret != NULL) {
- /* throw away the compressed stuff if it is longer than uncompressed */
- freemsg(mret);
- mret = NULL;
- ++db->incomp_count;
- db->incomp_bytes += ilen;
- } else if (wptr != NULL) {
- m->b_wptr = wptr;
- if (m->b_cont) {
- freemsg(m->b_cont);
- m->b_cont = NULL;
- }
- ++db->comp_count;
- db->comp_bytes += olen + BSD_OVHD;
- }
-
- *mretp = mret;
- return olen + PPP_HDRLEN + BSD_OVHD;
-#undef OUTPUT
-#undef PUTBYTE
-}
-
-
-/*
- * Update the "BSD Compress" dictionary on the receiver for
- * incompressible data by pretending to compress the incoming data.
- */
-static void
-bsd_incomp(state, dmsg)
- void *state;
- mblk_t *dmsg;
-{
- struct bsd_db *db = (struct bsd_db *) state;
- u_int hshift = db->hshift;
- u_int max_ent = db->max_ent;
- u_int n_bits = db->n_bits;
- struct bsd_dict *dictp;
- u_int32_t fcode;
- u_char c;
- long hval, disp;
- int slen, ilen;
- u_int bitno = 7;
- u_char *rptr;
- u_int ent;
-
- rptr = dmsg->b_rptr;
- if (rptr + PPP_HDRLEN > dmsg->b_wptr) {
- if (!pullupmsg(dmsg, PPP_HDRLEN))
- return;
- rptr = dmsg->b_rptr;
- }
- ent = PPP_PROTOCOL(rptr); /* get the protocol */
- if (ent < 0x21 || ent > 0xf9)
- return;
-
- db->seqno++;
- ilen = 1; /* count the protocol as 1 byte */
- rptr += PPP_HDRLEN;
- for (;;) {
- slen = dmsg->b_wptr - rptr;
- if (slen <= 0) {
- dmsg = dmsg->b_cont;
- if (!dmsg)
- break;
- rptr = dmsg->b_rptr;
- continue; /* skip zero-length buffers */
- }
- ilen += slen;
-
- do {
- c = *rptr++;
- fcode = BSD_KEY(ent, c);
- hval = BSD_HASH(ent, c, hshift);
- dictp = &db->dict[hval];
-
- /* validate and then check the entry */
- if (dictp->codem1 >= max_ent)
- goto nomatch;
- if (dictp->f.fcode == fcode) {
- ent = dictp->codem1+1;
- continue; /* found (prefix,suffix) */
- }
-
- /* continue probing until a match or invalid entry */
- disp = (hval == 0) ? 1 : hval;
- do {
- hval += disp;
- if (hval >= db->hsize)
- hval -= db->hsize;
- dictp = &db->dict[hval];
- if (dictp->codem1 >= max_ent)
- goto nomatch;
- } while (dictp->f.fcode != fcode);
- ent = dictp->codem1+1;
- continue; /* finally found (prefix,suffix) */
-
- nomatch: /* output (count) the prefix */
- bitno += n_bits;
-
- /* code -> hashtable */
- if (max_ent < db->maxmaxcode) {
- struct bsd_dict *dictp2;
- /* expand code size if needed */
- if (max_ent >= MAXCODE(n_bits))
- db->n_bits = ++n_bits;
-
- /* Invalidate previous hash table entry
- * assigned this code, and then take it over.
- */
- dictp2 = &db->dict[max_ent+1];
- if (db->dict[dictp2->cptr].codem1 == max_ent)
- db->dict[dictp2->cptr].codem1 = BADCODEM1;
- dictp2->cptr = hval;
- dictp->codem1 = max_ent;
- dictp->f.fcode = fcode;
-
- db->max_ent = ++max_ent;
- db->lens[max_ent] = db->lens[ent]+1;
- }
- ent = c;
- } while (--slen != 0);
- }
- bitno += n_bits; /* output (count) the last code */
- db->bytes_out += bitno/8;
- db->in_count += ilen;
- (void)bsd_check(db);
-
- ++db->incomp_count;
- db->incomp_bytes += ilen;
- ++db->uncomp_count;
- db->uncomp_bytes += ilen;
-
- /* Increase code size if we would have without the packet
- * boundary and as the decompressor will.
- */
- if (max_ent >= MAXCODE(n_bits) && max_ent < db->maxmaxcode)
- db->n_bits++;
-}
-
-
-/*
- * Decompress "BSD Compress"
- *
- * Because of patent problems, we return DECOMP_ERROR for errors
- * found by inspecting the input data and for system problems, but
- * DECOMP_FATALERROR for any errors which could possibly be said to
- * be being detected "after" decompression. For DECOMP_ERROR,
- * we can issue a CCP reset-request; for DECOMP_FATALERROR, we may be
- * infringing a patent of Motorola's if we do, so we take CCP down
- * instead.
- *
- * Given that the frame has the correct sequence number and a good FCS,
- * errors such as invalid codes in the input most likely indicate a
- * bug, so we return DECOMP_FATALERROR for them in order to turn off
- * compression, even though they are detected by inspecting the input.
- */
-static int
-bsd_decompress(state, cmsg, dmpp)
- void *state;
- mblk_t *cmsg, **dmpp;
-{
- struct bsd_db *db = (struct bsd_db *) state;
- u_int max_ent = db->max_ent;
- u_int32_t accm = 0;
- u_int bitno = 32; /* 1st valid bit in accm */
- u_int n_bits = db->n_bits;
- u_int tgtbitno = 32-n_bits; /* bitno when we have a code */
- struct bsd_dict *dictp;
- int explen, i, seq, len;
- u_int incode, oldcode, finchar;
- u_char *p, *rptr, *wptr;
- mblk_t *dmsg, *mret;
- int adrs, ctrl, ilen;
- int dlen, space, codelen, extra;
-
- /*
- * Get at least the BSD Compress header in the first buffer
- */
- rptr = cmsg->b_rptr;
- if (rptr + PPP_HDRLEN + BSD_OVHD >= cmsg->b_wptr) {
- if (!pullupmsg(cmsg, PPP_HDRLEN + BSD_OVHD + 1)) {
- if (db->debug)
- printf("bsd_decomp%d: failed to pullup\n", db->unit);
- return DECOMP_ERROR;
- }
- rptr = cmsg->b_rptr;
- }
-
- /*
- * Save the address/control from the PPP header
- * and then get the sequence number.
- */
- adrs = PPP_ADDRESS(rptr);
- ctrl = PPP_CONTROL(rptr);
- rptr += PPP_HDRLEN;
- seq = (rptr[0] << 8) + rptr[1];
- rptr += BSD_OVHD;
- ilen = len = cmsg->b_wptr - rptr;
-
- /*
- * Check the sequence number and give up if it is not what we expect.
- */
- if (seq != db->seqno++) {
- if (db->debug)
- printf("bsd_decomp%d: bad sequence # %d, expected %d\n",
- db->unit, seq, db->seqno - 1);
- return DECOMP_ERROR;
- }
-
- /*
- * Allocate one message block to start with.
- */
- if ((dmsg = allocb(DECOMP_CHUNK + db->hdrlen, BPRI_MED)) == NULL)
- return DECOMP_ERROR;
- mret = dmsg;
- dmsg->b_wptr += db->hdrlen;
- dmsg->b_rptr = wptr = dmsg->b_wptr;
-
- /* Fill in the ppp header, but not the last byte of the protocol
- (that comes from the decompressed data). */
- wptr[0] = adrs;
- wptr[1] = ctrl;
- wptr[2] = 0;
- wptr += PPP_HDRLEN - 1;
- space = dmsg->b_datap->db_lim - wptr;
-
- oldcode = CLEAR;
- explen = 0;
- for (;;) {
- if (len == 0) {
- cmsg = cmsg->b_cont;
- if (!cmsg) /* quit at end of message */
- break;
- rptr = cmsg->b_rptr;
- len = cmsg->b_wptr - rptr;
- ilen += len;
- continue; /* handle 0-length buffers */
- }
-
- /*
- * Accumulate bytes until we have a complete code.
- * Then get the next code, relying on the 32-bit,
- * unsigned accm to mask the result.
- */
- bitno -= 8;
- accm |= *rptr++ << bitno;
- --len;
- if (tgtbitno < bitno)
- continue;
- incode = accm >> tgtbitno;
- accm <<= n_bits;
- bitno += n_bits;
-
- if (incode == CLEAR) {
- /*
- * The dictionary must only be cleared at
- * the end of a packet. But there could be an
- * empty message block at the end.
- */
- if (len > 0 || cmsg->b_cont != 0) {
- if (cmsg->b_cont)
- len += msgdsize(cmsg->b_cont);
- if (len > 0) {
- freemsg(dmsg);
- if (db->debug)
- printf("bsd_decomp%d: bad CLEAR\n", db->unit);
- return DECOMP_FATALERROR;
- }
- }
- bsd_clear(db);
- explen = ilen = 0;
- break;
- }
-
- if (incode > max_ent + 2 || incode > db->maxmaxcode
- || incode > max_ent && oldcode == CLEAR) {
- freemsg(dmsg);
- if (db->debug) {
- printf("bsd_decomp%d: bad code 0x%x oldcode=0x%x ",
- db->unit, incode, oldcode);
- printf("max_ent=0x%x dlen=%d seqno=%d\n",
- max_ent, dlen, db->seqno);
- }
- return DECOMP_FATALERROR; /* probably a bug */
- }
-
- /* Special case for KwKwK string. */
- if (incode > max_ent) {
- finchar = oldcode;
- extra = 1;
- } else {
- finchar = incode;
- extra = 0;
- }
-
- codelen = db->lens[finchar];
- explen += codelen + extra;
- if (explen > db->mru + 1) {
- freemsg(dmsg);
- if (db->debug)
- printf("bsd_decomp%d: ran out of mru\n", db->unit);
- return DECOMP_FATALERROR;
- }
-
- /*
- * Decode this code and install it in the decompressed buffer.
- */
- space -= codelen + extra;
- if (space < 0) {
- /* Allocate another message block. */
- dmsg->b_wptr = wptr;
- dlen = codelen + extra;
- if (dlen < DECOMP_CHUNK)
- dlen = DECOMP_CHUNK;
- if ((dmsg->b_cont = allocb(dlen, BPRI_MED)) == NULL) {
- freemsg(dmsg);
- return DECOMP_ERROR;
- }
- dmsg = dmsg->b_cont;
- wptr = dmsg->b_wptr;
- space = dmsg->b_datap->db_lim - wptr - codelen - extra;
- }
- p = (wptr += codelen);
- while (finchar > LAST) {
- dictp = &db->dict[db->dict[finchar].cptr];
-#ifdef DEBUG
- --codelen;
- if (codelen <= 0) {
- freemsg(dmsg);
- printf("bsd_decomp%d: fell off end of chain ", db->unit);
- printf("0x%x at 0x%x by 0x%x, max_ent=0x%x\n",
- incode, finchar, db->dict[finchar].cptr, max_ent);
- return DECOMP_FATALERROR;
- }
- if (dictp->codem1 != finchar-1) {
- freemsg(dmsg);
- printf("bsd_decomp%d: bad code chain 0x%x finchar=0x%x ",
- db->unit, incode, finchar);
- printf("oldcode=0x%x cptr=0x%x codem1=0x%x\n", oldcode,
- db->dict[finchar].cptr, dictp->codem1);
- return DECOMP_FATALERROR;
- }
-#endif
- *--p = dictp->f.hs.suffix;
- finchar = dictp->f.hs.prefix;
- }
- *--p = finchar;
-
-#ifdef DEBUG
- if (--codelen != 0)
- printf("bsd_decomp%d: short by %d after code 0x%x, max_ent=0x%x\n",
- db->unit, codelen, incode, max_ent);
-#endif
-
- if (extra) /* the KwKwK case again */
- *wptr++ = finchar;
-
- /*
- * If not first code in a packet, and
- * if not out of code space, then allocate a new code.
- *
- * Keep the hash table correct so it can be used
- * with uncompressed packets.
- */
- if (oldcode != CLEAR && max_ent < db->maxmaxcode) {
- struct bsd_dict *dictp2;
- u_int32_t fcode;
- int hval, disp;
-
- fcode = BSD_KEY(oldcode,finchar);
- hval = BSD_HASH(oldcode,finchar,db->hshift);
- dictp = &db->dict[hval];
-
- /* look for a free hash table entry */
- if (dictp->codem1 < max_ent) {
- disp = (hval == 0) ? 1 : hval;
- do {
- hval += disp;
- if (hval >= db->hsize)
- hval -= db->hsize;
- dictp = &db->dict[hval];
- } while (dictp->codem1 < max_ent);
- }
-
- /*
- * Invalidate previous hash table entry
- * assigned this code, and then take it over
- */
- dictp2 = &db->dict[max_ent+1];
- if (db->dict[dictp2->cptr].codem1 == max_ent) {
- db->dict[dictp2->cptr].codem1 = BADCODEM1;
- }
- dictp2->cptr = hval;
- dictp->codem1 = max_ent;
- dictp->f.fcode = fcode;
-
- db->max_ent = ++max_ent;
- db->lens[max_ent] = db->lens[oldcode]+1;
-
- /* Expand code size if needed. */
- if (max_ent >= MAXCODE(n_bits) && max_ent < db->maxmaxcode) {
- db->n_bits = ++n_bits;
- tgtbitno = 32-n_bits;
- }
- }
- oldcode = incode;
- }
- dmsg->b_wptr = wptr;
-
- /*
- * Keep the checkpoint right so that incompressible packets
- * clear the dictionary at the right times.
- */
- db->bytes_out += ilen;
- db->in_count += explen;
- if (bsd_check(db) && db->debug) {
- printf("bsd_decomp%d: peer should have cleared dictionary\n",
- db->unit);
- }
-
- ++db->comp_count;
- db->comp_bytes += ilen + BSD_OVHD;
- ++db->uncomp_count;
- db->uncomp_bytes += explen;
-
- *dmpp = mret;
- return DECOMP_OK;
-}
-#endif /* DO_BSD_COMPRESS */
diff --git a/mdk-stage1/ppp/modules/deflate.c b/mdk-stage1/ppp/modules/deflate.c
deleted file mode 100644
index 1b9054412..000000000
--- a/mdk-stage1/ppp/modules/deflate.c
+++ /dev/null
@@ -1,760 +0,0 @@
-/*
- * ppp_deflate.c - interface the zlib procedures for Deflate compression
- * and decompression (as used by gzip) to the PPP code.
- * This version is for use with STREAMS under SunOS 4.x, Solaris 2,
- * SVR4, OSF/1 and AIX 4.x.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-#ifdef AIX4
-#include <net/net_globals.h>
-#endif
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stream.h>
-#include <net/ppp_defs.h>
-#include "ppp_mod.h"
-
-#define PACKETPTR mblk_t *
-#include <net/ppp-comp.h>
-
-#ifdef __osf__
-#include "zlib.h"
-#else
-#include "../common/zlib.h"
-#endif
-
-#if DO_DEFLATE
-
-#define DEFLATE_DEBUG 1
-
-/*
- * State for a Deflate (de)compressor.
- */
-struct deflate_state {
- int seqno;
- int w_size;
- int unit;
- int hdrlen;
- int mru;
- int debug;
- z_stream strm;
- struct compstat stats;
-};
-
-#define DEFLATE_OVHD 2 /* Deflate overhead/packet */
-
-static void *z_alloc __P((void *, u_int items, u_int size));
-static void *z_alloc_init __P((void *, u_int items, u_int size));
-static void z_free __P((void *, void *ptr));
-static void *z_comp_alloc __P((u_char *options, int opt_len));
-static void *z_decomp_alloc __P((u_char *options, int opt_len));
-static void z_comp_free __P((void *state));
-static void z_decomp_free __P((void *state));
-static int z_comp_init __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int debug));
-static int z_decomp_init __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int mru, int debug));
-static int z_compress __P((void *state, mblk_t **mret,
- mblk_t *mp, int slen, int maxolen));
-static void z_incomp __P((void *state, mblk_t *dmsg));
-static int z_decompress __P((void *state, mblk_t *cmp,
- mblk_t **dmpp));
-static void z_comp_reset __P((void *state));
-static void z_decomp_reset __P((void *state));
-static void z_comp_stats __P((void *state, struct compstat *stats));
-
-/*
- * Procedures exported to ppp_comp.c.
- */
-struct compressor ppp_deflate = {
- CI_DEFLATE, /* compress_proto */
- z_comp_alloc, /* comp_alloc */
- z_comp_free, /* comp_free */
- z_comp_init, /* comp_init */
- z_comp_reset, /* comp_reset */
- z_compress, /* compress */
- z_comp_stats, /* comp_stat */
- z_decomp_alloc, /* decomp_alloc */
- z_decomp_free, /* decomp_free */
- z_decomp_init, /* decomp_init */
- z_decomp_reset, /* decomp_reset */
- z_decompress, /* decompress */
- z_incomp, /* incomp */
- z_comp_stats, /* decomp_stat */
-};
-
-struct compressor ppp_deflate_draft = {
- CI_DEFLATE_DRAFT, /* compress_proto */
- z_comp_alloc, /* comp_alloc */
- z_comp_free, /* comp_free */
- z_comp_init, /* comp_init */
- z_comp_reset, /* comp_reset */
- z_compress, /* compress */
- z_comp_stats, /* comp_stat */
- z_decomp_alloc, /* decomp_alloc */
- z_decomp_free, /* decomp_free */
- z_decomp_init, /* decomp_init */
- z_decomp_reset, /* decomp_reset */
- z_decompress, /* decompress */
- z_incomp, /* incomp */
- z_comp_stats, /* decomp_stat */
-};
-
-#define DECOMP_CHUNK 512
-
-/*
- * Space allocation and freeing routines for use by zlib routines.
- */
-struct zchunk {
- u_int size;
- u_int guard;
-};
-
-#define GUARD_MAGIC 0x77a6011a
-
-static void *
-z_alloc_init(notused, items, size)
- void *notused;
- u_int items, size;
-{
- struct zchunk *z;
-
- size = items * size + sizeof(struct zchunk);
-#ifdef __osf__
- z = (struct zchunk *) ALLOC_SLEEP(size);
-#else
- z = (struct zchunk *) ALLOC_NOSLEEP(size);
-#endif
- z->size = size;
- z->guard = GUARD_MAGIC;
- return (void *) (z + 1);
-}
-
-static void *
-z_alloc(notused, items, size)
- void *notused;
- u_int items, size;
-{
- struct zchunk *z;
-
- size = items * size + sizeof(struct zchunk);
- z = (struct zchunk *) ALLOC_NOSLEEP(size);
- z->size = size;
- z->guard = GUARD_MAGIC;
- return (void *) (z + 1);
-}
-
-static void
-z_free(notused, ptr)
- void *notused;
- void *ptr;
-{
- struct zchunk *z = ((struct zchunk *) ptr) - 1;
-
- if (z->guard != GUARD_MAGIC) {
- printf("ppp: z_free of corrupted chunk at %x (%x, %x)\n",
- z, z->size, z->guard);
- return;
- }
- FREE(z, z->size);
-}
-
-/*
- * Allocate space for a compressor.
- */
-static void *
-z_comp_alloc(options, opt_len)
- u_char *options;
- int opt_len;
-{
- struct deflate_state *state;
- int w_size;
-
- if (opt_len != CILEN_DEFLATE
- || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
- || options[1] != CILEN_DEFLATE
- || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
- || options[3] != DEFLATE_CHK_SEQUENCE)
- return NULL;
- w_size = DEFLATE_SIZE(options[2]);
- /*
- * N.B. the 9 below should be DEFLATE_MIN_SIZE (8), but using
- * 8 will cause kernel crashes because of a bug in zlib.
- */
- if (w_size < 9 || w_size > DEFLATE_MAX_SIZE)
- return NULL;
-
-
-#ifdef __osf__
- state = (struct deflate_state *) ALLOC_SLEEP(sizeof(*state));
-#else
- state = (struct deflate_state *) ALLOC_NOSLEEP(sizeof(*state));
-#endif
-
- if (state == NULL)
- return NULL;
-
- state->strm.next_in = NULL;
- state->strm.zalloc = (alloc_func) z_alloc_init;
- state->strm.zfree = (free_func) z_free;
- if (deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION, DEFLATE_METHOD_VAL,
- -w_size, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
- FREE(state, sizeof(*state));
- return NULL;
- }
-
- state->strm.zalloc = (alloc_func) z_alloc;
- state->w_size = w_size;
- bzero(&state->stats, sizeof(state->stats));
- return (void *) state;
-}
-
-static void
-z_comp_free(arg)
- void *arg;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
-
- deflateEnd(&state->strm);
- FREE(state, sizeof(*state));
-}
-
-static int
-z_comp_init(arg, options, opt_len, unit, hdrlen, debug)
- void *arg;
- u_char *options;
- int opt_len, unit, hdrlen, debug;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
-
- if (opt_len < CILEN_DEFLATE
- || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
- || options[1] != CILEN_DEFLATE
- || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
- || DEFLATE_SIZE(options[2]) != state->w_size
- || options[3] != DEFLATE_CHK_SEQUENCE)
- return 0;
-
- state->seqno = 0;
- state->unit = unit;
- state->hdrlen = hdrlen;
- state->debug = debug;
-
- deflateReset(&state->strm);
-
- return 1;
-}
-
-static void
-z_comp_reset(arg)
- void *arg;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
-
- state->seqno = 0;
- deflateReset(&state->strm);
-}
-
-static int
-z_compress(arg, mret, mp, orig_len, maxolen)
- void *arg;
- mblk_t **mret; /* compressed packet (out) */
- mblk_t *mp; /* uncompressed packet (in) */
- int orig_len, maxolen;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
- u_char *rptr, *wptr;
- int proto, olen, wspace, r, flush;
- mblk_t *m;
-
- /*
- * Check that the protocol is in the range we handle.
- */
- *mret = NULL;
- rptr = mp->b_rptr;
- if (rptr + PPP_HDRLEN > mp->b_wptr) {
- if (!pullupmsg(mp, PPP_HDRLEN))
- return 0;
- rptr = mp->b_rptr;
- }
- proto = PPP_PROTOCOL(rptr);
- if (proto > 0x3fff || proto == 0xfd || proto == 0xfb)
- return orig_len;
-
- /* Allocate one mblk initially. */
- if (maxolen > orig_len)
- maxolen = orig_len;
- if (maxolen <= PPP_HDRLEN + 2) {
- wspace = 0;
- m = NULL;
- } else {
- wspace = maxolen + state->hdrlen;
- if (wspace > 4096)
- wspace = 4096;
- m = allocb(wspace, BPRI_MED);
- }
- if (m != NULL) {
- *mret = m;
- if (state->hdrlen + PPP_HDRLEN + 2 < wspace) {
- m->b_rptr += state->hdrlen;
- m->b_wptr = m->b_rptr;
- wspace -= state->hdrlen;
- }
- wptr = m->b_wptr;
-
- /*
- * Copy over the PPP header and store the 2-byte sequence number.
- */
- wptr[0] = PPP_ADDRESS(rptr);
- wptr[1] = PPP_CONTROL(rptr);
- wptr[2] = PPP_COMP >> 8;
- wptr[3] = PPP_COMP;
- wptr += PPP_HDRLEN;
- wptr[0] = state->seqno >> 8;
- wptr[1] = state->seqno;
- wptr += 2;
- state->strm.next_out = wptr;
- state->strm.avail_out = wspace - (PPP_HDRLEN + 2);
- } else {
- state->strm.next_out = NULL;
- state->strm.avail_out = 1000000;
- }
- ++state->seqno;
-
- rptr += (proto > 0xff)? 2: 3; /* skip 1st proto byte if 0 */
- state->strm.next_in = rptr;
- state->strm.avail_in = mp->b_wptr - rptr;
- mp = mp->b_cont;
- flush = (mp == NULL)? Z_PACKET_FLUSH: Z_NO_FLUSH;
- olen = 0;
- for (;;) {
- r = deflate(&state->strm, flush);
- if (r != Z_OK) {
- printf("z_compress: deflate returned %d (%s)\n",
- r, (state->strm.msg? state->strm.msg: ""));
- break;
- }
- if (flush != Z_NO_FLUSH && state->strm.avail_out != 0)
- break; /* all done */
- if (state->strm.avail_in == 0 && mp != NULL) {
- state->strm.next_in = mp->b_rptr;
- state->strm.avail_in = mp->b_wptr - mp->b_rptr;
- mp = mp->b_cont;
- if (mp == NULL)
- flush = Z_PACKET_FLUSH;
- }
- if (state->strm.avail_out == 0) {
- if (m != NULL) {
- m->b_wptr += wspace;
- olen += wspace;
- wspace = maxolen - olen;
- if (wspace <= 0) {
- wspace = 0;
- m->b_cont = NULL;
- } else {
- if (wspace < 32)
- wspace = 32;
- else if (wspace > 4096)
- wspace = 4096;
- m->b_cont = allocb(wspace, BPRI_MED);
- }
- m = m->b_cont;
- if (m != NULL) {
- state->strm.next_out = m->b_wptr;
- state->strm.avail_out = wspace;
- }
- }
- if (m == NULL) {
- state->strm.next_out = NULL;
- state->strm.avail_out = 1000000;
- }
- }
- }
- if (m != NULL) {
- m->b_wptr += wspace - state->strm.avail_out;
- olen += wspace - state->strm.avail_out;
- }
-
- /*
- * See if we managed to reduce the size of the packet.
- */
- if (olen < orig_len && m != NULL) {
- state->stats.comp_bytes += olen;
- state->stats.comp_packets++;
- } else {
- if (*mret != NULL) {
- freemsg(*mret);
- *mret = NULL;
- }
- state->stats.inc_bytes += orig_len;
- state->stats.inc_packets++;
- olen = orig_len;
- }
- state->stats.unc_bytes += orig_len;
- state->stats.unc_packets++;
-
- return olen;
-}
-
-static void
-z_comp_stats(arg, stats)
- void *arg;
- struct compstat *stats;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
- u_int out;
-
- *stats = state->stats;
- stats->ratio = stats->unc_bytes;
- out = stats->comp_bytes + stats->unc_bytes;
- if (stats->ratio <= 0x7ffffff)
- stats->ratio <<= 8;
- else
- out >>= 8;
- if (out != 0)
- stats->ratio /= out;
-}
-
-/*
- * Allocate space for a decompressor.
- */
-static void *
-z_decomp_alloc(options, opt_len)
- u_char *options;
- int opt_len;
-{
- struct deflate_state *state;
- int w_size;
-
- if (opt_len != CILEN_DEFLATE
- || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
- || options[1] != CILEN_DEFLATE
- || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
- || options[3] != DEFLATE_CHK_SEQUENCE)
- return NULL;
- w_size = DEFLATE_SIZE(options[2]);
- /*
- * N.B. the 9 below should be DEFLATE_MIN_SIZE (8), but using
- * 8 will cause kernel crashes because of a bug in zlib.
- */
- if (w_size < 9 || w_size > DEFLATE_MAX_SIZE)
- return NULL;
-
-#ifdef __osf__
- state = (struct deflate_state *) ALLOC_SLEEP(sizeof(*state));
-#else
- state = (struct deflate_state *) ALLOC_NOSLEEP(sizeof(*state));
-#endif
- if (state == NULL)
- return NULL;
-
- state->strm.next_out = NULL;
- state->strm.zalloc = (alloc_func) z_alloc_init;
- state->strm.zfree = (free_func) z_free;
- if (inflateInit2(&state->strm, -w_size) != Z_OK) {
- FREE(state, sizeof(*state));
- return NULL;
- }
-
- state->strm.zalloc = (alloc_func) z_alloc;
- state->w_size = w_size;
- bzero(&state->stats, sizeof(state->stats));
- return (void *) state;
-}
-
-static void
-z_decomp_free(arg)
- void *arg;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
-
- inflateEnd(&state->strm);
- FREE(state, sizeof(*state));
-}
-
-static int
-z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug)
- void *arg;
- u_char *options;
- int opt_len, unit, hdrlen, mru, debug;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
-
- if (opt_len < CILEN_DEFLATE
- || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
- || options[1] != CILEN_DEFLATE
- || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
- || DEFLATE_SIZE(options[2]) != state->w_size
- || options[3] != DEFLATE_CHK_SEQUENCE)
- return 0;
-
- state->seqno = 0;
- state->unit = unit;
- state->hdrlen = hdrlen;
- state->debug = debug;
- state->mru = mru;
-
- inflateReset(&state->strm);
-
- return 1;
-}
-
-static void
-z_decomp_reset(arg)
- void *arg;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
-
- state->seqno = 0;
- inflateReset(&state->strm);
-}
-
-/*
- * Decompress a Deflate-compressed packet.
- *
- * Because of patent problems, we return DECOMP_ERROR for errors
- * found by inspecting the input data and for system problems, but
- * DECOMP_FATALERROR for any errors which could possibly be said to
- * be being detected "after" decompression. For DECOMP_ERROR,
- * we can issue a CCP reset-request; for DECOMP_FATALERROR, we may be
- * infringing a patent of Motorola's if we do, so we take CCP down
- * instead.
- *
- * Given that the frame has the correct sequence number and a good FCS,
- * errors such as invalid codes in the input most likely indicate a
- * bug, so we return DECOMP_FATALERROR for them in order to turn off
- * compression, even though they are detected by inspecting the input.
- */
-static int
-z_decompress(arg, mi, mop)
- void *arg;
- mblk_t *mi, **mop;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
- mblk_t *mo, *mo_head;
- u_char *rptr, *wptr;
- int rlen, olen, ospace;
- int seq, i, flush, r, decode_proto;
- u_char hdr[PPP_HDRLEN + DEFLATE_OVHD];
-
- *mop = NULL;
- rptr = mi->b_rptr;
- for (i = 0; i < PPP_HDRLEN + DEFLATE_OVHD; ++i) {
- while (rptr >= mi->b_wptr) {
- mi = mi->b_cont;
- if (mi == NULL)
- return DECOMP_ERROR;
- rptr = mi->b_rptr;
- }
- hdr[i] = *rptr++;
- }
-
- /* Check the sequence number. */
- seq = (hdr[PPP_HDRLEN] << 8) + hdr[PPP_HDRLEN+1];
- if (seq != state->seqno) {
-#if !DEFLATE_DEBUG
- if (state->debug)
-#endif
- printf("z_decompress%d: bad seq # %d, expected %d\n",
- state->unit, seq, state->seqno);
- return DECOMP_ERROR;
- }
- ++state->seqno;
-
- /* Allocate an output message block. */
- mo = allocb(DECOMP_CHUNK + state->hdrlen, BPRI_MED);
- if (mo == NULL)
- return DECOMP_ERROR;
- mo_head = mo;
- mo->b_cont = NULL;
- mo->b_rptr += state->hdrlen;
- mo->b_wptr = wptr = mo->b_rptr;
- ospace = DECOMP_CHUNK;
- olen = 0;
-
- /*
- * Fill in the first part of the PPP header. The protocol field
- * comes from the decompressed data.
- */
- wptr[0] = PPP_ADDRESS(hdr);
- wptr[1] = PPP_CONTROL(hdr);
- wptr[2] = 0;
-
- /*
- * Set up to call inflate. We set avail_out to 1 initially so we can
- * look at the first byte of the output and decide whether we have
- * a 1-byte or 2-byte protocol field.
- */
- state->strm.next_in = rptr;
- state->strm.avail_in = mi->b_wptr - rptr;
- mi = mi->b_cont;
- flush = (mi == NULL)? Z_PACKET_FLUSH: Z_NO_FLUSH;
- rlen = state->strm.avail_in + PPP_HDRLEN + DEFLATE_OVHD;
- state->strm.next_out = wptr + 3;
- state->strm.avail_out = 1;
- decode_proto = 1;
-
- /*
- * Call inflate, supplying more input or output as needed.
- */
- for (;;) {
- r = inflate(&state->strm, flush);
- if (r != Z_OK) {
-#if !DEFLATE_DEBUG
- if (state->debug)
-#endif
- printf("z_decompress%d: inflate returned %d (%s)\n",
- state->unit, r, (state->strm.msg? state->strm.msg: ""));
- freemsg(mo_head);
- return DECOMP_FATALERROR;
- }
- if (flush != Z_NO_FLUSH && state->strm.avail_out != 0)
- break; /* all done */
- if (state->strm.avail_in == 0 && mi != NULL) {
- state->strm.next_in = mi->b_rptr;
- state->strm.avail_in = mi->b_wptr - mi->b_rptr;
- rlen += state->strm.avail_in;
- mi = mi->b_cont;
- if (mi == NULL)
- flush = Z_PACKET_FLUSH;
- }
- if (state->strm.avail_out == 0) {
- if (decode_proto) {
- state->strm.avail_out = ospace - PPP_HDRLEN;
- if ((wptr[3] & 1) == 0) {
- /* 2-byte protocol field */
- wptr[2] = wptr[3];
- --state->strm.next_out;
- ++state->strm.avail_out;
- }
- decode_proto = 0;
- } else {
- mo->b_wptr += ospace;
- olen += ospace;
- mo->b_cont = allocb(DECOMP_CHUNK, BPRI_MED);
- mo = mo->b_cont;
- if (mo == NULL) {
- freemsg(mo_head);
- return DECOMP_ERROR;
- }
- state->strm.next_out = mo->b_rptr;
- state->strm.avail_out = ospace = DECOMP_CHUNK;
- }
- }
- }
- if (decode_proto) {
- freemsg(mo_head);
- return DECOMP_ERROR;
- }
- mo->b_wptr += ospace - state->strm.avail_out;
- olen += ospace - state->strm.avail_out;
-
-#if DEFLATE_DEBUG
- if (olen > state->mru + PPP_HDRLEN)
- printf("ppp_deflate%d: exceeded mru (%d > %d)\n",
- state->unit, olen, state->mru + PPP_HDRLEN);
-#endif
-
- state->stats.unc_bytes += olen;
- state->stats.unc_packets++;
- state->stats.comp_bytes += rlen;
- state->stats.comp_packets++;
-
- *mop = mo_head;
- return DECOMP_OK;
-}
-
-/*
- * Incompressible data has arrived - add it to the history.
- */
-static void
-z_incomp(arg, mi)
- void *arg;
- mblk_t *mi;
-{
- struct deflate_state *state = (struct deflate_state *) arg;
- u_char *rptr;
- int rlen, proto, r;
-
- /*
- * Check that the protocol is one we handle.
- */
- rptr = mi->b_rptr;
- if (rptr + PPP_HDRLEN > mi->b_wptr) {
- if (!pullupmsg(mi, PPP_HDRLEN))
- return;
- rptr = mi->b_rptr;
- }
- proto = PPP_PROTOCOL(rptr);
- if (proto > 0x3fff || proto == 0xfd || proto == 0xfb)
- return;
-
- ++state->seqno;
-
- /*
- * Iterate through the message blocks, adding the characters in them
- * to the decompressor's history. For the first block, we start
- * at the either the 1st or 2nd byte of the protocol field,
- * depending on whether the protocol value is compressible.
- */
- rlen = mi->b_wptr - mi->b_rptr;
- state->strm.next_in = rptr + 3;
- state->strm.avail_in = rlen - 3;
- if (proto > 0xff) {
- --state->strm.next_in;
- ++state->strm.avail_in;
- }
- for (;;) {
- r = inflateIncomp(&state->strm);
- if (r != Z_OK) {
- /* gak! */
-#if !DEFLATE_DEBUG
- if (state->debug)
-#endif
- printf("z_incomp%d: inflateIncomp returned %d (%s)\n",
- state->unit, r, (state->strm.msg? state->strm.msg: ""));
- return;
- }
- mi = mi->b_cont;
- if (mi == NULL)
- break;
- state->strm.next_in = mi->b_rptr;
- state->strm.avail_in = mi->b_wptr - mi->b_rptr;
- rlen += state->strm.avail_in;
- }
-
- /*
- * Update stats.
- */
- state->stats.inc_bytes += rlen;
- state->stats.inc_packets++;
- state->stats.unc_bytes += rlen;
- state->stats.unc_packets++;
-}
-
-#endif /* DO_DEFLATE */
diff --git a/mdk-stage1/ppp/modules/if_ppp.c b/mdk-stage1/ppp/modules/if_ppp.c
deleted file mode 100644
index 14e89eb4a..000000000
--- a/mdk-stage1/ppp/modules/if_ppp.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/*
- * if_ppp.c - a network interface connected to a STREAMS module.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-/*
- * This file is used under SunOS 4 and Digital UNIX.
- *
- * This file provides the glue between PPP and IP.
- */
-
-#define INET 1
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/errno.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <net/netisr.h>
-#include <net/ppp_defs.h>
-#include <net/pppio.h>
-#include <netinet/in.h>
-#include <netinet/in_var.h>
-#ifdef __osf__
-#include <sys/ioctl.h>
-#include <net/if_types.h>
-#else
-#include <sys/sockio.h>
-#endif
-#include "ppp_mod.h"
-
-#include <sys/stream.h>
-
-#ifdef SNIT_SUPPORT
-#include <sys/time.h>
-#include <net/nit_if.h>
-#include <netinet/if_ether.h>
-#endif
-
-#ifdef __osf__
-#define SIOCSIFMTU SIOCSIPMTU
-#define SIOCGIFMTU SIOCRIPMTU
-#define IFA_ADDR(ifa) (*(ifa)->ifa_addr)
-#else
-#define IFA_ADDR(ifa) ((ifa)->ifa_addr)
-#endif
-
-#define ifr_mtu ifr_metric
-
-static int if_ppp_open __P((queue_t *, int, int, int));
-static int if_ppp_close __P((queue_t *, int));
-static int if_ppp_wput __P((queue_t *, mblk_t *));
-static int if_ppp_rput __P((queue_t *, mblk_t *));
-
-#define PPP_IF_ID 0x8021
-static struct module_info minfo = {
- PPP_IF_ID, "if_ppp", 0, INFPSZ, 4096, 128
-};
-
-static struct qinit rinit = {
- if_ppp_rput, NULL, if_ppp_open, if_ppp_close, NULL, &minfo, NULL
-};
-
-static struct qinit winit = {
- if_ppp_wput, NULL, NULL, NULL, NULL, &minfo, NULL
-};
-
-struct streamtab if_pppinfo = {
- &rinit, &winit, NULL, NULL
-};
-
-typedef struct if_ppp_state {
- int unit;
- queue_t *q;
- int flags;
-} if_ppp_t;
-
-/* Values for flags */
-#define DBGLOG 1
-
-static int if_ppp_count; /* Number of currently-active streams */
-
-static int ppp_nalloc; /* Number of elements of ifs and states */
-static struct ifnet **ifs; /* Array of pointers to interface structs */
-static if_ppp_t **states; /* Array of pointers to state structs */
-
-static int if_ppp_output __P((struct ifnet *, struct mbuf *,
- struct sockaddr *));
-static int if_ppp_ioctl __P((struct ifnet *, u_int, caddr_t));
-static struct mbuf *make_mbufs __P((mblk_t *, int));
-static mblk_t *make_message __P((struct mbuf *, int));
-
-#ifdef SNIT_SUPPORT
-/* Fake ether header for SNIT */
-static struct ether_header snit_ehdr = {{0}, {0}, ETHERTYPE_IP};
-#endif
-
-#ifndef __osf__
-static void ppp_if_detach __P((struct ifnet *));
-
-/*
- * Detach all the interfaces before unloading.
- * Not sure this works.
- */
-int
-if_ppp_unload()
-{
- int i;
-
- if (if_ppp_count > 0)
- return EBUSY;
- for (i = 0; i < ppp_nalloc; ++i)
- if (ifs[i] != 0)
- ppp_if_detach(ifs[i]);
- if (ifs) {
- FREE(ifs, ppp_nalloc * sizeof (struct ifnet *));
- FREE(states, ppp_nalloc * sizeof (struct if_ppp_t *));
- }
- ppp_nalloc = 0;
- return 0;
-}
-#endif /* __osf__ */
-
-/*
- * STREAMS module entry points.
- */
-static int
-if_ppp_open(q, dev, flag, sflag)
- queue_t *q;
- int dev;
- int flag, sflag;
-{
- if_ppp_t *sp;
-
- if (q->q_ptr == 0) {
- sp = (if_ppp_t *) ALLOC_SLEEP(sizeof (if_ppp_t));
- if (sp == 0)
- return OPENFAIL;
- bzero(sp, sizeof (if_ppp_t));
- q->q_ptr = (caddr_t) sp;
- WR(q)->q_ptr = (caddr_t) sp;
- sp->unit = -1; /* no interface unit attached at present */
- sp->q = WR(q);
- sp->flags = 0;
- ++if_ppp_count;
- }
- return 0;
-}
-
-static int
-if_ppp_close(q, flag)
- queue_t *q;
- int flag;
-{
- if_ppp_t *sp;
- struct ifnet *ifp;
-
- sp = (if_ppp_t *) q->q_ptr;
- if (sp != 0) {
- if (sp->flags & DBGLOG)
- printf("if_ppp closed, q=%x sp=%x\n", q, sp);
- if (sp->unit >= 0) {
- if (sp->unit < ppp_nalloc) {
- states[sp->unit] = 0;
- ifp = ifs[sp->unit];
- if (ifp != 0)
- ifp->if_flags &= ~(IFF_UP | IFF_RUNNING);
-#ifdef DEBUG
- } else {
- printf("if_ppp: unit %d nonexistent!\n", sp->unit);
-#endif
- }
- }
- FREE(sp, sizeof (if_ppp_t));
- --if_ppp_count;
- }
- return 0;
-}
-
-static int
-if_ppp_wput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- if_ppp_t *sp;
- struct iocblk *iop;
- int error, unit;
- struct ifnet *ifp;
-
- sp = (if_ppp_t *) q->q_ptr;
- switch (mp->b_datap->db_type) {
- case M_DATA:
- /*
- * Now why would we be getting data coming in here??
- */
- if (sp->flags & DBGLOG)
- printf("if_ppp: got M_DATA len=%d\n", msgdsize(mp));
- freemsg(mp);
- break;
-
- case M_IOCTL:
- iop = (struct iocblk *) mp->b_rptr;
- error = EINVAL;
-
- if (sp->flags & DBGLOG)
- printf("if_ppp: got ioctl cmd=%x count=%d\n",
- iop->ioc_cmd, iop->ioc_count);
-
- switch (iop->ioc_cmd) {
- case PPPIO_NEWPPA: /* well almost */
- if (iop->ioc_count != sizeof(int) || sp->unit >= 0)
- break;
- if ((error = NOTSUSER()) != 0)
- break;
- unit = *(int *)mp->b_cont->b_rptr;
-
- /* Check that this unit isn't already in use */
- if (unit < ppp_nalloc && states[unit] != 0) {
- error = EADDRINUSE;
- break;
- }
-
- /* Extend ifs and states arrays if necessary. */
- error = ENOSR;
- if (unit >= ppp_nalloc) {
- int newn;
- struct ifnet **newifs;
- if_ppp_t **newstates;
-
- newn = unit + 4;
- if (sp->flags & DBGLOG)
- printf("if_ppp: extending ifs to %d\n", newn);
- newifs = (struct ifnet **)
- ALLOC_NOSLEEP(newn * sizeof (struct ifnet *));
- if (newifs == 0)
- break;
- bzero(newifs, newn * sizeof (struct ifnet *));
- newstates = (if_ppp_t **)
- ALLOC_NOSLEEP(newn * sizeof (struct if_ppp_t *));
- if (newstates == 0) {
- FREE(newifs, newn * sizeof (struct ifnet *));
- break;
- }
- bzero(newstates, newn * sizeof (struct if_ppp_t *));
- bcopy(ifs, newifs, ppp_nalloc * sizeof(struct ifnet *));
- bcopy(states, newstates, ppp_nalloc * sizeof(if_ppp_t *));
- if (ifs) {
- FREE(ifs, ppp_nalloc * sizeof(struct ifnet *));
- FREE(states, ppp_nalloc * sizeof(if_ppp_t *));
- }
- ifs = newifs;
- states = newstates;
- ppp_nalloc = newn;
- }
-
- /* Allocate a new ifnet struct if necessary. */
- ifp = ifs[unit];
- if (ifp == 0) {
- ifp = (struct ifnet *) ALLOC_NOSLEEP(sizeof (struct ifnet));
- if (ifp == 0)
- break;
- bzero(ifp, sizeof (struct ifnet));
- ifs[unit] = ifp;
- ifp->if_name = "ppp";
- ifp->if_unit = unit;
- ifp->if_mtu = PPP_MTU;
- ifp->if_flags = IFF_POINTOPOINT | IFF_RUNNING;
-#ifndef __osf__
-#ifdef IFF_MULTICAST
- ifp->if_flags |= IFF_MULTICAST;
-#endif
-#endif /* __osf__ */
- ifp->if_output = if_ppp_output;
-#ifdef __osf__
- ifp->if_version = "Point-to-Point Protocol, version 2.3.11";
- ifp->if_mediamtu = PPP_MTU;
- ifp->if_type = IFT_PPP;
- ifp->if_hdrlen = PPP_HDRLEN;
- ifp->if_addrlen = 0;
- ifp->if_flags |= IFF_NOARP | IFF_SIMPLEX | IFF_NOTRAILERS;
-#ifdef IFF_VAR_MTU
- ifp->if_flags |= IFF_VAR_MTU;
-#endif
-#ifdef NETMASTERCPU
- ifp->if_affinity = NETMASTERCPU;
-#endif
-#endif
- ifp->if_ioctl = if_ppp_ioctl;
- ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
- if_attach(ifp);
- if (sp->flags & DBGLOG)
- printf("if_ppp: created unit %d\n", unit);
- } else {
- ifp->if_mtu = PPP_MTU;
- ifp->if_flags |= IFF_RUNNING;
- }
-
- states[unit] = sp;
- sp->unit = unit;
-
- error = 0;
- iop->ioc_count = 0;
- if (sp->flags & DBGLOG)
- printf("if_ppp: attached unit %d, sp=%x q=%x\n", unit,
- sp, sp->q);
- break;
-
- case PPPIO_DEBUG:
- error = -1;
- if (iop->ioc_count == sizeof(int)) {
- if (*(int *)mp->b_cont->b_rptr == PPPDBG_LOG + PPPDBG_IF) {
- printf("if_ppp: debug log enabled, q=%x sp=%x\n", q, sp);
- sp->flags |= DBGLOG;
- error = 0;
- iop->ioc_count = 0;
- }
- }
- break;
-
- default:
- error = -1;
- break;
- }
-
- if (sp->flags & DBGLOG)
- printf("if_ppp: ioctl result %d\n", error);
- if (error < 0)
- putnext(q, mp);
- else if (error == 0) {
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
- } else {
- mp->b_datap->db_type = M_IOCNAK;
- iop->ioc_count = 0;
- iop->ioc_error = error;
- qreply(q, mp);
- }
- break;
-
- default:
- putnext(q, mp);
- }
- return 0;
-}
-
-static int
-if_ppp_rput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- if_ppp_t *sp;
- int proto, s;
- struct mbuf *mb;
- struct ifqueue *inq;
- struct ifnet *ifp;
- int len;
-
- sp = (if_ppp_t *) q->q_ptr;
- switch (mp->b_datap->db_type) {
- case M_DATA:
- /*
- * Convert the message into an mbuf chain
- * and inject it into the network code.
- */
- if (sp->flags & DBGLOG)
- printf("if_ppp: rput pkt len %d data %x %x %x %x %x %x %x %x\n",
- msgdsize(mp), mp->b_rptr[0], mp->b_rptr[1], mp->b_rptr[2],
- mp->b_rptr[3], mp->b_rptr[4], mp->b_rptr[5], mp->b_rptr[6],
- mp->b_rptr[7]);
-
- if (sp->unit < 0) {
- freemsg(mp);
- break;
- }
- if (sp->unit >= ppp_nalloc || (ifp = ifs[sp->unit]) == 0) {
-#ifdef DEBUG
- printf("if_ppp: no unit %d!\n", sp->unit);
-#endif
- freemsg(mp);
- break;
- }
-
- if ((ifp->if_flags & IFF_UP) == 0) {
- freemsg(mp);
- break;
- }
- ++ifp->if_ipackets;
-
- proto = PPP_PROTOCOL(mp->b_rptr);
- adjmsg(mp, PPP_HDRLEN);
- len = msgdsize(mp);
- mb = make_mbufs(mp, sizeof(struct ifnet *));
- freemsg(mp);
- if (mb == NULL) {
- if (sp->flags & DBGLOG)
- printf("if_ppp%d: make_mbufs failed\n", ifp->if_unit);
- ++ifp->if_ierrors;
- break;
- }
-
-#ifdef SNIT_SUPPORT
- if (proto == PPP_IP && (ifp->if_flags & IFF_PROMISC)) {
- struct nit_if nif;
-
- nif.nif_header = (caddr_t) &snit_ehdr;
- nif.nif_hdrlen = sizeof(snit_ehdr);
- nif.nif_bodylen = len;
- nif.nif_promisc = 0;
- snit_intr(ifp, mb, &nif);
- }
-#endif
-
-/*
- * For Digital UNIX, there's space set aside in the header mbuf
- * for the interface info.
- *
- * For Sun it's smuggled around via a pointer at the front of the mbuf.
- */
-#ifdef __osf__
- mb->m_pkthdr.rcvif = ifp;
- mb->m_pkthdr.len = len;
-#else
- mb->m_off -= sizeof(struct ifnet *);
- mb->m_len += sizeof(struct ifnet *);
- *mtod(mb, struct ifnet **) = ifp;
-#endif
-
- inq = 0;
- switch (proto) {
- case PPP_IP:
- inq = &ipintrq;
- schednetisr(NETISR_IP);
- }
-
- if (inq != 0) {
- s = splhigh();
- if (IF_QFULL(inq)) {
- IF_DROP(inq);
- ++ifp->if_ierrors;
- if (sp->flags & DBGLOG)
- printf("if_ppp: inq full, proto=%x\n", proto);
- m_freem(mb);
- } else {
- IF_ENQUEUE(inq, mb);
- }
- splx(s);
- } else {
- if (sp->flags & DBGLOG)
- printf("if_ppp%d: proto=%x?\n", ifp->if_unit, proto);
- ++ifp->if_ierrors;
- m_freem(mb);
- }
- break;
-
- default:
- putnext(q, mp);
- }
- return 0;
-}
-
-/*
- * Network code wants to output a packet.
- * Turn it into a STREAMS message and send it down.
- */
-static int
-if_ppp_output(ifp, m0, dst)
- struct ifnet *ifp;
- struct mbuf *m0;
- struct sockaddr *dst;
-{
- mblk_t *mp;
- int proto, s;
- if_ppp_t *sp;
- u_char *p;
-
- if ((ifp->if_flags & IFF_UP) == 0) {
- m_freem(m0);
- return ENETDOWN;
- }
-
- if ((unsigned)ifp->if_unit >= ppp_nalloc) {
-#ifdef DEBUG
- printf("if_ppp_output: unit %d?\n", ifp->if_unit);
-#endif
- m_freem(m0);
- return EINVAL;
- }
- sp = states[ifp->if_unit];
- if (sp == 0) {
-#ifdef DEBUG
- printf("if_ppp_output: no queue?\n");
-#endif
- m_freem(m0);
- return ENETDOWN;
- }
-
- if (sp->flags & DBGLOG) {
- p = mtod(m0, u_char *);
- printf("if_ppp_output%d: af=%d data=%x %x %x %x %x %x %x %x q=%x\n",
- ifp->if_unit, dst->sa_family, p[0], p[1], p[2], p[3], p[4],
- p[5], p[6], p[7], sp->q);
- }
-
- switch (dst->sa_family) {
- case AF_INET:
- proto = PPP_IP;
-#ifdef SNIT_SUPPORT
- if (ifp->if_flags & IFF_PROMISC) {
- struct nit_if nif;
- struct mbuf *m;
- int len;
-
- for (len = 0, m = m0; m != NULL; m = m->m_next)
- len += m->m_len;
- nif.nif_header = (caddr_t) &snit_ehdr;
- nif.nif_hdrlen = sizeof(snit_ehdr);
- nif.nif_bodylen = len;
- nif.nif_promisc = 0;
- snit_intr(ifp, m0, &nif);
- }
-#endif
- break;
-
- default:
- m_freem(m0);
- return EAFNOSUPPORT;
- }
-
- ++ifp->if_opackets;
- mp = make_message(m0, PPP_HDRLEN);
- m_freem(m0);
- if (mp == 0) {
- ++ifp->if_oerrors;
- return ENOBUFS;
- }
- mp->b_rptr -= PPP_HDRLEN;
- mp->b_rptr[0] = PPP_ALLSTATIONS;
- mp->b_rptr[1] = PPP_UI;
- mp->b_rptr[2] = proto >> 8;
- mp->b_rptr[3] = proto;
-
- s = splstr();
- if (sp->flags & DBGLOG)
- printf("if_ppp: putnext(%x, %x), r=%x w=%x p=%x\n",
- sp->q, mp, mp->b_rptr, mp->b_wptr, proto);
- putnext(sp->q, mp);
- splx(s);
-
- return 0;
-}
-
-/*
- * Socket ioctl routine for ppp interfaces.
- */
-static int
-if_ppp_ioctl(ifp, cmd, data)
- struct ifnet *ifp;
- u_int cmd;
- caddr_t data;
-{
- int s, error;
- struct ifreq *ifr = (struct ifreq *) data;
- struct ifaddr *ifa = (struct ifaddr *) data;
- u_short mtu;
-
- error = 0;
- s = splimp();
- switch (cmd) {
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_RUNNING) == 0)
- ifp->if_flags &= ~IFF_UP;
- break;
-
- case SIOCSIFADDR:
- if (IFA_ADDR(ifa).sa_family != AF_INET)
- error = EAFNOSUPPORT;
- break;
-
- case SIOCSIFDSTADDR:
- if (IFA_ADDR(ifa).sa_family != AF_INET)
- error = EAFNOSUPPORT;
- break;
-
- case SIOCSIFMTU:
- if ((error = NOTSUSER()) != 0)
- break;
-#ifdef __osf__
- /* this hack is necessary because ifioctl checks ifr_data
- * in 4.0 and 5.0, but ifr_data and ifr_metric overlay each
- * other in the definition of struct ifreq so pppd can't set both.
- */
- bcopy(ifr->ifr_data, &mtu, sizeof (u_short));
- ifr->ifr_mtu = mtu;
-#endif
-
- if (ifr->ifr_mtu < PPP_MINMTU || ifr->ifr_mtu > PPP_MAXMTU) {
- error = EINVAL;
- break;
- }
- ifp->if_mtu = ifr->ifr_mtu;
- break;
-
- case SIOCGIFMTU:
- ifr->ifr_mtu = ifp->if_mtu;
- break;
-
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- switch(ifr->ifr_addr.sa_family) {
- case AF_INET:
- break;
- default:
- error = EAFNOSUPPORT;
- break;
- }
- break;
-
- default:
- error = EINVAL;
- }
- splx(s);
- return (error);
-}
-
-/*
- * Turn a STREAMS message into an mbuf chain.
- */
-static struct mbuf *
-make_mbufs(mp, off)
- mblk_t *mp;
- int off;
-{
- struct mbuf *head, **prevp, *m;
- int len, space, n;
- unsigned char *cp, *dp;
-
- len = msgdsize(mp);
- if (len == 0)
- return 0;
- prevp = &head;
- space = 0;
- cp = mp->b_rptr;
-#ifdef __osf__
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- m->m_len = 0;
- space = MHLEN;
- *prevp = m;
- prevp = &m->m_next;
- dp = mtod(m, unsigned char *);
- len -= space;
- off = 0;
-#endif
- for (;;) {
- while (cp >= mp->b_wptr) {
- mp = mp->b_cont;
- if (mp == 0) {
- *prevp = 0;
- return head;
- }
- cp = mp->b_rptr;
- }
- n = mp->b_wptr - cp;
- if (space == 0) {
- MGET(m, M_DONTWAIT, MT_DATA);
- *prevp = m;
- if (m == 0) {
- if (head != 0)
- m_freem(head);
- return 0;
- }
- if (len + off > 2 * MLEN) {
-#ifdef __osf__
- MCLGET(m, M_DONTWAIT);
-#else
- MCLGET(m);
-#endif
- }
-#ifdef __osf__
- space = ((m->m_flags & M_EXT) ? MCLBYTES : MLEN);
-#else
- space = (m->m_off > MMAXOFF? MCLBYTES: MLEN) - off;
- m->m_off += off;
-#endif
- m->m_len = 0;
- len -= space;
- dp = mtod(m, unsigned char *);
- off = 0;
- prevp = &m->m_next;
- }
- if (n > space)
- n = space;
- bcopy(cp, dp, n);
- cp += n;
- dp += n;
- space -= n;
- m->m_len += n;
- }
-}
-
-/*
- * Turn an mbuf chain into a STREAMS message.
- */
-#define ALLOCB_MAX 4096
-
-static mblk_t *
-make_message(m, off)
- struct mbuf *m;
- int off;
-{
- mblk_t *head, **prevp, *mp;
- int len, space, n, nb;
- unsigned char *cp, *dp;
- struct mbuf *nm;
-
- len = 0;
- for (nm = m; nm != 0; nm = nm->m_next)
- len += nm->m_len;
- prevp = &head;
- space = 0;
- cp = mtod(m, unsigned char *);
- nb = m->m_len;
- for (;;) {
- while (nb <= 0) {
- m = m->m_next;
- if (m == 0) {
- *prevp = 0;
- return head;
- }
- cp = mtod(m, unsigned char *);
- nb = m->m_len;
- }
- if (space == 0) {
- space = len + off;
- if (space > ALLOCB_MAX)
- space = ALLOCB_MAX;
- mp = allocb(space, BPRI_LO);
- *prevp = mp;
- if (mp == 0) {
- if (head != 0)
- freemsg(head);
- return 0;
- }
- dp = mp->b_rptr += off;
- space -= off;
- len -= space;
- off = 0;
- prevp = &mp->b_cont;
- }
- n = nb < space? nb: space;
- bcopy(cp, dp, n);
- cp += n;
- dp += n;
- nb -= n;
- space -= n;
- mp->b_wptr = dp;
- }
-}
-
-/*
- * Digital UNIX doesn't allow for removing ifnet structures
- * from the list. But then we're not using this as a loadable
- * module anyway, so that's OK.
- *
- * Under SunOS, this should allow the module to be unloaded.
- * Unfortunately, it doesn't seem to detach all the references,
- * so your system may well crash after you unload this module :-(
- */
-#ifndef __osf__
-
-/*
- * Remove an interface from the system.
- * This routine contains magic.
- */
-#include <net/route.h>
-#include <netinet/in_pcb.h>
-#include <netinet/ip_var.h>
-#include <netinet/tcp.h>
-#include <netinet/tcp_timer.h>
-#include <netinet/tcp_var.h>
-#include <netinet/udp.h>
-#include <netinet/udp_var.h>
-
-static void
-ppp_if_detach(ifp)
- struct ifnet *ifp;
-{
- int s;
- struct inpcb *pcb;
- struct ifaddr *ifa;
- struct in_ifaddr **inap;
- struct ifnet **ifpp;
-
- s = splhigh();
-
- /*
- * Clear the interface from any routes currently cached in
- * TCP or UDP protocol control blocks.
- */
- for (pcb = tcb.inp_next; pcb != &tcb; pcb = pcb->inp_next)
- if (pcb->inp_route.ro_rt && pcb->inp_route.ro_rt->rt_ifp == ifp)
- in_losing(pcb);
- for (pcb = udb.inp_next; pcb != &udb; pcb = pcb->inp_next)
- if (pcb->inp_route.ro_rt && pcb->inp_route.ro_rt->rt_ifp == ifp)
- in_losing(pcb);
-
- /*
- * Delete routes through all addresses of the interface.
- */
- for (ifa = ifp->if_addrlist; ifa != 0; ifa = ifa->ifa_next) {
- rtinit(ifa, ifa, SIOCDELRT, RTF_HOST);
- rtinit(ifa, ifa, SIOCDELRT, 0);
- }
-
- /*
- * Unlink the interface's address(es) from the in_ifaddr list.
- */
- for (inap = &in_ifaddr; *inap != 0; ) {
- if ((*inap)->ia_ifa.ifa_ifp == ifp)
- *inap = (*inap)->ia_next;
- else
- inap = &(*inap)->ia_next;
- }
-
- /*
- * Delete the interface from the ifnet list.
- */
- for (ifpp = &ifnet; (*ifpp) != 0; ) {
- if (*ifpp == ifp)
- break;
- ifpp = &(*ifpp)->if_next;
- }
- if (*ifpp == 0)
- printf("couldn't find interface ppp%d in ifnet list\n", ifp->if_unit);
- else
- *ifpp = ifp->if_next;
-
- splx(s);
-}
-
-#endif /* __osf__ */
diff --git a/mdk-stage1/ppp/modules/ppp.c b/mdk-stage1/ppp/modules/ppp.c
deleted file mode 100644
index 44bf08dff..000000000
--- a/mdk-stage1/ppp/modules/ppp.c
+++ /dev/null
@@ -1,2486 +0,0 @@
-/*
- * ppp.c - STREAMS multiplexing pseudo-device driver for PPP.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-/*
- * This file is used under Solaris 2, SVR4, SunOS 4, and Digital UNIX.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/stream.h>
-#include <sys/stropts.h>
-#include <sys/errno.h>
-#ifdef __osf__
-#include <sys/ioctl.h>
-#include <sys/cmn_err.h>
-#define queclass(mp) ((mp)->b_band & QPCTL)
-#else
-#include <sys/ioccom.h>
-#endif
-#include <sys/time.h>
-#ifdef SVR4
-#include <sys/cmn_err.h>
-#include <sys/conf.h>
-#include <sys/dlpi.h>
-#include <sys/ddi.h>
-#ifdef SOL2
-#include <sys/ksynch.h>
-#include <sys/kstat.h>
-#include <sys/sunddi.h>
-#include <sys/ethernet.h>
-#else
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#endif /* SOL2 */
-#else /* not SVR4 */
-#include <sys/user.h>
-#endif /* SVR4 */
-#include <net/ppp_defs.h>
-#include <net/pppio.h>
-#include "ppp_mod.h"
-
-/*
- * Modifications marked with #ifdef PRIOQ are for priority queueing of
- * interactive traffic, and are due to Marko Zec <zec@japa.tel.fer.hr>.
- */
-#ifdef PRIOQ
-#endif /* PRIOQ */
-
-#include <netinet/in.h> /* leave this outside of PRIOQ for htons */
-
-#ifdef __STDC__
-#define __P(x) x
-#else
-#define __P(x) ()
-#endif
-
-/*
- * The IP module may use this SAP value for IP packets.
- */
-#ifndef ETHERTYPE_IP
-#define ETHERTYPE_IP 0x800
-#endif
-
-#if !defined(ETHERTYPE_IPV6)
-#define ETHERTYPE_IPV6 0x86dd
-#endif /* !defined(ETHERTYPE_IPV6) */
-
-#if !defined(ETHERTYPE_ALLSAP) && defined(SOL2)
-#define ETHERTYPE_ALLSAP 0
-#endif /* !defined(ETHERTYPE_ALLSAP) && defined(SOL2) */
-
-#if !defined(PPP_ALLSAP) && defined(SOL2)
-#define PPP_ALLSAP PPP_ALLSTATIONS
-#endif /* !defined(PPP_ALLSAP) && defined(SOL2) */
-
-extern time_t time;
-
-#ifdef SOL2
-/*
- * We use this reader-writer lock to ensure that the lower streams
- * stay connected to the upper streams while the lower-side put and
- * service procedures are running. Essentially it is an existence
- * lock for the upper stream associated with each lower stream.
- */
-krwlock_t ppp_lower_lock;
-#define LOCK_LOWER_W rw_enter(&ppp_lower_lock, RW_WRITER)
-#define LOCK_LOWER_R rw_enter(&ppp_lower_lock, RW_READER)
-#define TRYLOCK_LOWER_R rw_tryenter(&ppp_lower_lock, RW_READER)
-#define UNLOCK_LOWER rw_exit(&ppp_lower_lock)
-
-#define MT_ENTER(x) mutex_enter(x)
-#define MT_EXIT(x) mutex_exit(x)
-
-/*
- * Notes on multithreaded implementation for Solaris 2:
- *
- * We use an inner perimeter around each queue pair and an outer
- * perimeter around the whole driver. The inner perimeter is
- * entered exclusively for all entry points (open, close, put,
- * service). The outer perimeter is entered exclusively for open
- * and close and shared for put and service. This is all done for
- * us by the streams framework.
- *
- * I used to think that the perimeters were entered for the lower
- * streams' put and service routines as well as for the upper streams'.
- * Because of problems experienced by people, and after reading the
- * documentation more closely, I now don't think that is true. So we
- * now use ppp_lower_lock to give us an existence guarantee on the
- * upper stream controlling each lower stream.
- *
- * Shared entry to the outer perimeter protects the existence of all
- * the upper streams and their upperstr_t structures, and guarantees
- * that the following fields of any upperstr_t won't change:
- * nextmn, next, nextppa. It guarantees that the lowerq field of an
- * upperstr_t won't go from non-zero to zero, that the global `ppas'
- * won't change and that the no lower stream will get unlinked.
- *
- * Shared (reader) access to ppa_lower_lock guarantees that no lower
- * stream will be unlinked and that the lowerq field of all upperstr_t
- * structures won't change.
- */
-
-#else /* SOL2 */
-#define LOCK_LOWER_W 0
-#define LOCK_LOWER_R 0
-#define TRYLOCK_LOWER_R 1
-#define UNLOCK_LOWER 0
-#define MT_ENTER(x) 0
-#define MT_EXIT(x) 0
-
-#endif /* SOL2 */
-
-/*
- * Private information; one per upper stream.
- */
-typedef struct upperstr {
- minor_t mn; /* minor device number */
- struct upperstr *nextmn; /* next minor device */
- queue_t *q; /* read q associated with this upper stream */
- int flags; /* flag bits, see below */
- int state; /* current DLPI state */
- int sap; /* service access point */
- int req_sap; /* which SAP the DLPI client requested */
- struct upperstr *ppa; /* control stream for our ppa */
- struct upperstr *next; /* next stream for this ppa */
- uint ioc_id; /* last ioctl ID for this stream */
- enum NPmode npmode; /* what to do with packets on this SAP */
- unsigned char rblocked; /* flow control has blocked upper read strm */
- /* N.B. rblocked is only changed by control stream's put/srv procs */
- /*
- * There is exactly one control stream for each PPA.
- * The following fields are only used for control streams.
- */
- int ppa_id;
- queue_t *lowerq; /* write queue attached below this PPA */
- struct upperstr *nextppa; /* next control stream */
- int mru;
- int mtu;
- struct pppstat stats; /* statistics */
- time_t last_sent; /* time last NP packet sent */
- time_t last_recv; /* time last NP packet rcvd */
-#ifdef SOL2
- kmutex_t stats_lock; /* lock for stats updates */
- kstat_t *kstats; /* stats for netstat */
-#endif /* SOL2 */
-#ifdef LACHTCP
- int ifflags;
- char ifname[IFNAMSIZ];
- struct ifstats ifstats;
-#endif /* LACHTCP */
-} upperstr_t;
-
-/* Values for flags */
-#define US_PRIV 1 /* stream was opened by superuser */
-#define US_CONTROL 2 /* stream is a control stream */
-#define US_BLOCKED 4 /* flow ctrl has blocked lower write stream */
-#define US_LASTMOD 8 /* no PPP modules below us */
-#define US_DBGLOG 0x10 /* log various occurrences */
-#define US_RBLOCKED 0x20 /* flow ctrl has blocked upper read stream */
-
-#if defined(SOL2)
-#if DL_CURRENT_VERSION >= 2
-#define US_PROMISC 0x40 /* stream is promiscuous */
-#endif /* DL_CURRENT_VERSION >= 2 */
-#define US_RAWDATA 0x80 /* raw M_DATA, no DLPI header */
-#endif /* defined(SOL2) */
-
-#ifdef PRIOQ
-static u_char max_band=0;
-static u_char def_band=0;
-
-#define IPPORT_DEFAULT 65535
-
-/*
- * Port priority table
- * Highest priority ports are listed first, lowest are listed last.
- * ICMP & packets using unlisted ports will be treated as "default".
- * If IPPORT_DEFAULT is not listed here, "default" packets will be
- * assigned lowest priority.
- * Each line should be terminated with "0".
- * Line containing only "0" marks the end of the list.
- */
-
-static u_short prioq_table[]= {
- 113, 53, 0,
- 22, 23, 513, 517, 518, 0,
- 514, 21, 79, 111, 0,
- 25, 109, 110, 0,
- IPPORT_DEFAULT, 0,
- 20, 70, 80, 8001, 8008, 8080, 0, /* 8001,8008,8080 - common proxy ports */
-0 };
-
-#endif /* PRIOQ */
-
-
-static upperstr_t *minor_devs = NULL;
-static upperstr_t *ppas = NULL;
-
-#ifdef SVR4
-static int pppopen __P((queue_t *, dev_t *, int, int, cred_t *));
-static int pppclose __P((queue_t *, int, cred_t *));
-#else
-static int pppopen __P((queue_t *, int, int, int));
-static int pppclose __P((queue_t *, int));
-#endif /* SVR4 */
-static int pppurput __P((queue_t *, mblk_t *));
-static int pppuwput __P((queue_t *, mblk_t *));
-static int pppursrv __P((queue_t *));
-static int pppuwsrv __P((queue_t *));
-static int ppplrput __P((queue_t *, mblk_t *));
-static int ppplwput __P((queue_t *, mblk_t *));
-static int ppplrsrv __P((queue_t *));
-static int ppplwsrv __P((queue_t *));
-#ifndef NO_DLPI
-static void dlpi_request __P((queue_t *, mblk_t *, upperstr_t *));
-static void dlpi_error __P((queue_t *, upperstr_t *, int, int, int));
-static void dlpi_ok __P((queue_t *, int));
-#endif
-static int send_data __P((mblk_t *, upperstr_t *));
-static void new_ppa __P((queue_t *, mblk_t *));
-static void attach_ppa __P((queue_t *, mblk_t *));
-static void detach_ppa __P((queue_t *, mblk_t *));
-static void detach_lower __P((queue_t *, mblk_t *));
-static void debug_dump __P((queue_t *, mblk_t *));
-static upperstr_t *find_dest __P((upperstr_t *, int));
-#if defined(SOL2)
-static upperstr_t *find_promisc __P((upperstr_t *, int));
-static mblk_t *prepend_ether __P((upperstr_t *, mblk_t *, int));
-static mblk_t *prepend_udind __P((upperstr_t *, mblk_t *, int));
-static void promisc_sendup __P((upperstr_t *, mblk_t *, int, int));
-#endif /* defined(SOL2) */
-static int putctl2 __P((queue_t *, int, int, int));
-static int putctl4 __P((queue_t *, int, int, int));
-static int pass_packet __P((upperstr_t *ppa, mblk_t *mp, int outbound));
-#ifdef FILTER_PACKETS
-static int ip_hard_filter __P((upperstr_t *ppa, mblk_t *mp, int outbound));
-#endif /* FILTER_PACKETS */
-
-#define PPP_ID 0xb1a6
-static struct module_info ppp_info = {
-#ifdef PRIOQ
- PPP_ID, "ppp", 0, 512, 512, 384
-#else
- PPP_ID, "ppp", 0, 512, 512, 128
-#endif /* PRIOQ */
-};
-
-static struct qinit pppurint = {
- pppurput, pppursrv, pppopen, pppclose, NULL, &ppp_info, NULL
-};
-
-static struct qinit pppuwint = {
- pppuwput, pppuwsrv, NULL, NULL, NULL, &ppp_info, NULL
-};
-
-static struct qinit ppplrint = {
- ppplrput, ppplrsrv, NULL, NULL, NULL, &ppp_info, NULL
-};
-
-static struct qinit ppplwint = {
- ppplwput, ppplwsrv, NULL, NULL, NULL, &ppp_info, NULL
-};
-
-#ifdef LACHTCP
-extern struct ifstats *ifstats;
-int pppdevflag = 0;
-#endif
-
-struct streamtab pppinfo = {
- &pppurint, &pppuwint,
- &ppplrint, &ppplwint
-};
-
-int ppp_count;
-
-/*
- * How we maintain statistics.
- */
-#ifdef SOL2
-#define INCR_IPACKETS(ppa) \
- if (ppa->kstats != 0) { \
- KSTAT_NAMED_PTR(ppa->kstats)[0].value.ul++; \
- }
-#define INCR_IERRORS(ppa) \
- if (ppa->kstats != 0) { \
- KSTAT_NAMED_PTR(ppa->kstats)[1].value.ul++; \
- }
-#define INCR_OPACKETS(ppa) \
- if (ppa->kstats != 0) { \
- KSTAT_NAMED_PTR(ppa->kstats)[2].value.ul++; \
- }
-#define INCR_OERRORS(ppa) \
- if (ppa->kstats != 0) { \
- KSTAT_NAMED_PTR(ppa->kstats)[3].value.ul++; \
- }
-#endif
-
-#ifdef LACHTCP
-#define INCR_IPACKETS(ppa) ppa->ifstats.ifs_ipackets++;
-#define INCR_IERRORS(ppa) ppa->ifstats.ifs_ierrors++;
-#define INCR_OPACKETS(ppa) ppa->ifstats.ifs_opackets++;
-#define INCR_OERRORS(ppa) ppa->ifstats.ifs_oerrors++;
-#endif
-
-/*
- * STREAMS driver entry points.
- */
-static int
-#ifdef SVR4
-pppopen(q, devp, oflag, sflag, credp)
- queue_t *q;
- dev_t *devp;
- int oflag, sflag;
- cred_t *credp;
-#else
-pppopen(q, dev, oflag, sflag)
- queue_t *q;
- int dev; /* really dev_t */
- int oflag, sflag;
-#endif
-{
- upperstr_t *up;
- upperstr_t **prevp;
- minor_t mn;
-#ifdef PRIOQ
- u_short *ptr;
- u_char new_band;
-#endif /* PRIOQ */
-
- if (q->q_ptr)
- DRV_OPEN_OK(dev); /* device is already open */
-
-#ifdef PRIOQ
- /* Calculate max_bband & def_band from definitions in prioq.h
- This colud be done at some more approtiate time (less often)
- but this way it works well so I'll just leave it here */
-
- max_band = 1;
- def_band = 0;
- ptr = prioq_table;
- while (*ptr) {
- new_band = 1;
- while (*ptr)
- if (*ptr++ == IPPORT_DEFAULT) {
- new_band = 0;
- def_band = max_band;
- }
- max_band += new_band;
- ptr++;
- }
- if (def_band)
- def_band = max_band - def_band;
- --max_band;
-#endif /* PRIOQ */
-
- if (sflag == CLONEOPEN) {
- mn = 0;
- for (prevp = &minor_devs; (up = *prevp) != 0; prevp = &up->nextmn) {
- if (up->mn != mn)
- break;
- ++mn;
- }
- } else {
-#ifdef SVR4
- mn = getminor(*devp);
-#else
- mn = minor(dev);
-#endif
- for (prevp = &minor_devs; (up = *prevp) != 0; prevp = &up->nextmn) {
- if (up->mn >= mn)
- break;
- }
- if (up->mn == mn) {
- /* this can't happen */
- q->q_ptr = WR(q)->q_ptr = (caddr_t) up;
- DRV_OPEN_OK(dev);
- }
- }
-
- /*
- * Construct a new minor node.
- */
- up = (upperstr_t *) ALLOC_SLEEP(sizeof(upperstr_t));
- bzero((caddr_t) up, sizeof(upperstr_t));
- if (up == 0) {
- DPRINT("pppopen: out of kernel memory\n");
- OPEN_ERROR(ENXIO);
- }
- up->nextmn = *prevp;
- *prevp = up;
- up->mn = mn;
-#ifdef SVR4
- *devp = makedevice(getmajor(*devp), mn);
-#endif
- up->q = q;
- if (NOTSUSER() == 0)
- up->flags |= US_PRIV;
-#ifndef NO_DLPI
- up->state = DL_UNATTACHED;
-#endif
-#ifdef LACHTCP
- up->ifflags = IFF_UP | IFF_POINTOPOINT;
-#endif
- up->sap = -1;
- up->last_sent = up->last_recv = time;
- up->npmode = NPMODE_DROP;
- q->q_ptr = (caddr_t) up;
- WR(q)->q_ptr = (caddr_t) up;
- noenable(WR(q));
-#ifdef SOL2
- mutex_init(&up->stats_lock, NULL, MUTEX_DRIVER, NULL);
-#endif
- ++ppp_count;
-
- qprocson(q);
- DRV_OPEN_OK(makedev(major(dev), mn));
-}
-
-static int
-#ifdef SVR4
-pppclose(q, flag, credp)
- queue_t *q;
- int flag;
- cred_t *credp;
-#else
-pppclose(q, flag)
- queue_t *q;
- int flag;
-#endif
-{
- upperstr_t *up, **upp;
- upperstr_t *as, *asnext;
- upperstr_t **prevp;
-
- qprocsoff(q);
-
- up = (upperstr_t *) q->q_ptr;
- if (up == 0) {
- DPRINT("pppclose: q_ptr = 0\n");
- return 0;
- }
- if (up->flags & US_DBGLOG)
- DPRINT2("ppp/%d: close, flags=%x\n", up->mn, up->flags);
- if (up->flags & US_CONTROL) {
-#ifdef LACHTCP
- struct ifstats *ifp, *pifp;
-#endif
- if (up->lowerq != 0) {
- /* Gack! the lower stream should have be unlinked earlier! */
- DPRINT1("ppp%d: lower stream still connected on close?\n",
- up->mn);
- LOCK_LOWER_W;
- up->lowerq->q_ptr = 0;
- RD(up->lowerq)->q_ptr = 0;
- up->lowerq = 0;
- UNLOCK_LOWER;
- }
-
- /*
- * This stream represents a PPA:
- * For all streams attached to the PPA, clear their
- * references to this PPA.
- * Then remove this PPA from the list of PPAs.
- */
- for (as = up->next; as != 0; as = asnext) {
- asnext = as->next;
- as->next = 0;
- as->ppa = 0;
- if (as->flags & US_BLOCKED) {
- as->flags &= ~US_BLOCKED;
- flushq(WR(as->q), FLUSHDATA);
- }
- }
- for (upp = &ppas; *upp != 0; upp = &(*upp)->nextppa)
- if (*upp == up) {
- *upp = up->nextppa;
- break;
- }
-#ifdef LACHTCP
- /* Remove the statistics from the active list. */
- for (ifp = ifstats, pifp = 0; ifp; ifp = ifp->ifs_next) {
- if (ifp == &up->ifstats) {
- if (pifp)
- pifp->ifs_next = ifp->ifs_next;
- else
- ifstats = ifp->ifs_next;
- break;
- }
- pifp = ifp;
- }
-#endif
- } else {
- /*
- * If this stream is attached to a PPA,
- * remove it from the PPA's list.
- */
- if ((as = up->ppa) != 0) {
- for (; as->next != 0; as = as->next)
- if (as->next == up) {
- as->next = up->next;
- break;
- }
- }
- }
-
-#ifdef SOL2
- if (up->kstats)
- kstat_delete(up->kstats);
- mutex_destroy(&up->stats_lock);
-#endif
-
- q->q_ptr = NULL;
- WR(q)->q_ptr = NULL;
-
- for (prevp = &minor_devs; *prevp != 0; prevp = &(*prevp)->nextmn) {
- if (*prevp == up) {
- *prevp = up->nextmn;
- break;
- }
- }
- FREE(up, sizeof(upperstr_t));
- --ppp_count;
-
- return 0;
-}
-
-/*
- * A message from on high. We do one of three things:
- * - qreply()
- * - put the message on the lower write stream
- * - queue it for our service routine
- */
-static int
-pppuwput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- upperstr_t *us, *ppa, *nps;
- struct iocblk *iop;
- struct linkblk *lb;
-#ifdef LACHTCP
- struct ifreq *ifr;
- int i;
-#endif
- queue_t *lq;
- int error, n, sap;
- mblk_t *mq;
- struct ppp_idle *pip;
-#ifdef PRIOQ
- queue_t *tlq;
-#endif /* PRIOQ */
-#ifdef NO_DLPI
- upperstr_t *os;
-#endif
-
- us = (upperstr_t *) q->q_ptr;
- if (us == 0) {
- DPRINT("pppuwput: q_ptr = 0!\n");
- return 0;
- }
- if (mp == 0) {
- DPRINT1("pppuwput/%d: mp = 0!\n", us->mn);
- return 0;
- }
- if (mp->b_datap == 0) {
- DPRINT1("pppuwput/%d: mp->b_datap = 0!\n", us->mn);
- return 0;
- }
- switch (mp->b_datap->db_type) {
-#ifndef NO_DLPI
- case M_PCPROTO:
- case M_PROTO:
- dlpi_request(q, mp, us);
- break;
-#endif /* NO_DLPI */
-
- case M_DATA:
- if (us->flags & US_DBGLOG)
- DPRINT3("ppp/%d: uwput M_DATA len=%d flags=%x\n",
- us->mn, msgdsize(mp), us->flags);
- if (us->ppa == 0 || msgdsize(mp) > us->ppa->mtu + PPP_HDRLEN
-#ifndef NO_DLPI
- || (us->flags & US_CONTROL) == 0
-#endif /* NO_DLPI */
- ) {
- DPRINT1("pppuwput: junk data len=%d\n", msgdsize(mp));
- freemsg(mp);
- break;
- }
-#ifdef NO_DLPI
- if ((us->flags & US_CONTROL) == 0 && !pass_packet(us, mp, 1))
- break;
-#endif
- if (!send_data(mp, us))
- putq(q, mp);
- break;
-
- case M_IOCTL:
- iop = (struct iocblk *) mp->b_rptr;
- error = EINVAL;
- if (us->flags & US_DBGLOG)
- DPRINT3("ppp/%d: ioctl %x count=%d\n",
- us->mn, iop->ioc_cmd, iop->ioc_count);
- switch (iop->ioc_cmd) {
-#if defined(SOL2)
- case DLIOCRAW: /* raw M_DATA mode */
- us->flags |= US_RAWDATA;
- error = 0;
- break;
-#endif /* defined(SOL2) */
- case I_LINK:
- if ((us->flags & US_CONTROL) == 0 || us->lowerq != 0)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl I_LINK b_cont = 0!\n", us->mn);
- break;
- }
- lb = (struct linkblk *) mp->b_cont->b_rptr;
- lq = lb->l_qbot;
- if (lq == 0) {
- DPRINT1("pppuwput/%d: ioctl I_LINK l_qbot = 0!\n", us->mn);
- break;
- }
- LOCK_LOWER_W;
- us->lowerq = lq;
- lq->q_ptr = (caddr_t) q;
- RD(lq)->q_ptr = (caddr_t) us->q;
- UNLOCK_LOWER;
- iop->ioc_count = 0;
- error = 0;
- us->flags &= ~US_LASTMOD;
- /* Unblock upper streams which now feed this lower stream. */
- qenable(q);
- /* Send useful information down to the modules which
- are now linked below us. */
- putctl2(lq, M_CTL, PPPCTL_UNIT, us->ppa_id);
- putctl4(lq, M_CTL, PPPCTL_MRU, us->mru);
- putctl4(lq, M_CTL, PPPCTL_MTU, us->mtu);
-#ifdef PRIOQ
- /* Lower tty driver's queue hiwat/lowat from default 4096/128
- to 256/128 since we don't want queueing of data on
- output to physical device */
-
- freezestr(lq);
- for (tlq = lq; tlq->q_next != NULL; tlq = tlq->q_next)
- ;
- strqset(tlq, QHIWAT, 0, 256);
- strqset(tlq, QLOWAT, 0, 128);
- unfreezestr(lq);
-#endif /* PRIOQ */
- break;
-
- case I_UNLINK:
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl I_UNLINK b_cont = 0!\n", us->mn);
- break;
- }
- lb = (struct linkblk *) mp->b_cont->b_rptr;
-#if DEBUG
- if (us->lowerq != lb->l_qbot) {
- DPRINT2("ppp unlink: lowerq=%x qbot=%x\n",
- us->lowerq, lb->l_qbot);
- break;
- }
-#endif
- iop->ioc_count = 0;
- qwriter(q, mp, detach_lower, PERIM_OUTER);
- error = -1;
- break;
-
- case PPPIO_NEWPPA:
- if (us->flags & US_CONTROL)
- break;
- if ((us->flags & US_PRIV) == 0) {
- error = EPERM;
- break;
- }
- /* Arrange to return an int */
- if ((mq = mp->b_cont) == 0
- || mq->b_datap->db_lim - mq->b_rptr < sizeof(int)) {
- mq = allocb(sizeof(int), BPRI_HI);
- if (mq == 0) {
- error = ENOSR;
- break;
- }
- if (mp->b_cont != 0)
- freemsg(mp->b_cont);
- mp->b_cont = mq;
- mq->b_cont = 0;
- }
- iop->ioc_count = sizeof(int);
- mq->b_wptr = mq->b_rptr + sizeof(int);
- qwriter(q, mp, new_ppa, PERIM_OUTER);
- error = -1;
- break;
-
- case PPPIO_ATTACH:
- /* like dlpi_attach, for programs which can't write to
- the stream (like pppstats) */
- if (iop->ioc_count != sizeof(int) || us->ppa != 0)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl PPPIO_ATTACH b_cont = 0!\n", us->mn);
- break;
- }
- n = *(int *)mp->b_cont->b_rptr;
- for (ppa = ppas; ppa != 0; ppa = ppa->nextppa)
- if (ppa->ppa_id == n)
- break;
- if (ppa == 0)
- break;
- us->ppa = ppa;
- iop->ioc_count = 0;
- qwriter(q, mp, attach_ppa, PERIM_OUTER);
- error = -1;
- break;
-
-#ifdef NO_DLPI
- case PPPIO_BIND:
- /* Attach to a given SAP. */
- if (iop->ioc_count != sizeof(int) || us->ppa == 0)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl PPPIO_BIND b_cont = 0!\n", us->mn);
- break;
- }
- n = *(int *)mp->b_cont->b_rptr;
- /* n must be a valid PPP network protocol number. */
- if (n < 0x21 || n > 0x3fff || (n & 0x101) != 1)
- break;
- /* check that no other stream is bound to this sap already. */
- for (os = us->ppa; os != 0; os = os->next)
- if (os->sap == n)
- break;
- if (os != 0)
- break;
- us->sap = n;
- iop->ioc_count = 0;
- error = 0;
- break;
-#endif /* NO_DLPI */
-
- case PPPIO_MRU:
- if (iop->ioc_count != sizeof(int) || (us->flags & US_CONTROL) == 0)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl PPPIO_MRU b_cont = 0!\n", us->mn);
- break;
- }
- n = *(int *)mp->b_cont->b_rptr;
- if (n <= 0 || n > PPP_MAXMRU)
- break;
- if (n < PPP_MRU)
- n = PPP_MRU;
- us->mru = n;
- if (us->lowerq)
- putctl4(us->lowerq, M_CTL, PPPCTL_MRU, n);
- error = 0;
- iop->ioc_count = 0;
- break;
-
- case PPPIO_MTU:
- if (iop->ioc_count != sizeof(int) || (us->flags & US_CONTROL) == 0)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl PPPIO_MTU b_cont = 0!\n", us->mn);
- break;
- }
- n = *(int *)mp->b_cont->b_rptr;
- if (n <= 0 || n > PPP_MAXMTU)
- break;
- us->mtu = n;
-#ifdef LACHTCP
- /* The MTU reported in netstat, not used as IP max packet size! */
- us->ifstats.ifs_mtu = n;
-#endif
- if (us->lowerq)
- putctl4(us->lowerq, M_CTL, PPPCTL_MTU, n);
- error = 0;
- iop->ioc_count = 0;
- break;
-
- case PPPIO_LASTMOD:
- us->flags |= US_LASTMOD;
- error = 0;
- break;
-
- case PPPIO_DEBUG:
- if (iop->ioc_count != sizeof(int))
- break;
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl PPPIO_DEBUG b_cont = 0!\n", us->mn);
- break;
- }
- n = *(int *)mp->b_cont->b_rptr;
- if (n == PPPDBG_DUMP + PPPDBG_DRIVER) {
- qwriter(q, NULL, debug_dump, PERIM_OUTER);
- iop->ioc_count = 0;
- error = -1;
- } else if (n == PPPDBG_LOG + PPPDBG_DRIVER) {
- DPRINT1("ppp/%d: debug log enabled\n", us->mn);
- us->flags |= US_DBGLOG;
- iop->ioc_count = 0;
- error = 0;
- } else {
- if (us->ppa == 0 || us->ppa->lowerq == 0)
- break;
- putnext(us->ppa->lowerq, mp);
- error = -1;
- }
- break;
-
- case PPPIO_NPMODE:
- if (iop->ioc_count != 2 * sizeof(int))
- break;
- if ((us->flags & US_CONTROL) == 0)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("pppuwput/%d: ioctl PPPIO_NPMODE b_cont = 0!\n", us->mn);
- break;
- }
- sap = ((int *)mp->b_cont->b_rptr)[0];
- for (nps = us->next; nps != 0; nps = nps->next) {
- if (us->flags & US_DBGLOG)
- DPRINT2("us = 0x%x, us->next->sap = 0x%x\n", nps, nps->sap);
- if (nps->sap == sap)
- break;
- }
- if (nps == 0) {
- if (us->flags & US_DBGLOG)
- DPRINT2("ppp/%d: no stream for sap %x\n", us->mn, sap);
- break;
- }
- /* XXX possibly should use qwriter here */
- nps->npmode = (enum NPmode) ((int *)mp->b_cont->b_rptr)[1];
- if (nps->npmode != NPMODE_QUEUE && (nps->flags & US_BLOCKED) != 0)
- qenable(WR(nps->q));
- iop->ioc_count = 0;
- error = 0;
- break;
-
- case PPPIO_GIDLE:
- if ((ppa = us->ppa) == 0)
- break;
- mq = allocb(sizeof(struct ppp_idle), BPRI_HI);
- if (mq == 0) {
- error = ENOSR;
- break;
- }
- if (mp->b_cont != 0)
- freemsg(mp->b_cont);
- mp->b_cont = mq;
- mq->b_cont = 0;
- pip = (struct ppp_idle *) mq->b_wptr;
- pip->xmit_idle = time - ppa->last_sent;
- pip->recv_idle = time - ppa->last_recv;
- mq->b_wptr += sizeof(struct ppp_idle);
- iop->ioc_count = sizeof(struct ppp_idle);
- error = 0;
- break;
-
-#ifdef LACHTCP
- case SIOCSIFNAME:
- /* Sent from IP down to us. Attach the ifstats structure. */
- if (iop->ioc_count != sizeof(struct ifreq) || us->ppa == 0)
- break;
- ifr = (struct ifreq *)mp->b_cont->b_rptr;
- /* Find the unit number in the interface name. */
- for (i = 0; i < IFNAMSIZ; i++) {
- if (ifr->ifr_name[i] == 0 ||
- (ifr->ifr_name[i] >= '0' &&
- ifr->ifr_name[i] <= '9'))
- break;
- else
- us->ifname[i] = ifr->ifr_name[i];
- }
- us->ifname[i] = 0;
-
- /* Convert the unit number to binary. */
- for (n = 0; i < IFNAMSIZ; i++) {
- if (ifr->ifr_name[i] == 0) {
- break;
- }
- else {
- n = n * 10 + ifr->ifr_name[i] - '0';
- }
- }
-
- /* Verify the ppa. */
- if (us->ppa->ppa_id != n)
- break;
- ppa = us->ppa;
-
- /* Set up the netstat block. */
- strncpy (ppa->ifname, us->ifname, IFNAMSIZ);
-
- ppa->ifstats.ifs_name = ppa->ifname;
- ppa->ifstats.ifs_unit = n;
- ppa->ifstats.ifs_active = us->state != DL_UNBOUND;
- ppa->ifstats.ifs_mtu = ppa->mtu;
-
- /* Link in statistics used by netstat. */
- ppa->ifstats.ifs_next = ifstats;
- ifstats = &ppa->ifstats;
-
- iop->ioc_count = 0;
- error = 0;
- break;
-
- case SIOCGIFFLAGS:
- if (!(us->flags & US_CONTROL)) {
- if (us->ppa)
- us = us->ppa;
- else
- break;
- }
- ((struct iocblk_in *)iop)->ioc_ifflags = us->ifflags;
- error = 0;
- break;
-
- case SIOCSIFFLAGS:
- if (!(us->flags & US_CONTROL)) {
- if (us->ppa)
- us = us->ppa;
- else
- break;
- }
- us->ifflags = ((struct iocblk_in *)iop)->ioc_ifflags;
- error = 0;
- break;
-
- case SIOCSIFADDR:
- if (!(us->flags & US_CONTROL)) {
- if (us->ppa)
- us = us->ppa;
- else
- break;
- }
- us->ifflags |= IFF_RUNNING;
- ((struct iocblk_in *)iop)->ioc_ifflags |= IFF_RUNNING;
- error = 0;
- break;
-
- case SIOCSIFMTU:
- /*
- * Vanilla SVR4 systems don't handle SIOCSIFMTU, rather
- * they take the MTU from the DL_INFO_ACK we sent in response
- * to their DL_INFO_REQ. Fortunately, they will update the
- * MTU if we send an unsolicited DL_INFO_ACK up.
- */
- if ((mq = allocb(sizeof(dl_info_req_t), BPRI_HI)) == 0)
- break; /* should do bufcall */
- ((union DL_primitives *)mq->b_rptr)->dl_primitive = DL_INFO_REQ;
- mq->b_wptr = mq->b_rptr + sizeof(dl_info_req_t);
- dlpi_request(q, mq, us);
- error = 0;
- break;
-
- case SIOCGIFNETMASK:
- case SIOCSIFNETMASK:
- case SIOCGIFADDR:
- case SIOCGIFDSTADDR:
- case SIOCSIFDSTADDR:
- case SIOCGIFMETRIC:
- error = 0;
- break;
-#endif /* LACHTCP */
-
- default:
- if (us->ppa == 0 || us->ppa->lowerq == 0)
- break;
- us->ioc_id = iop->ioc_id;
- error = -1;
- switch (iop->ioc_cmd) {
- case PPPIO_GETSTAT:
- case PPPIO_GETCSTAT:
- if (us->flags & US_LASTMOD) {
- error = EINVAL;
- break;
- }
- putnext(us->ppa->lowerq, mp);
- break;
- default:
- if (us->flags & US_PRIV)
- putnext(us->ppa->lowerq, mp);
- else {
- DPRINT1("ppp ioctl %x rejected\n", iop->ioc_cmd);
- error = EPERM;
- }
- break;
- }
- break;
- }
-
- if (error > 0) {
- iop->ioc_error = error;
- mp->b_datap->db_type = M_IOCNAK;
- qreply(q, mp);
- } else if (error == 0) {
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
- }
- break;
-
- case M_FLUSH:
- if (us->flags & US_DBGLOG)
- DPRINT2("ppp/%d: flush %x\n", us->mn, *mp->b_rptr);
- if (*mp->b_rptr & FLUSHW)
- flushq(q, FLUSHDATA);
- if (*mp->b_rptr & FLUSHR) {
- *mp->b_rptr &= ~FLUSHW;
- qreply(q, mp);
- } else
- freemsg(mp);
- break;
-
- default:
- freemsg(mp);
- break;
- }
- return 0;
-}
-
-#ifndef NO_DLPI
-static void
-dlpi_request(q, mp, us)
- queue_t *q;
- mblk_t *mp;
- upperstr_t *us;
-{
- union DL_primitives *d = (union DL_primitives *) mp->b_rptr;
- int size = mp->b_wptr - mp->b_rptr;
- mblk_t *reply, *np;
- upperstr_t *ppa, *os;
- int sap, len;
- dl_info_ack_t *info;
- dl_bind_ack_t *ackp;
-#if DL_CURRENT_VERSION >= 2
- dl_phys_addr_ack_t *paddrack;
- static struct ether_addr eaddr = {0};
-#endif
-
- if (us->flags & US_DBGLOG)
- DPRINT3("ppp/%d: dlpi prim %x len=%d\n", us->mn,
- d->dl_primitive, size);
- switch (d->dl_primitive) {
- case DL_INFO_REQ:
- if (size < sizeof(dl_info_req_t))
- goto badprim;
- if ((reply = allocb(sizeof(dl_info_ack_t), BPRI_HI)) == 0)
- break; /* should do bufcall */
- reply->b_datap->db_type = M_PCPROTO;
- info = (dl_info_ack_t *) reply->b_wptr;
- reply->b_wptr += sizeof(dl_info_ack_t);
- bzero((caddr_t) info, sizeof(dl_info_ack_t));
- info->dl_primitive = DL_INFO_ACK;
- info->dl_max_sdu = us->ppa? us->ppa->mtu: PPP_MAXMTU;
- info->dl_min_sdu = 1;
- info->dl_addr_length = sizeof(uint);
- info->dl_mac_type = DL_ETHER; /* a bigger lie */
- info->dl_current_state = us->state;
- info->dl_service_mode = DL_CLDLS;
- info->dl_provider_style = DL_STYLE2;
-#if DL_CURRENT_VERSION >= 2
- info->dl_sap_length = sizeof(uint);
- info->dl_version = DL_CURRENT_VERSION;
-#endif
- qreply(q, reply);
- break;
-
- case DL_ATTACH_REQ:
- if (size < sizeof(dl_attach_req_t))
- goto badprim;
- if (us->state != DL_UNATTACHED || us->ppa != 0) {
- dlpi_error(q, us, DL_ATTACH_REQ, DL_OUTSTATE, 0);
- break;
- }
- for (ppa = ppas; ppa != 0; ppa = ppa->nextppa)
- if (ppa->ppa_id == d->attach_req.dl_ppa)
- break;
- if (ppa == 0) {
- dlpi_error(q, us, DL_ATTACH_REQ, DL_BADPPA, 0);
- break;
- }
- us->ppa = ppa;
- qwriter(q, mp, attach_ppa, PERIM_OUTER);
- return;
-
- case DL_DETACH_REQ:
- if (size < sizeof(dl_detach_req_t))
- goto badprim;
- if (us->state != DL_UNBOUND || us->ppa == 0) {
- dlpi_error(q, us, DL_DETACH_REQ, DL_OUTSTATE, 0);
- break;
- }
- qwriter(q, mp, detach_ppa, PERIM_OUTER);
- return;
-
- case DL_BIND_REQ:
- if (size < sizeof(dl_bind_req_t))
- goto badprim;
- if (us->state != DL_UNBOUND || us->ppa == 0) {
- dlpi_error(q, us, DL_BIND_REQ, DL_OUTSTATE, 0);
- break;
- }
-#if 0
- /* apparently this test fails (unnecessarily?) on some systems */
- if (d->bind_req.dl_service_mode != DL_CLDLS) {
- dlpi_error(q, us, DL_BIND_REQ, DL_UNSUPPORTED, 0);
- break;
- }
-#endif
-
- /* saps must be valid PPP network protocol numbers,
- except that we accept ETHERTYPE_IP in place of PPP_IP. */
- sap = d->bind_req.dl_sap;
- us->req_sap = sap;
-
-#if defined(SOL2)
- if (us->flags & US_DBGLOG)
- DPRINT2("DL_BIND_REQ: ip gives sap = 0x%x, us = 0x%x", sap, us);
-
- if (sap == ETHERTYPE_IP) /* normal IFF_IPV4 */
- sap = PPP_IP;
- else if (sap == ETHERTYPE_IPV6) /* when IFF_IPV6 is set */
- sap = PPP_IPV6;
- else if (sap == ETHERTYPE_ALLSAP) /* snoop gives sap of 0 */
- sap = PPP_ALLSAP;
- else {
- DPRINT2("DL_BIND_REQ: unrecognized sap = 0x%x, us = 0x%x", sap, us);
- dlpi_error(q, us, DL_BIND_REQ, DL_BADADDR, 0);
- break;
- }
-#else
- if (sap == ETHERTYPE_IP)
- sap = PPP_IP;
- if (sap < 0x21 || sap > 0x3fff || (sap & 0x101) != 1) {
- dlpi_error(q, us, DL_BIND_REQ, DL_BADADDR, 0);
- break;
- }
-#endif /* defined(SOL2) */
-
- /* check that no other stream is bound to this sap already. */
- for (os = us->ppa; os != 0; os = os->next)
- if (os->sap == sap)
- break;
- if (os != 0) {
- dlpi_error(q, us, DL_BIND_REQ, DL_NOADDR, 0);
- break;
- }
-
- us->sap = sap;
- us->state = DL_IDLE;
-
- if ((reply = allocb(sizeof(dl_bind_ack_t) + sizeof(uint),
- BPRI_HI)) == 0)
- break; /* should do bufcall */
- ackp = (dl_bind_ack_t *) reply->b_wptr;
- reply->b_wptr += sizeof(dl_bind_ack_t) + sizeof(uint);
- reply->b_datap->db_type = M_PCPROTO;
- bzero((caddr_t) ackp, sizeof(dl_bind_ack_t));
- ackp->dl_primitive = DL_BIND_ACK;
- ackp->dl_sap = sap;
- ackp->dl_addr_length = sizeof(uint);
- ackp->dl_addr_offset = sizeof(dl_bind_ack_t);
- *(uint *)(ackp+1) = sap;
- qreply(q, reply);
- break;
-
- case DL_UNBIND_REQ:
- if (size < sizeof(dl_unbind_req_t))
- goto badprim;
- if (us->state != DL_IDLE) {
- dlpi_error(q, us, DL_UNBIND_REQ, DL_OUTSTATE, 0);
- break;
- }
- us->sap = -1;
- us->state = DL_UNBOUND;
-#ifdef LACHTCP
- us->ppa->ifstats.ifs_active = 0;
-#endif
- dlpi_ok(q, DL_UNBIND_REQ);
- break;
-
- case DL_UNITDATA_REQ:
- if (size < sizeof(dl_unitdata_req_t))
- goto badprim;
- if (us->state != DL_IDLE) {
- dlpi_error(q, us, DL_UNITDATA_REQ, DL_OUTSTATE, 0);
- break;
- }
- if ((ppa = us->ppa) == 0) {
- cmn_err(CE_CONT, "ppp: in state dl_idle but ppa == 0?\n");
- break;
- }
- len = mp->b_cont == 0? 0: msgdsize(mp->b_cont);
- if (len > ppa->mtu) {
- DPRINT2("dlpi data too large (%d > %d)\n", len, ppa->mtu);
- break;
- }
-
-#if defined(SOL2)
- /*
- * Should there be any promiscuous stream(s), send the data
- * up for each promiscuous stream that we recognize.
- */
- if (mp->b_cont)
- promisc_sendup(ppa, mp->b_cont, us->sap, 0);
-#endif /* defined(SOL2) */
-
- mp->b_band = 0;
-#ifdef PRIOQ
- /* Extract s_port & d_port from IP-packet, the code is a bit
- dirty here, but so am I, too... */
- if (mp->b_datap->db_type == M_PROTO && us->sap == PPP_IP
- && mp->b_cont != 0) {
- u_char *bb, *tlh;
- int iphlen, len;
- u_short *ptr;
- u_char band_unset, cur_band, syn;
- u_short s_port, d_port;
-
- bb = mp->b_cont->b_rptr; /* bb points to IP-header*/
- len = mp->b_cont->b_wptr - mp->b_cont->b_rptr;
- syn = 0;
- s_port = IPPORT_DEFAULT;
- d_port = IPPORT_DEFAULT;
- if (len >= 20) { /* 20 = minimum length of IP header */
- iphlen = (bb[0] & 0x0f) * 4;
- tlh = bb + iphlen;
- len -= iphlen;
- switch (bb[9]) {
- case IPPROTO_TCP:
- if (len >= 20) { /* min length of TCP header */
- s_port = (tlh[0] << 8) + tlh[1];
- d_port = (tlh[2] << 8) + tlh[3];
- syn = tlh[13] & 0x02;
- }
- break;
- case IPPROTO_UDP:
- if (len >= 8) { /* min length of UDP header */
- s_port = (tlh[0] << 8) + tlh[1];
- d_port = (tlh[2] << 8) + tlh[3];
- }
- break;
- }
- }
-
- /*
- * Now calculate b_band for this packet from the
- * port-priority table.
- */
- ptr = prioq_table;
- cur_band = max_band;
- band_unset = 1;
- while (*ptr) {
- while (*ptr && band_unset)
- if (s_port == *ptr || d_port == *ptr++) {
- mp->b_band = cur_band;
- band_unset = 0;
- break;
- }
- ptr++;
- cur_band--;
- }
- if (band_unset)
- mp->b_band = def_band;
- /* It may be usable to urge SYN packets a bit */
- if (syn)
- mp->b_band++;
- }
-#endif /* PRIOQ */
- /* this assumes PPP_HDRLEN <= sizeof(dl_unitdata_req_t) */
- if (mp->b_datap->db_ref > 1) {
- np = allocb(PPP_HDRLEN, BPRI_HI);
- if (np == 0)
- break; /* gak! */
- np->b_cont = mp->b_cont;
- mp->b_cont = 0;
- freeb(mp);
- mp = np;
- } else
- mp->b_datap->db_type = M_DATA;
- /* XXX should use dl_dest_addr_offset/length here,
- but we would have to translate ETHERTYPE_IP -> PPP_IP */
- mp->b_wptr = mp->b_rptr + PPP_HDRLEN;
- mp->b_rptr[0] = PPP_ALLSTATIONS;
- mp->b_rptr[1] = PPP_UI;
- mp->b_rptr[2] = us->sap >> 8;
- mp->b_rptr[3] = us->sap;
- if (pass_packet(us, mp, 1)) {
- if (!send_data(mp, us))
- putq(q, mp);
- }
- return;
-
-#if DL_CURRENT_VERSION >= 2
- case DL_PHYS_ADDR_REQ:
- if (size < sizeof(dl_phys_addr_req_t))
- goto badprim;
-
- /*
- * Don't check state because ifconfig sends this one down too
- */
-
- if ((reply = allocb(sizeof(dl_phys_addr_ack_t)+ETHERADDRL,
- BPRI_HI)) == 0)
- break; /* should do bufcall */
- reply->b_datap->db_type = M_PCPROTO;
- paddrack = (dl_phys_addr_ack_t *) reply->b_wptr;
- reply->b_wptr += sizeof(dl_phys_addr_ack_t);
- bzero((caddr_t) paddrack, sizeof(dl_phys_addr_ack_t)+ETHERADDRL);
- paddrack->dl_primitive = DL_PHYS_ADDR_ACK;
- paddrack->dl_addr_length = ETHERADDRL;
- paddrack->dl_addr_offset = sizeof(dl_phys_addr_ack_t);
- bcopy(&eaddr, reply->b_wptr, ETHERADDRL);
- reply->b_wptr += ETHERADDRL;
- qreply(q, reply);
- break;
-
-#if defined(SOL2)
- case DL_PROMISCON_REQ:
- if (size < sizeof(dl_promiscon_req_t))
- goto badprim;
- us->flags |= US_PROMISC;
- dlpi_ok(q, DL_PROMISCON_REQ);
- break;
-
- case DL_PROMISCOFF_REQ:
- if (size < sizeof(dl_promiscoff_req_t))
- goto badprim;
- us->flags &= ~US_PROMISC;
- dlpi_ok(q, DL_PROMISCOFF_REQ);
- break;
-#else
- case DL_PROMISCON_REQ: /* fall thru */
- case DL_PROMISCOFF_REQ: /* fall thru */
-#endif /* defined(SOL2) */
-#endif /* DL_CURRENT_VERSION >= 2 */
-
-#if DL_CURRENT_VERSION >= 2
- case DL_SET_PHYS_ADDR_REQ:
- case DL_SUBS_BIND_REQ:
- case DL_SUBS_UNBIND_REQ:
- case DL_ENABMULTI_REQ:
- case DL_DISABMULTI_REQ:
- case DL_XID_REQ:
- case DL_TEST_REQ:
- case DL_REPLY_UPDATE_REQ:
- case DL_REPLY_REQ:
- case DL_DATA_ACK_REQ:
-#endif
- case DL_CONNECT_REQ:
- case DL_TOKEN_REQ:
- dlpi_error(q, us, d->dl_primitive, DL_NOTSUPPORTED, 0);
- break;
-
- case DL_CONNECT_RES:
- case DL_DISCONNECT_REQ:
- case DL_RESET_REQ:
- case DL_RESET_RES:
- dlpi_error(q, us, d->dl_primitive, DL_OUTSTATE, 0);
- break;
-
- case DL_UDQOS_REQ:
- dlpi_error(q, us, d->dl_primitive, DL_BADQOSTYPE, 0);
- break;
-
-#if DL_CURRENT_VERSION >= 2
- case DL_TEST_RES:
- case DL_XID_RES:
- break;
-#endif
-
- default:
- cmn_err(CE_CONT, "ppp: unknown dlpi prim 0x%x\n", d->dl_primitive);
- /* fall through */
- badprim:
- dlpi_error(q, us, d->dl_primitive, DL_BADPRIM, 0);
- break;
- }
- freemsg(mp);
-}
-
-static void
-dlpi_error(q, us, prim, err, uerr)
- queue_t *q;
- upperstr_t *us;
- int prim, err, uerr;
-{
- mblk_t *reply;
- dl_error_ack_t *errp;
-
- if (us->flags & US_DBGLOG)
- DPRINT3("ppp/%d: dlpi error, prim=%x, err=%x\n", us->mn, prim, err);
- reply = allocb(sizeof(dl_error_ack_t), BPRI_HI);
- if (reply == 0)
- return; /* XXX should do bufcall */
- reply->b_datap->db_type = M_PCPROTO;
- errp = (dl_error_ack_t *) reply->b_wptr;
- reply->b_wptr += sizeof(dl_error_ack_t);
- errp->dl_primitive = DL_ERROR_ACK;
- errp->dl_error_primitive = prim;
- errp->dl_errno = err;
- errp->dl_unix_errno = uerr;
- qreply(q, reply);
-}
-
-static void
-dlpi_ok(q, prim)
- queue_t *q;
- int prim;
-{
- mblk_t *reply;
- dl_ok_ack_t *okp;
-
- reply = allocb(sizeof(dl_ok_ack_t), BPRI_HI);
- if (reply == 0)
- return; /* XXX should do bufcall */
- reply->b_datap->db_type = M_PCPROTO;
- okp = (dl_ok_ack_t *) reply->b_wptr;
- reply->b_wptr += sizeof(dl_ok_ack_t);
- okp->dl_primitive = DL_OK_ACK;
- okp->dl_correct_primitive = prim;
- qreply(q, reply);
-}
-#endif /* NO_DLPI */
-
-static int
-pass_packet(us, mp, outbound)
- upperstr_t *us;
- mblk_t *mp;
- int outbound;
-{
- int pass;
- upperstr_t *ppa;
-
- if ((ppa = us->ppa) == 0) {
- freemsg(mp);
- return 0;
- }
-
-#ifdef FILTER_PACKETS
- pass = ip_hard_filter(us, mp, outbound);
-#else
- /*
- * Here is where we might, in future, decide whether to pass
- * or drop the packet, and whether it counts as link activity.
- */
- pass = 1;
-#endif /* FILTER_PACKETS */
-
- if (pass < 0) {
- /* pass only if link already up, and don't update time */
- if (ppa->lowerq == 0) {
- freemsg(mp);
- return 0;
- }
- pass = 1;
- } else if (pass) {
- if (outbound)
- ppa->last_sent = time;
- else
- ppa->last_recv = time;
- }
-
- return pass;
-}
-
-/*
- * We have some data to send down to the lower stream (or up the
- * control stream, if we don't have a lower stream attached).
- * Returns 1 if the message was dealt with, 0 if it wasn't able
- * to be sent on and should therefore be queued up.
- */
-static int
-send_data(mp, us)
- mblk_t *mp;
- upperstr_t *us;
-{
- upperstr_t *ppa;
-
- if ((us->flags & US_BLOCKED) || us->npmode == NPMODE_QUEUE)
- return 0;
- ppa = us->ppa;
- if (ppa == 0 || us->npmode == NPMODE_DROP || us->npmode == NPMODE_ERROR) {
- if (us->flags & US_DBGLOG)
- DPRINT2("ppp/%d: dropping pkt (npmode=%d)\n", us->mn, us->npmode);
- freemsg(mp);
- return 1;
- }
- if (ppa->lowerq == 0) {
- /* try to send it up the control stream */
- if (bcanputnext(ppa->q, mp->b_band)) {
- /*
- * The message seems to get corrupted for some reason if
- * we just send the message up as it is, so we send a copy.
- */
- mblk_t *np = copymsg(mp);
- freemsg(mp);
- if (np != 0)
- putnext(ppa->q, np);
- return 1;
- }
- } else {
- if (bcanputnext(ppa->lowerq, mp->b_band)) {
- MT_ENTER(&ppa->stats_lock);
- ppa->stats.ppp_opackets++;
- ppa->stats.ppp_obytes += msgdsize(mp);
-#ifdef INCR_OPACKETS
- INCR_OPACKETS(ppa);
-#endif
- MT_EXIT(&ppa->stats_lock);
- /*
- * The lower queue is only ever detached while holding an
- * exclusive lock on the whole driver. So we can be confident
- * that the lower queue is still there.
- */
- putnext(ppa->lowerq, mp);
- return 1;
- }
- }
- us->flags |= US_BLOCKED;
- return 0;
-}
-
-/*
- * Allocate a new PPA id and link this stream into the list of PPAs.
- * This procedure is called with an exclusive lock on all queues in
- * this driver.
- */
-static void
-new_ppa(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- upperstr_t *us, *up, **usp;
- int ppa_id;
-
- us = (upperstr_t *) q->q_ptr;
- if (us == 0) {
- DPRINT("new_ppa: q_ptr = 0!\n");
- return;
- }
-
- usp = &ppas;
- ppa_id = 0;
- while ((up = *usp) != 0 && ppa_id == up->ppa_id) {
- ++ppa_id;
- usp = &up->nextppa;
- }
- us->ppa_id = ppa_id;
- us->ppa = us;
- us->next = 0;
- us->nextppa = *usp;
- *usp = us;
- us->flags |= US_CONTROL;
- us->npmode = NPMODE_PASS;
-
- us->mtu = PPP_MTU;
- us->mru = PPP_MRU;
-
-#ifdef SOL2
- /*
- * Create a kstats record for our statistics, so netstat -i works.
- */
- if (us->kstats == 0) {
- char unit[32];
-
- sprintf(unit, "ppp%d", us->ppa->ppa_id);
- us->kstats = kstat_create("ppp", us->ppa->ppa_id, unit,
- "net", KSTAT_TYPE_NAMED, 4, 0);
- if (us->kstats != 0) {
- kstat_named_t *kn = KSTAT_NAMED_PTR(us->kstats);
-
- strcpy(kn[0].name, "ipackets");
- kn[0].data_type = KSTAT_DATA_ULONG;
- strcpy(kn[1].name, "ierrors");
- kn[1].data_type = KSTAT_DATA_ULONG;
- strcpy(kn[2].name, "opackets");
- kn[2].data_type = KSTAT_DATA_ULONG;
- strcpy(kn[3].name, "oerrors");
- kn[3].data_type = KSTAT_DATA_ULONG;
- kstat_install(us->kstats);
- }
- }
-#endif /* SOL2 */
-
- *(int *)mp->b_cont->b_rptr = ppa_id;
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
-}
-
-static void
-attach_ppa(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- upperstr_t *us, *t;
-
- us = (upperstr_t *) q->q_ptr;
- if (us == 0) {
- DPRINT("attach_ppa: q_ptr = 0!\n");
- return;
- }
-
-#ifndef NO_DLPI
- us->state = DL_UNBOUND;
-#endif
- for (t = us->ppa; t->next != 0; t = t->next)
- ;
- t->next = us;
- us->next = 0;
- if (mp->b_datap->db_type == M_IOCTL) {
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
- } else {
-#ifndef NO_DLPI
- dlpi_ok(q, DL_ATTACH_REQ);
-#endif
- }
-}
-
-static void
-detach_ppa(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- upperstr_t *us, *t;
-
- us = (upperstr_t *) q->q_ptr;
- if (us == 0) {
- DPRINT("detach_ppa: q_ptr = 0!\n");
- return;
- }
-
- for (t = us->ppa; t->next != 0; t = t->next)
- if (t->next == us) {
- t->next = us->next;
- break;
- }
- us->next = 0;
- us->ppa = 0;
-#ifndef NO_DLPI
- us->state = DL_UNATTACHED;
- dlpi_ok(q, DL_DETACH_REQ);
-#endif
-}
-
-/*
- * We call this with qwriter in order to give the upper queue procedures
- * the guarantee that the lower queue is not going to go away while
- * they are executing.
- */
-static void
-detach_lower(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- upperstr_t *us;
-
- us = (upperstr_t *) q->q_ptr;
- if (us == 0) {
- DPRINT("detach_lower: q_ptr = 0!\n");
- return;
- }
-
- LOCK_LOWER_W;
- us->lowerq->q_ptr = 0;
- RD(us->lowerq)->q_ptr = 0;
- us->lowerq = 0;
- UNLOCK_LOWER;
-
- /* Unblock streams which now feed back up the control stream. */
- qenable(us->q);
-
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
-}
-
-static int
-pppuwsrv(q)
- queue_t *q;
-{
- upperstr_t *us, *as;
- mblk_t *mp;
-
- us = (upperstr_t *) q->q_ptr;
- if (us == 0) {
- DPRINT("pppuwsrv: q_ptr = 0!\n");
- return 0;
- }
-
- /*
- * If this is a control stream, then this service procedure
- * probably got enabled because of flow control in the lower
- * stream being enabled (or because of the lower stream going
- * away). Therefore we enable the service procedure of all
- * attached upper streams.
- */
- if (us->flags & US_CONTROL) {
- for (as = us->next; as != 0; as = as->next)
- qenable(WR(as->q));
- }
-
- /* Try to send on any data queued here. */
- us->flags &= ~US_BLOCKED;
- while ((mp = getq(q)) != 0) {
- if (!send_data(mp, us)) {
- putbq(q, mp);
- break;
- }
- }
-
- return 0;
-}
-
-/* should never get called... */
-static int
-ppplwput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- putnext(q, mp);
- return 0;
-}
-
-static int
-ppplwsrv(q)
- queue_t *q;
-{
- queue_t *uq;
-
- /*
- * Flow control has back-enabled this stream:
- * enable the upper write service procedure for
- * the upper control stream for this lower stream.
- */
- LOCK_LOWER_R;
- uq = (queue_t *) q->q_ptr;
- if (uq != 0)
- qenable(uq);
- UNLOCK_LOWER;
- return 0;
-}
-
-/*
- * This should only get called for control streams.
- */
-static int
-pppurput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- upperstr_t *ppa, *us;
- int proto, len;
- struct iocblk *iop;
-
- ppa = (upperstr_t *) q->q_ptr;
- if (ppa == 0) {
- DPRINT("pppurput: q_ptr = 0!\n");
- return 0;
- }
-
- switch (mp->b_datap->db_type) {
- case M_CTL:
- MT_ENTER(&ppa->stats_lock);
- switch (*mp->b_rptr) {
- case PPPCTL_IERROR:
-#ifdef INCR_IERRORS
- INCR_IERRORS(ppa);
-#endif
- ppa->stats.ppp_ierrors++;
- break;
- case PPPCTL_OERROR:
-#ifdef INCR_OERRORS
- INCR_OERRORS(ppa);
-#endif
- ppa->stats.ppp_oerrors++;
- break;
- }
- MT_EXIT(&ppa->stats_lock);
- freemsg(mp);
- break;
-
- case M_IOCACK:
- case M_IOCNAK:
- /*
- * Attempt to match up the response with the stream
- * that the request came from.
- */
- iop = (struct iocblk *) mp->b_rptr;
- for (us = ppa; us != 0; us = us->next)
- if (us->ioc_id == iop->ioc_id)
- break;
- if (us == 0)
- freemsg(mp);
- else
- putnext(us->q, mp);
- break;
-
- case M_HANGUP:
- /*
- * The serial device has hung up. We don't want to send
- * the M_HANGUP message up to pppd because that will stop
- * us from using the control stream any more. Instead we
- * send a zero-length message as an end-of-file indication.
- */
- freemsg(mp);
- mp = allocb(1, BPRI_HI);
- if (mp == 0) {
- DPRINT1("ppp/%d: couldn't allocate eof message!\n", ppa->mn);
- break;
- }
- putnext(ppa->q, mp);
- break;
-
- default:
- if (mp->b_datap->db_type == M_DATA) {
- len = msgdsize(mp);
- if (mp->b_wptr - mp->b_rptr < PPP_HDRLEN) {
- PULLUP(mp, PPP_HDRLEN);
- if (mp == 0) {
- DPRINT1("ppp_urput: msgpullup failed (len=%d)\n", len);
- break;
- }
- }
- MT_ENTER(&ppa->stats_lock);
- ppa->stats.ppp_ipackets++;
- ppa->stats.ppp_ibytes += len;
-#ifdef INCR_IPACKETS
- INCR_IPACKETS(ppa);
-#endif
- MT_EXIT(&ppa->stats_lock);
-
- proto = PPP_PROTOCOL(mp->b_rptr);
-
-#if defined(SOL2)
- /*
- * Should there be any promiscuous stream(s), send the data
- * up for each promiscuous stream that we recognize.
- */
- promisc_sendup(ppa, mp, proto, 1);
-#endif /* defined(SOL2) */
-
- if (proto < 0x8000 && (us = find_dest(ppa, proto)) != 0) {
- /*
- * A data packet for some network protocol.
- * Queue it on the upper stream for that protocol.
- * XXX could we just putnext it? (would require thought)
- * The rblocked flag is there to ensure that we keep
- * messages in order for each network protocol.
- */
- if (!pass_packet(us, mp, 0))
- break;
- if (!us->rblocked && !canput(us->q))
- us->rblocked = 1;
- if (!us->rblocked)
- putq(us->q, mp);
- else
- putq(q, mp);
- break;
- }
- }
- /*
- * A control frame, a frame for an unknown protocol,
- * or some other message type.
- * Send it up to pppd via the control stream.
- */
- if (queclass(mp) == QPCTL || canputnext(ppa->q))
- putnext(ppa->q, mp);
- else
- putq(q, mp);
- break;
- }
-
- return 0;
-}
-
-static int
-pppursrv(q)
- queue_t *q;
-{
- upperstr_t *us, *as;
- mblk_t *mp, *hdr;
-#ifndef NO_DLPI
- dl_unitdata_ind_t *ud;
-#endif
- int proto;
-
- us = (upperstr_t *) q->q_ptr;
- if (us == 0) {
- DPRINT("pppursrv: q_ptr = 0!\n");
- return 0;
- }
-
- if (us->flags & US_CONTROL) {
- /*
- * A control stream.
- * If there is no lower queue attached, run the write service
- * routines of other upper streams attached to this PPA.
- */
- if (us->lowerq == 0) {
- as = us;
- do {
- if (as->flags & US_BLOCKED)
- qenable(WR(as->q));
- as = as->next;
- } while (as != 0);
- }
-
- /*
- * Messages get queued on this stream's read queue if they
- * can't be queued on the read queue of the attached stream
- * that they are destined for. This is for flow control -
- * when this queue fills up, the lower read put procedure will
- * queue messages there and the flow control will propagate
- * down from there.
- */
- while ((mp = getq(q)) != 0) {
- proto = PPP_PROTOCOL(mp->b_rptr);
- if (proto < 0x8000 && (as = find_dest(us, proto)) != 0) {
- if (!canput(as->q))
- break;
- putq(as->q, mp);
- } else {
- if (!canputnext(q))
- break;
- putnext(q, mp);
- }
- }
- if (mp) {
- putbq(q, mp);
- } else {
- /* can now put stuff directly on network protocol streams again */
- for (as = us->next; as != 0; as = as->next)
- as->rblocked = 0;
- }
-
- /*
- * If this stream has a lower stream attached,
- * enable the read queue's service routine.
- * XXX we should really only do this if the queue length
- * has dropped below the low-water mark.
- */
- if (us->lowerq != 0)
- qenable(RD(us->lowerq));
-
- } else {
- /*
- * A network protocol stream. Put a DLPI header on each
- * packet and send it on.
- * (Actually, it seems that the IP module will happily
- * accept M_DATA messages without the DL_UNITDATA_IND header.)
- */
- while ((mp = getq(q)) != 0) {
- if (!canputnext(q)) {
- putbq(q, mp);
- break;
- }
-#ifndef NO_DLPI
- proto = PPP_PROTOCOL(mp->b_rptr);
- mp->b_rptr += PPP_HDRLEN;
- hdr = allocb(sizeof(dl_unitdata_ind_t) + 2 * sizeof(uint),
- BPRI_MED);
- if (hdr == 0) {
- /* XXX should put it back and use bufcall */
- freemsg(mp);
- continue;
- }
- hdr->b_datap->db_type = M_PROTO;
- ud = (dl_unitdata_ind_t *) hdr->b_wptr;
- hdr->b_wptr += sizeof(dl_unitdata_ind_t) + 2 * sizeof(uint);
- hdr->b_cont = mp;
- ud->dl_primitive = DL_UNITDATA_IND;
- ud->dl_dest_addr_length = sizeof(uint);
- ud->dl_dest_addr_offset = sizeof(dl_unitdata_ind_t);
- ud->dl_src_addr_length = sizeof(uint);
- ud->dl_src_addr_offset = ud->dl_dest_addr_offset + sizeof(uint);
-#if DL_CURRENT_VERSION >= 2
- ud->dl_group_address = 0;
-#endif
- /* Send the DLPI client the data with the SAP they requested,
- (e.g. ETHERTYPE_IP) rather than the PPP protocol number
- (e.g. PPP_IP) */
- ((uint *)(ud + 1))[0] = us->req_sap; /* dest SAP */
- ((uint *)(ud + 1))[1] = us->req_sap; /* src SAP */
- putnext(q, hdr);
-#else /* NO_DLPI */
- putnext(q, mp);
-#endif /* NO_DLPI */
- }
- /*
- * Now that we have consumed some packets from this queue,
- * enable the control stream's read service routine so that we
- * can process any packets for us that might have got queued
- * there for flow control reasons.
- */
- if (us->ppa)
- qenable(us->ppa->q);
- }
-
- return 0;
-}
-
-static upperstr_t *
-find_dest(ppa, proto)
- upperstr_t *ppa;
- int proto;
-{
- upperstr_t *us;
-
- for (us = ppa->next; us != 0; us = us->next)
- if (proto == us->sap)
- break;
- return us;
-}
-
-#if defined (SOL2)
-/*
- * Test upstream promiscuous conditions. As of now, only pass IPv4 and
- * Ipv6 packets upstream (let PPP packets be decoded elsewhere).
- */
-static upperstr_t *
-find_promisc(us, proto)
- upperstr_t *us;
- int proto;
-{
-
- if ((proto != PPP_IP) && (proto != PPP_IPV6))
- return (upperstr_t *)0;
-
- for ( ; us; us = us->next) {
- if ((us->flags & US_PROMISC) && (us->state == DL_IDLE))
- return us;
- }
-
- return (upperstr_t *)0;
-}
-
-/*
- * Prepend an empty Ethernet header to msg for snoop, et al.
- */
-static mblk_t *
-prepend_ether(us, mp, proto)
- upperstr_t *us;
- mblk_t *mp;
- int proto;
-{
- mblk_t *eh;
- int type;
-
- if ((eh = allocb(sizeof(struct ether_header), BPRI_HI)) == 0) {
- freemsg(mp);
- return (mblk_t *)0;
- }
-
- if (proto == PPP_IP)
- type = ETHERTYPE_IP;
- else if (proto == PPP_IPV6)
- type = ETHERTYPE_IPV6;
- else
- type = proto; /* What else? Let decoder decide */
-
- eh->b_wptr += sizeof(struct ether_header);
- bzero((caddr_t)eh->b_rptr, sizeof(struct ether_header));
- ((struct ether_header *)eh->b_rptr)->ether_type = htons((short)type);
- eh->b_cont = mp;
- return (eh);
-}
-
-/*
- * Prepend DL_UNITDATA_IND mblk to msg
- */
-static mblk_t *
-prepend_udind(us, mp, proto)
- upperstr_t *us;
- mblk_t *mp;
- int proto;
-{
- dl_unitdata_ind_t *dlu;
- mblk_t *dh;
- size_t size;
-
- size = sizeof(dl_unitdata_ind_t);
- if ((dh = allocb(size, BPRI_MED)) == 0) {
- freemsg(mp);
- return (mblk_t *)0;
- }
-
- dh->b_datap->db_type = M_PROTO;
- dh->b_wptr = dh->b_datap->db_lim;
- dh->b_rptr = dh->b_wptr - size;
-
- dlu = (dl_unitdata_ind_t *)dh->b_rptr;
- dlu->dl_primitive = DL_UNITDATA_IND;
- dlu->dl_dest_addr_length = 0;
- dlu->dl_dest_addr_offset = sizeof(dl_unitdata_ind_t);
- dlu->dl_src_addr_length = 0;
- dlu->dl_src_addr_offset = sizeof(dl_unitdata_ind_t);
- dlu->dl_group_address = 0;
-
- dh->b_cont = mp;
- return (dh);
-}
-
-/*
- * For any recognized promiscuous streams, send data upstream
- */
-static void
-promisc_sendup(ppa, mp, proto, skip)
- upperstr_t *ppa;
- mblk_t *mp;
- int proto, skip;
-{
- mblk_t *dup_mp, *dup_dup_mp;
- upperstr_t *prus, *nprus;
-
- if ((prus = find_promisc(ppa, proto)) != 0) {
- if (dup_mp = dupmsg(mp)) {
-
- if (skip)
- dup_mp->b_rptr += PPP_HDRLEN;
-
- for ( ; nprus = find_promisc(prus->next, proto);
- prus = nprus) {
-
- if (dup_dup_mp = dupmsg(dup_mp)) {
- if (canputnext(prus->q)) {
- if (prus->flags & US_RAWDATA) {
- dup_dup_mp = prepend_ether(prus, dup_dup_mp, proto);
- putnext(prus->q, dup_dup_mp);
- } else {
- dup_dup_mp = prepend_udind(prus, dup_dup_mp, proto);
- putnext(prus->q, dup_dup_mp);
- }
- } else {
- DPRINT("ppp_urput: data to promisc q dropped\n");
- freemsg(dup_dup_mp);
- }
- }
- }
-
- if (canputnext(prus->q)) {
- if (prus->flags & US_RAWDATA) {
- dup_mp = prepend_ether(prus, dup_mp, proto);
- putnext(prus->q, dup_mp);
- } else {
- dup_mp = prepend_udind(prus, dup_mp, proto);
- putnext(prus->q, dup_mp);
- }
- } else {
- DPRINT("ppp_urput: data to promisc q dropped\n");
- freemsg(dup_mp);
- }
- }
- }
-}
-#endif /* defined(SOL2) */
-
-/*
- * We simply put the message on to the associated upper control stream
- * (either here or in ppplrsrv). That way we enter the perimeters
- * before looking through the list of attached streams to decide which
- * stream it should go up.
- */
-static int
-ppplrput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- queue_t *uq;
- struct iocblk *iop;
-
- switch (mp->b_datap->db_type) {
- case M_IOCTL:
- iop = (struct iocblk *) mp->b_rptr;
- iop->ioc_error = EINVAL;
- mp->b_datap->db_type = M_IOCNAK;
- qreply(q, mp);
- return 0;
- case M_FLUSH:
- if (*mp->b_rptr & FLUSHR)
- flushq(q, FLUSHDATA);
- if (*mp->b_rptr & FLUSHW) {
- *mp->b_rptr &= ~FLUSHR;
- qreply(q, mp);
- } else
- freemsg(mp);
- return 0;
- }
-
- /*
- * If we can't get the lower lock straight away, queue this one
- * rather than blocking, to avoid the possibility of deadlock.
- */
- if (!TRYLOCK_LOWER_R) {
- putq(q, mp);
- return 0;
- }
-
- /*
- * Check that we're still connected to the driver.
- */
- uq = (queue_t *) q->q_ptr;
- if (uq == 0) {
- UNLOCK_LOWER;
- DPRINT1("ppplrput: q = %x, uq = 0??\n", q);
- freemsg(mp);
- return 0;
- }
-
- /*
- * Try to forward the message to the put routine for the upper
- * control stream for this lower stream.
- * If there are already messages queued here, queue this one so
- * they don't get out of order.
- */
- if (queclass(mp) == QPCTL || (qsize(q) == 0 && canput(uq)))
- put(uq, mp);
- else
- putq(q, mp);
-
- UNLOCK_LOWER;
- return 0;
-}
-
-static int
-ppplrsrv(q)
- queue_t *q;
-{
- mblk_t *mp;
- queue_t *uq;
-
- /*
- * Packets get queued here for flow control reasons
- * or if the lrput routine couldn't get the lower lock
- * without blocking.
- */
- LOCK_LOWER_R;
- uq = (queue_t *) q->q_ptr;
- if (uq == 0) {
- UNLOCK_LOWER;
- flushq(q, FLUSHALL);
- DPRINT1("ppplrsrv: q = %x, uq = 0??\n", q);
- return 0;
- }
- while ((mp = getq(q)) != 0) {
- if (queclass(mp) == QPCTL || canput(uq))
- put(uq, mp);
- else {
- putbq(q, mp);
- break;
- }
- }
- UNLOCK_LOWER;
- return 0;
-}
-
-static int
-putctl2(q, type, code, val)
- queue_t *q;
- int type, code, val;
-{
- mblk_t *mp;
-
- mp = allocb(2, BPRI_HI);
- if (mp == 0)
- return 0;
- mp->b_datap->db_type = type;
- mp->b_wptr[0] = code;
- mp->b_wptr[1] = val;
- mp->b_wptr += 2;
- putnext(q, mp);
- return 1;
-}
-
-static int
-putctl4(q, type, code, val)
- queue_t *q;
- int type, code, val;
-{
- mblk_t *mp;
-
- mp = allocb(4, BPRI_HI);
- if (mp == 0)
- return 0;
- mp->b_datap->db_type = type;
- mp->b_wptr[0] = code;
- ((short *)mp->b_wptr)[1] = val;
- mp->b_wptr += 4;
- putnext(q, mp);
- return 1;
-}
-
-static void
-debug_dump(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- upperstr_t *us;
- queue_t *uq, *lq;
-
- DPRINT("ppp upper streams:\n");
- for (us = minor_devs; us != 0; us = us->nextmn) {
- uq = us->q;
- DPRINT3(" %d: q=%x rlev=%d",
- us->mn, uq, (uq? qsize(uq): 0));
- DPRINT3(" wlev=%d flags=0x%b", (uq? qsize(WR(uq)): 0),
- us->flags, "\020\1priv\2control\3blocked\4last");
- DPRINT3(" state=%x sap=%x req_sap=%x", us->state, us->sap,
- us->req_sap);
- if (us->ppa == 0)
- DPRINT(" ppa=?\n");
- else
- DPRINT1(" ppa=%d\n", us->ppa->ppa_id);
- if (us->flags & US_CONTROL) {
- lq = us->lowerq;
- DPRINT3(" control for %d lq=%x rlev=%d",
- us->ppa_id, lq, (lq? qsize(RD(lq)): 0));
- DPRINT3(" wlev=%d mru=%d mtu=%d\n",
- (lq? qsize(lq): 0), us->mru, us->mtu);
- }
- }
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
-}
-
-#ifdef FILTER_PACKETS
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/udp.h>
-#include <netinet/tcp.h>
-
-#define MAX_IPHDR 128 /* max TCP/IP header size */
-
-
-/* The following table contains a hard-coded list of protocol/port pairs.
- * Any matching packets are either discarded unconditionally, or,
- * if ok_if_link_up is non-zero when a connection does not currently exist
- * (i.e., they go through if the connection is present, but never initiate
- * a dial-out).
- * This idea came from a post by dm@garage.uun.org (David Mazieres)
- */
-static struct pktfilt_tab {
- int proto;
- u_short port;
- u_short ok_if_link_up;
-} pktfilt_tab[] = {
- { IPPROTO_UDP, 520, 1 }, /* RIP, ok to pass if link is up */
- { IPPROTO_UDP, 123, 1 }, /* NTP, don't keep up the link for it */
- { -1, 0, 0 } /* terminator entry has port == -1 */
-};
-
-
-static int
-ip_hard_filter(us, mp, outbound)
- upperstr_t *us;
- mblk_t *mp;
- int outbound;
-{
- struct ip *ip;
- struct pktfilt_tab *pft;
- mblk_t *temp_mp;
- int proto;
- int len, hlen;
-
-
- /* Note, the PPP header has already been pulled up in all cases */
- proto = PPP_PROTOCOL(mp->b_rptr);
- if (us->flags & US_DBGLOG)
- DPRINT3("ppp/%d: filter, proto=0x%x, out=%d\n", us->mn, proto, outbound);
-
- switch (proto)
- {
- case PPP_IP:
- if ((mp->b_wptr - mp->b_rptr) == PPP_HDRLEN && mp->b_cont != 0) {
- temp_mp = mp->b_cont;
- len = msgdsize(temp_mp);
- hlen = (len < MAX_IPHDR) ? len : MAX_IPHDR;
- PULLUP(temp_mp, hlen);
- if (temp_mp == 0) {
- DPRINT2("ppp/%d: filter, pullup next failed, len=%d\n",
- us->mn, hlen);
- mp->b_cont = 0; /* PULLUP() freed the rest */
- freemsg(mp);
- return 0;
- }
- ip = (struct ip *)mp->b_cont->b_rptr;
- }
- else {
- len = msgdsize(mp);
- hlen = (len < (PPP_HDRLEN+MAX_IPHDR)) ? len : (PPP_HDRLEN+MAX_IPHDR);
- PULLUP(mp, hlen);
- if (mp == 0) {
- DPRINT2("ppp/%d: filter, pullup failed, len=%d\n",
- us->mn, hlen);
- return 0;
- }
- ip = (struct ip *)(mp->b_rptr + PPP_HDRLEN);
- }
-
- /* For IP traffic, certain packets (e.g., RIP) may be either
- * 1. ignored - dropped completely
- * 2. will not initiate a connection, but
- * will be passed if a connection is currently up.
- */
- for (pft=pktfilt_tab; pft->proto != -1; pft++) {
- if (ip->ip_p == pft->proto) {
- switch(pft->proto) {
- case IPPROTO_UDP:
- if (((struct udphdr *) &((int *)ip)[ip->ip_hl])->uh_dport
- == htons(pft->port)) goto endfor;
- break;
- case IPPROTO_TCP:
- if (((struct tcphdr *) &((int *)ip)[ip->ip_hl])->th_dport
- == htons(pft->port)) goto endfor;
- break;
- }
- }
- }
- endfor:
- if (pft->proto != -1) {
- if (us->flags & US_DBGLOG)
- DPRINT3("ppp/%d: found IP pkt, proto=0x%x (%d)\n",
- us->mn, pft->proto, pft->port);
- /* Discard if not connected, or if not pass_with_link_up */
- /* else, if link is up let go by, but don't update time */
- return pft->ok_if_link_up? -1: 0;
- }
- break;
- } /* end switch (proto) */
-
- return 1;
-}
-#endif /* FILTER_PACKETS */
-
diff --git a/mdk-stage1/ppp/modules/ppp_ahdlc.c b/mdk-stage1/ppp/modules/ppp_ahdlc.c
deleted file mode 100644
index d0b961258..000000000
--- a/mdk-stage1/ppp/modules/ppp_ahdlc.c
+++ /dev/null
@@ -1,878 +0,0 @@
-/*
- * ppp_ahdlc.c - STREAMS module for doing PPP asynchronous HDLC.
- *
- * Re-written by Adi Masputra <adi.masputra@sun.com>, based on
- * the original ppp_ahdlc.c
- *
- * Copyright (c) 2000 by Sun Microsystems, Inc.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies.
- *
- * SUN MAKES NO REPRESENTATION OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-/*
- * This file is used under Solaris 2, SVR4, SunOS 4, and Digital UNIX.
- */
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/stream.h>
-#include <sys/errno.h>
-
-#ifdef SVR4
-#include <sys/conf.h>
-#include <sys/kmem.h>
-#include <sys/cmn_err.h>
-#include <sys/ddi.h>
-#else
-#include <sys/user.h>
-#ifdef __osf__
-#include <sys/cmn_err.h>
-#endif
-#endif /* SVR4 */
-
-#include <net/ppp_defs.h>
-#include <net/pppio.h>
-#include "ppp_mod.h"
-
-/*
- * Right now, mutex is only enabled for Solaris 2.x
- */
-#if defined(SOL2)
-#define USE_MUTEX
-#endif /* SOL2 */
-
-/*
- * intpointer_t and uintpointer_t are signed and unsigned integer types
- * large enough to hold any data pointer; that is, data pointers can be
- * assigned into or from these integer types without losing precision.
- * On recent Solaris releases, these types are defined in sys/int_types.h,
- * but not on SunOS 4.x or the earlier Solaris versions.
- */
-#if defined(_LP64) || defined(_I32LPx)
-typedef long intpointer_t;
-typedef unsigned long uintpointer_t;
-#else
-typedef int intpointer_t;
-typedef unsigned int uintpointer_t;
-#endif
-
-MOD_OPEN_DECL(ahdlc_open);
-MOD_CLOSE_DECL(ahdlc_close);
-static int ahdlc_wput __P((queue_t *, mblk_t *));
-static int ahdlc_rput __P((queue_t *, mblk_t *));
-static void ahdlc_encode __P((queue_t *, mblk_t *));
-static void ahdlc_decode __P((queue_t *, mblk_t *));
-static int msg_byte __P((mblk_t *, unsigned int));
-
-#if defined(SOL2)
-/*
- * Don't send HDLC start flag is last transmit is within 1.5 seconds -
- * FLAG_TIME is defined is microseconds
- */
-#define FLAG_TIME 1500
-#define ABS(x) (x >= 0 ? x : (-x))
-#endif /* SOL2 */
-
-/*
- * Extract byte i of message mp
- */
-#define MSG_BYTE(mp, i) ((i) < (mp)->b_wptr - (mp)->b_rptr? (mp)->b_rptr[i]: \
- msg_byte((mp), (i)))
-
-/*
- * Is this LCP packet one we have to transmit using LCP defaults?
- */
-#define LCP_USE_DFLT(mp) (1 <= (code = MSG_BYTE((mp), 4)) && code <= 7)
-
-/*
- * Standard STREAMS declarations
- */
-static struct module_info minfo = {
- 0x7d23, "ppp_ahdl", 0, INFPSZ, 32768, 512
-};
-
-static struct qinit rinit = {
- ahdlc_rput, NULL, ahdlc_open, ahdlc_close, NULL, &minfo, NULL
-};
-
-static struct qinit winit = {
- ahdlc_wput, NULL, NULL, NULL, NULL, &minfo, NULL
-};
-
-#if defined(SVR4) && !defined(SOL2)
-int phdldevflag = 0;
-#define ppp_ahdlcinfo phdlinfo
-#endif /* defined(SVR4) && !defined(SOL2) */
-
-struct streamtab ppp_ahdlcinfo = {
- &rinit, /* ptr to st_rdinit */
- &winit, /* ptr to st_wrinit */
- NULL, /* ptr to st_muxrinit */
- NULL, /* ptr to st_muxwinit */
-#if defined(SUNOS4)
- NULL /* ptr to ptr to st_modlist */
-#endif /* SUNOS4 */
-};
-
-#if defined(SUNOS4)
-int ppp_ahdlc_count = 0; /* open counter */
-#endif /* SUNOS4 */
-
-/*
- * Per-stream state structure
- */
-typedef struct ahdlc_state {
-#if defined(USE_MUTEX)
- kmutex_t lock; /* lock for this structure */
-#endif /* USE_MUTEX */
- int flags; /* link flags */
- mblk_t *rx_buf; /* ptr to receive buffer */
- int rx_buf_size; /* receive buffer size */
- ushort_t infcs; /* calculated rx HDLC FCS */
- u_int32_t xaccm[8]; /* 256-bit xmit ACCM */
- u_int32_t raccm; /* 32-bit rcv ACCM */
- int mtu; /* interface MTU */
- int mru; /* link MRU */
- int unit; /* current PPP unit number */
- struct pppstat stats; /* statistic structure */
-#if defined(SOL2)
- clock_t flag_time; /* time in usec between flags */
- clock_t lbolt; /* last updated lbolt */
-#endif /* SOL2 */
-} ahdlc_state_t;
-
-/*
- * Values for flags
- */
-#define ESCAPED 0x100 /* last saw escape char on input */
-#define IFLUSH 0x200 /* flushing input due to error */
-
-/*
- * RCV_B7_1, etc., defined in net/pppio.h, are stored in flags also.
- */
-#define RCV_FLAGS (RCV_B7_1|RCV_B7_0|RCV_ODDP|RCV_EVNP)
-
-/*
- * FCS lookup table as calculated by genfcstab.
- */
-static u_short fcstab[256] = {
- 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
- 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
- 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
- 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
- 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
- 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
- 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
- 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
- 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
- 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
- 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
- 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
- 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
- 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
- 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
- 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
- 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
- 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
- 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
- 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
- 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
- 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
- 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
- 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
- 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
- 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
- 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
- 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
- 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
- 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
- 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
- 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
-};
-
-static u_int32_t paritytab[8] =
-{
- 0x96696996, 0x69969669, 0x69969669, 0x96696996,
- 0x69969669, 0x96696996, 0x96696996, 0x69969669
-};
-
-/*
- * STREAMS module open (entry) point
- */
-MOD_OPEN(ahdlc_open)
-{
- ahdlc_state_t *state;
-
- /*
- * Return if it's already opened
- */
- if (q->q_ptr) {
- return 0;
- }
-
- /*
- * This can only be opened as a module
- */
- if (sflag != MODOPEN) {
- return 0;
- }
-
- state = (ahdlc_state_t *) ALLOC_NOSLEEP(sizeof(ahdlc_state_t));
- if (state == 0)
- OPEN_ERROR(ENOSR);
- bzero((caddr_t) state, sizeof(ahdlc_state_t));
-
- q->q_ptr = (caddr_t) state;
- WR(q)->q_ptr = (caddr_t) state;
-
-#if defined(USE_MUTEX)
- mutex_init(&state->lock, NULL, MUTEX_DEFAULT, NULL);
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
-
- state->xaccm[0] = ~0; /* escape 0x00 through 0x1f */
- state->xaccm[3] = 0x60000000; /* escape 0x7d and 0x7e */
- state->mru = PPP_MRU; /* default of 1500 bytes */
-#if defined(SOL2)
- state->flag_time = drv_usectohz(FLAG_TIME);
-#endif /* SOL2 */
-
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
-
-#if defined(SUNOS4)
- ppp_ahdlc_count++;
-#endif /* SUNOS4 */
-
- qprocson(q);
-
- return 0;
-}
-
-/*
- * STREAMS module close (exit) point
- */
-MOD_CLOSE(ahdlc_close)
-{
- ahdlc_state_t *state;
-
- qprocsoff(q);
-
- state = (ahdlc_state_t *) q->q_ptr;
-
- if (state == 0) {
- DPRINT("state == 0 in ahdlc_close\n");
- return 0;
- }
-
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
-
- if (state->rx_buf != 0) {
- freemsg(state->rx_buf);
- state->rx_buf = 0;
- }
-
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
- mutex_destroy(&state->lock);
-#endif /* USE_MUTEX */
-
- FREE(q->q_ptr, sizeof(ahdlc_state_t));
- q->q_ptr = NULL;
- OTHERQ(q)->q_ptr = NULL;
-
-#if defined(SUNOS4)
- if (ppp_ahdlc_count)
- ppp_ahdlc_count--;
-#endif /* SUNOS4 */
-
- return 0;
-}
-
-/*
- * Write side put routine
- */
-static int
-ahdlc_wput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- ahdlc_state_t *state;
- struct iocblk *iop;
- int error;
- mblk_t *np;
- struct ppp_stats *psp;
-
- state = (ahdlc_state_t *) q->q_ptr;
- if (state == 0) {
- DPRINT("state == 0 in ahdlc_wput\n");
- freemsg(mp);
- return 0;
- }
-
- switch (mp->b_datap->db_type) {
- case M_DATA:
- /*
- * A data packet - do character-stuffing and FCS, and
- * send it onwards.
- */
- ahdlc_encode(q, mp);
- freemsg(mp);
- break;
-
- case M_IOCTL:
- iop = (struct iocblk *) mp->b_rptr;
- error = EINVAL;
- switch (iop->ioc_cmd) {
- case PPPIO_XACCM:
- if ((iop->ioc_count < sizeof(u_int32_t)) ||
- (iop->ioc_count > sizeof(ext_accm))) {
- break;
- }
- if (mp->b_cont == 0) {
- DPRINT1("ahdlc_wput/%d: PPPIO_XACCM b_cont = 0!\n", state->unit);
- break;
- }
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
- bcopy((caddr_t)mp->b_cont->b_rptr, (caddr_t)state->xaccm,
- iop->ioc_count);
- state->xaccm[2] &= ~0x40000000; /* don't escape 0x5e */
- state->xaccm[3] |= 0x60000000; /* do escape 0x7d, 0x7e */
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- iop->ioc_count = 0;
- error = 0;
- break;
-
- case PPPIO_RACCM:
- if (iop->ioc_count != sizeof(u_int32_t))
- break;
- if (mp->b_cont == 0) {
- DPRINT1("ahdlc_wput/%d: PPPIO_RACCM b_cont = 0!\n", state->unit);
- break;
- }
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
- bcopy((caddr_t)mp->b_cont->b_rptr, (caddr_t)&state->raccm,
- sizeof(u_int32_t));
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- iop->ioc_count = 0;
- error = 0;
- break;
-
- case PPPIO_GCLEAN:
- np = allocb(sizeof(int), BPRI_HI);
- if (np == 0) {
- error = ENOSR;
- break;
- }
- if (mp->b_cont != 0)
- freemsg(mp->b_cont);
- mp->b_cont = np;
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
- *(int *)np->b_wptr = state->flags & RCV_FLAGS;
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- np->b_wptr += sizeof(int);
- iop->ioc_count = sizeof(int);
- error = 0;
- break;
-
- case PPPIO_GETSTAT:
- np = allocb(sizeof(struct ppp_stats), BPRI_HI);
- if (np == 0) {
- error = ENOSR;
- break;
- }
- if (mp->b_cont != 0)
- freemsg(mp->b_cont);
- mp->b_cont = np;
- psp = (struct ppp_stats *) np->b_wptr;
- np->b_wptr += sizeof(struct ppp_stats);
- bzero((caddr_t)psp, sizeof(struct ppp_stats));
- psp->p = state->stats;
- iop->ioc_count = sizeof(struct ppp_stats);
- error = 0;
- break;
-
- case PPPIO_LASTMOD:
- /* we knew this anyway */
- error = 0;
- break;
-
- default:
- error = -1;
- break;
- }
-
- if (error < 0)
- putnext(q, mp);
- else if (error == 0) {
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
- } else {
- mp->b_datap->db_type = M_IOCNAK;
- iop->ioc_count = 0;
- iop->ioc_error = error;
- qreply(q, mp);
- }
- break;
-
- case M_CTL:
- switch (*mp->b_rptr) {
- case PPPCTL_MTU:
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
- state->mtu = ((unsigned short *)mp->b_rptr)[1];
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- freemsg(mp);
- break;
- case PPPCTL_MRU:
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
- state->mru = ((unsigned short *)mp->b_rptr)[1];
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- freemsg(mp);
- break;
- case PPPCTL_UNIT:
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
- state->unit = mp->b_rptr[1];
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- break;
- default:
- putnext(q, mp);
- }
- break;
-
- default:
- putnext(q, mp);
- }
-
- return 0;
-}
-
-/*
- * Read side put routine
- */
-static int
-ahdlc_rput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- ahdlc_state_t *state;
-
- state = (ahdlc_state_t *) q->q_ptr;
- if (state == 0) {
- DPRINT("state == 0 in ahdlc_rput\n");
- freemsg(mp);
- return 0;
- }
-
- switch (mp->b_datap->db_type) {
- case M_DATA:
- ahdlc_decode(q, mp);
- freemsg(mp);
- break;
-
- case M_HANGUP:
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
- if (state->rx_buf != 0) {
- /* XXX would like to send this up for debugging */
- freemsg(state->rx_buf);
- state->rx_buf = 0;
- }
- state->flags = IFLUSH;
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- putnext(q, mp);
- break;
-
- default:
- putnext(q, mp);
- }
- return 0;
-}
-
-/*
- * Extract bit c from map m, to determine if c needs to be escaped
- */
-#define IN_TX_MAP(c, m) ((m)[(c) >> 5] & (1 << ((c) & 0x1f)))
-
-static void
-ahdlc_encode(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- ahdlc_state_t *state;
- u_int32_t *xaccm, loc_xaccm[8];
- ushort_t fcs;
- size_t outmp_len;
- mblk_t *outmp, *tmp;
- uchar_t *dp, fcs_val;
- int is_lcp, code;
-#if defined(SOL2)
- clock_t lbolt;
-#endif /* SOL2 */
-
- if (msgdsize(mp) < 4) {
- return;
- }
-
- state = (ahdlc_state_t *)q->q_ptr;
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
-
- /*
- * Allocate an output buffer large enough to handle a case where all
- * characters need to be escaped
- */
- outmp_len = (msgdsize(mp) << 1) + /* input block x 2 */
- (sizeof(fcs) << 2) + /* HDLC FCS x 4 */
- (sizeof(uchar_t) << 1); /* HDLC flags x 2 */
-
- outmp = allocb(outmp_len, BPRI_MED);
- if (outmp == NULL) {
- state->stats.ppp_oerrors++;
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
- putctl1(RD(q)->q_next, M_CTL, PPPCTL_OERROR);
- return;
- }
-
-#if defined(SOL2)
- /*
- * Check if our last transmit happenned within flag_time, using
- * the system's LBOLT value in clock ticks
- */
- if (drv_getparm(LBOLT, &lbolt) != -1) {
- if (ABS((clock_t)lbolt - state->lbolt) > state->flag_time) {
- *outmp->b_wptr++ = PPP_FLAG;
- }
- state->lbolt = lbolt;
- } else {
- *outmp->b_wptr++ = PPP_FLAG;
- }
-#else
- /*
- * If the driver below still has a message to process, skip the
- * HDLC flag, otherwise, put one in the beginning
- */
- if (qsize(q->q_next) == 0) {
- *outmp->b_wptr++ = PPP_FLAG;
- }
-#endif
-
- /*
- * All control characters must be escaped for LCP packets with code
- * values between 1 (Conf-Req) and 7 (Code-Rej).
- */
- is_lcp = ((MSG_BYTE(mp, 0) == PPP_ALLSTATIONS) &&
- (MSG_BYTE(mp, 1) == PPP_UI) &&
- (MSG_BYTE(mp, 2) == (PPP_LCP >> 8)) &&
- (MSG_BYTE(mp, 3) == (PPP_LCP & 0xff)) &&
- LCP_USE_DFLT(mp));
-
- xaccm = state->xaccm;
- if (is_lcp) {
- bcopy((caddr_t)state->xaccm, (caddr_t)loc_xaccm, sizeof(loc_xaccm));
- loc_xaccm[0] = ~0; /* force escape on 0x00 through 0x1f */
- xaccm = loc_xaccm;
- }
-
- fcs = PPP_INITFCS; /* Initial FCS is 0xffff */
-
- /*
- * Process this block and the rest (if any) attached to the this one
- */
- for (tmp = mp; tmp; tmp = tmp->b_cont) {
- if (tmp->b_datap->db_type == M_DATA) {
- for (dp = tmp->b_rptr; dp < tmp->b_wptr; dp++) {
- fcs = PPP_FCS(fcs, *dp);
- if (IN_TX_MAP(*dp, xaccm)) {
- *outmp->b_wptr++ = PPP_ESCAPE;
- *outmp->b_wptr++ = *dp ^ PPP_TRANS;
- } else {
- *outmp->b_wptr++ = *dp;
- }
- }
- } else {
- continue; /* skip if db_type is something other than M_DATA */
- }
- }
-
- /*
- * Append the HDLC FCS, making sure that escaping is done on any
- * necessary bytes
- */
- fcs_val = (fcs ^ 0xffff) & 0xff;
- if (IN_TX_MAP(fcs_val, xaccm)) {
- *outmp->b_wptr++ = PPP_ESCAPE;
- *outmp->b_wptr++ = fcs_val ^ PPP_TRANS;
- } else {
- *outmp->b_wptr++ = fcs_val;
- }
-
- fcs_val = ((fcs ^ 0xffff) >> 8) & 0xff;
- if (IN_TX_MAP(fcs_val, xaccm)) {
- *outmp->b_wptr++ = PPP_ESCAPE;
- *outmp->b_wptr++ = fcs_val ^ PPP_TRANS;
- } else {
- *outmp->b_wptr++ = fcs_val;
- }
-
- /*
- * And finally, append the HDLC flag, and send it away
- */
- *outmp->b_wptr++ = PPP_FLAG;
-
- state->stats.ppp_obytes += msgdsize(outmp);
- state->stats.ppp_opackets++;
-
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
-
- putnext(q, outmp);
- return;
-}
-
-/*
- * Checks the 32-bit receive ACCM to see if the byte needs un-escaping
- */
-#define IN_RX_MAP(c, m) ((((unsigned int) (uchar_t) (c)) < 0x20) && \
- (m) & (1 << (c)))
-
-
-/*
- * Process received characters.
- */
-static void
-ahdlc_decode(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- ahdlc_state_t *state;
- mblk_t *om;
- uchar_t *dp;
- ushort_t fcs;
-#if defined(SOL2)
- mblk_t *zmp;
-#endif /* SOL2 */
-
-#if defined(SOL2)
- /*
- * In case the driver (or something below) doesn't send
- * data upstream in one message block, concatenate everything
- */
- if (!((mp->b_wptr - mp->b_rptr == msgdsize(mp)) &&
- ((intpointer_t)mp->b_rptr % sizeof(intpointer_t) == 0))) {
-
- zmp = msgpullup(mp, -1);
- freemsg(mp);
- mp = zmp;
- if (mp == 0)
- return;
- }
-#endif /* SOL2 */
-
- state = (ahdlc_state_t *) q->q_ptr;
-
-#if defined(USE_MUTEX)
- mutex_enter(&state->lock);
-#endif /* USE_MUTEX */
-
- state->stats.ppp_ibytes += msgdsize(mp);
-
- for (dp = mp->b_rptr; dp < mp->b_wptr; dp++) {
-
- /*
- * This should detect the lack of 8-bit communication channel
- * which is necessary for PPP to work. In addition, it also
- * checks on the parity.
- */
- if (*dp & 0x80)
- state->flags |= RCV_B7_1;
- else
- state->flags |= RCV_B7_0;
-
- if (paritytab[*dp >> 5] & (1 << (*dp & 0x1f)))
- state->flags |= RCV_ODDP;
- else
- state->flags |= RCV_EVNP;
-
- /*
- * So we have a HDLC flag ...
- */
- if (*dp == PPP_FLAG) {
-
- /*
- * If we think that it marks the beginning of the frame,
- * then continue to process the next octects
- */
- if ((state->flags & IFLUSH) ||
- (state->rx_buf == 0) ||
- (msgdsize(state->rx_buf) == 0)) {
-
- state->flags &= ~IFLUSH;
- continue;
- }
-
- /*
- * We get here because the above condition isn't true,
- * in which case the HDLC flag was there to mark the end
- * of the frame (or so we think)
- */
- om = state->rx_buf;
-
- if (state->infcs == PPP_GOODFCS) {
- state->stats.ppp_ipackets++;
- adjmsg(om, -PPP_FCSLEN);
- putnext(q, om);
- } else {
- DPRINT2("ppp%d: bad fcs (len=%d)\n",
- state->unit, msgdsize(state->rx_buf));
- freemsg(state->rx_buf);
- state->flags &= ~(IFLUSH | ESCAPED);
- state->stats.ppp_ierrors++;
- putctl1(q->q_next, M_CTL, PPPCTL_IERROR);
- }
-
- state->rx_buf = 0;
- continue;
- }
-
- if (state->flags & IFLUSH) {
- continue;
- }
-
- /*
- * Allocate a receive buffer, large enough to store a frame (after
- * un-escaping) of at least 1500 octets. If MRU is negotiated to
- * be more than the default, then allocate that much. In addition,
- * we add an extra 32-bytes for a fudge factor
- */
- if (state->rx_buf == 0) {
- state->rx_buf_size = (state->mru < PPP_MRU ? PPP_MRU : state->mru);
- state->rx_buf_size += (sizeof(u_int32_t) << 3);
- state->rx_buf = allocb(state->rx_buf_size, BPRI_MED);
-
- /*
- * If allocation fails, try again on the next frame
- */
- if (state->rx_buf == 0) {
- state->flags |= IFLUSH;
- continue;
- }
- state->flags &= ~(IFLUSH | ESCAPED);
- state->infcs = PPP_INITFCS;
- }
-
- if (*dp == PPP_ESCAPE) {
- state->flags |= ESCAPED;
- continue;
- }
-
- /*
- * Make sure we un-escape the necessary characters, as well as the
- * ones in our receive async control character map
- */
- if (state->flags & ESCAPED) {
- *dp ^= PPP_TRANS;
- state->flags &= ~ESCAPED;
- } else if (IN_RX_MAP(*dp, state->raccm))
- continue;
-
- /*
- * Unless the peer lied to us about the negotiated MRU, we should
- * never get a frame which is too long. If it happens, toss it away
- * and grab the next incoming one
- */
- if (msgdsize(state->rx_buf) < state->rx_buf_size) {
- state->infcs = PPP_FCS(state->infcs, *dp);
- *state->rx_buf->b_wptr++ = *dp;
- } else {
- DPRINT2("ppp%d: frame too long (%d)\n",
- state->unit, msgdsize(state->rx_buf));
- freemsg(state->rx_buf);
- state->rx_buf = 0;
- state->flags |= IFLUSH;
- }
- }
-
-#if defined(USE_MUTEX)
- mutex_exit(&state->lock);
-#endif /* USE_MUTEX */
-}
-
-static int
-msg_byte(mp, i)
- mblk_t *mp;
- unsigned int i;
-{
- while (mp != 0 && i >= mp->b_wptr - mp->b_rptr)
- mp = mp->b_cont;
- if (mp == 0)
- return -1;
- return mp->b_rptr[i];
-}
diff --git a/mdk-stage1/ppp/modules/ppp_comp.c b/mdk-stage1/ppp/modules/ppp_comp.c
deleted file mode 100644
index f6eef5ab1..000000000
--- a/mdk-stage1/ppp/modules/ppp_comp.c
+++ /dev/null
@@ -1,1126 +0,0 @@
-/*
- * ppp_comp.c - STREAMS module for kernel-level compression and CCP support.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-/*
- * This file is used under SVR4, Solaris 2, SunOS 4, and Digital UNIX.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/errno.h>
-#include <sys/stream.h>
-
-#ifdef SVR4
-#include <sys/conf.h>
-#include <sys/cmn_err.h>
-#include <sys/ddi.h>
-#else
-#include <sys/user.h>
-#ifdef __osf__
-#include <sys/cmn_err.h>
-#endif
-#endif /* SVR4 */
-
-#include <net/ppp_defs.h>
-#include <net/pppio.h>
-#include "ppp_mod.h"
-
-#ifdef __osf__
-#include <sys/mbuf.h>
-#include <sys/protosw.h>
-#endif
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <net/vjcompress.h>
-
-#define PACKETPTR mblk_t *
-#include <net/ppp-comp.h>
-
-MOD_OPEN_DECL(ppp_comp_open);
-MOD_CLOSE_DECL(ppp_comp_close);
-static int ppp_comp_rput __P((queue_t *, mblk_t *));
-static int ppp_comp_rsrv __P((queue_t *));
-static int ppp_comp_wput __P((queue_t *, mblk_t *));
-static int ppp_comp_wsrv __P((queue_t *));
-static void ppp_comp_ccp __P((queue_t *, mblk_t *, int));
-static int msg_byte __P((mblk_t *, unsigned int));
-
-/* Extract byte i of message mp. */
-#define MSG_BYTE(mp, i) ((i) < (mp)->b_wptr - (mp)->b_rptr? (mp)->b_rptr[i]: \
- msg_byte((mp), (i)))
-
-/* Is this LCP packet one we have to transmit using LCP defaults? */
-#define LCP_USE_DFLT(mp) (1 <= (code = MSG_BYTE((mp), 4)) && code <= 7)
-
-#define PPP_COMP_ID 0xbadf
-static struct module_info minfo = {
-#ifdef PRIOQ
- PPP_COMP_ID, "ppp_comp", 0, INFPSZ, 16512, 16384,
-#else
- PPP_COMP_ID, "ppp_comp", 0, INFPSZ, 16384, 4096,
-#endif
-};
-
-static struct qinit r_init = {
- ppp_comp_rput, ppp_comp_rsrv, ppp_comp_open, ppp_comp_close,
- NULL, &minfo, NULL
-};
-
-static struct qinit w_init = {
- ppp_comp_wput, ppp_comp_wsrv, NULL, NULL, NULL, &minfo, NULL
-};
-
-#if defined(SVR4) && !defined(SOL2)
-int pcmpdevflag = 0;
-#define ppp_compinfo pcmpinfo
-#endif
-struct streamtab ppp_compinfo = {
- &r_init, &w_init, NULL, NULL
-};
-
-int ppp_comp_count; /* number of module instances in use */
-
-#ifdef __osf__
-
-static void ppp_comp_alloc __P((comp_state_t *));
-typedef struct memreq {
- unsigned char comp_opts[20];
- int cmd;
- int thread_status;
- char *returned_mem;
-} memreq_t;
-
-#endif
-
-typedef struct comp_state {
- int flags;
- int mru;
- int mtu;
- int unit;
- struct compressor *xcomp;
- void *xstate;
- struct compressor *rcomp;
- void *rstate;
- struct vjcompress vj_comp;
- int vj_last_ierrors;
- struct pppstat stats;
-#ifdef __osf__
- memreq_t memreq;
- thread_t thread;
-#endif
-} comp_state_t;
-
-
-#ifdef __osf__
-extern task_t first_task;
-#endif
-
-/* Bits in flags are as defined in pppio.h. */
-#define CCP_ERR (CCP_ERROR | CCP_FATALERROR)
-#define LAST_MOD 0x1000000 /* no ppp modules below us */
-#define DBGLOG 0x2000000 /* log debugging stuff */
-
-#define MAX_IPHDR 128 /* max TCP/IP header size */
-#define MAX_VJHDR 20 /* max VJ compressed header size (?) */
-
-#undef MIN /* just in case */
-#define MIN(a, b) ((a) < (b)? (a): (b))
-
-/*
- * List of compressors we know about.
- */
-
-#if DO_BSD_COMPRESS
-extern struct compressor ppp_bsd_compress;
-#endif
-#if DO_DEFLATE
-extern struct compressor ppp_deflate, ppp_deflate_draft;
-#endif
-
-struct compressor *ppp_compressors[] = {
-#if DO_BSD_COMPRESS
- &ppp_bsd_compress,
-#endif
-#if DO_DEFLATE
- &ppp_deflate,
- &ppp_deflate_draft,
-#endif
- NULL
-};
-
-/*
- * STREAMS module entry points.
- */
-MOD_OPEN(ppp_comp_open)
-{
- comp_state_t *cp;
-#ifdef __osf__
- thread_t thread;
-#endif
-
- if (q->q_ptr == NULL) {
- cp = (comp_state_t *) ALLOC_SLEEP(sizeof(comp_state_t));
- if (cp == NULL)
- OPEN_ERROR(ENOSR);
- bzero((caddr_t)cp, sizeof(comp_state_t));
- WR(q)->q_ptr = q->q_ptr = (caddr_t) cp;
- cp->mru = PPP_MRU;
- cp->mtu = PPP_MTU;
- cp->xstate = NULL;
- cp->rstate = NULL;
- vj_compress_init(&cp->vj_comp, -1);
-#ifdef __osf__
- if (!(thread = kernel_thread_w_arg(first_task, ppp_comp_alloc, (void *)cp)))
- OPEN_ERROR(ENOSR);
- cp->thread = thread;
-#endif
- ++ppp_comp_count;
- qprocson(q);
- }
- return 0;
-}
-
-MOD_CLOSE(ppp_comp_close)
-{
- comp_state_t *cp;
-
- qprocsoff(q);
- cp = (comp_state_t *) q->q_ptr;
- if (cp != NULL) {
- if (cp->xstate != NULL)
- (*cp->xcomp->comp_free)(cp->xstate);
- if (cp->rstate != NULL)
- (*cp->rcomp->decomp_free)(cp->rstate);
-#ifdef __osf__
- if (!cp->thread)
- printf("ppp_comp_close: NULL thread!\n");
- else
- thread_terminate(cp->thread);
-#endif
- FREE(cp, sizeof(comp_state_t));
- q->q_ptr = NULL;
- OTHERQ(q)->q_ptr = NULL;
- --ppp_comp_count;
- }
- return 0;
-}
-
-#ifdef __osf__
-
-/* thread for calling back to a compressor's memory allocator
- * Needed for Digital UNIX since it's VM can't handle requests
- * for large amounts of memory without blocking. The thread
- * provides a context in which we can call a memory allocator
- * that may block.
- */
-static void
-ppp_comp_alloc(comp_state_t *cp)
-{
- int len, cmd;
- unsigned char *compressor_options;
- thread_t thread;
- void *(*comp_allocator)();
-
-
-#if defined(MAJOR_VERSION) && (MAJOR_VERSION <= 2)
-
- /* In 2.x and earlier the argument gets passed
- * in the thread structure itself. Yuck.
- */
- thread = current_thread();
- cp = thread->reply_port;
- thread->reply_port = PORT_NULL;
-
-#endif
-
- for (;;) {
- assert_wait((vm_offset_t)&cp->memreq.thread_status, TRUE);
- thread_block();
-
- if (thread_should_halt(current_thread()))
- thread_halt_self();
- cmd = cp->memreq.cmd;
- compressor_options = &cp->memreq.comp_opts[0];
- len = compressor_options[1];
- if (cmd == PPPIO_XCOMP) {
- cp->memreq.returned_mem = cp->xcomp->comp_alloc(compressor_options, len);
- if (!cp->memreq.returned_mem) {
- cp->memreq.thread_status = ENOSR;
- } else {
- cp->memreq.thread_status = 0;
- }
- } else {
- cp->memreq.returned_mem = cp->rcomp->decomp_alloc(compressor_options, len);
- if (!cp->memreq.returned_mem) {
- cp->memreq.thread_status = ENOSR;
- } else {
- cp->memreq.thread_status = 0;
- }
- }
- }
-}
-
-#endif /* __osf__ */
-
-/* here's the deal with memory allocation under Digital UNIX.
- * Some other may also benefit from this...
- * We can't ask for huge chunks of memory in a context where
- * the caller can't be put to sleep (like, here.) The alloc
- * is likely to fail. Instead we do this: the first time we
- * get called, kick off a thread to do the allocation. Return
- * immediately to the caller with EAGAIN, as an indication that
- * they should send down the ioctl again. By the time the
- * second call comes in it's likely that the memory allocation
- * thread will have returned with the requested memory. We will
- * continue to return EAGAIN however until the thread has completed.
- * When it has, we return zero (and the memory) if the allocator
- * was successful and ENOSR otherwise.
- *
- * Callers of the RCOMP and XCOMP ioctls are encouraged (but not
- * required) to loop for some number of iterations with a small
- * delay in the loop body (for instance a 1/10-th second "sleep"
- * via select.)
- */
-static int
-ppp_comp_wput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- struct iocblk *iop;
- comp_state_t *cp;
- int error, len, n;
- int flags, mask;
- mblk_t *np;
- struct compressor **comp;
- struct ppp_stats *psp;
- struct ppp_comp_stats *csp;
- unsigned char *opt_data;
- int nxslots, nrslots;
-
- cp = (comp_state_t *) q->q_ptr;
- if (cp == 0) {
- DPRINT("cp == 0 in ppp_comp_wput\n");
- freemsg(mp);
- return 0;
- }
-
- switch (mp->b_datap->db_type) {
-
- case M_DATA:
- putq(q, mp);
- break;
-
- case M_IOCTL:
- iop = (struct iocblk *) mp->b_rptr;
- error = EINVAL;
- switch (iop->ioc_cmd) {
-
- case PPPIO_CFLAGS:
- /* set/get CCP state */
- if (iop->ioc_count != 2 * sizeof(int))
- break;
- if (mp->b_cont == 0) {
- DPRINT1("ppp_comp_wput/%d: PPPIO_CFLAGS b_cont = 0!\n", cp->unit);
- break;
- }
- flags = ((int *) mp->b_cont->b_rptr)[0];
- mask = ((int *) mp->b_cont->b_rptr)[1];
- cp->flags = (cp->flags & ~mask) | (flags & mask);
- if ((mask & CCP_ISOPEN) && (flags & CCP_ISOPEN) == 0) {
- if (cp->xstate != NULL) {
- (*cp->xcomp->comp_free)(cp->xstate);
- cp->xstate = NULL;
- }
- if (cp->rstate != NULL) {
- (*cp->rcomp->decomp_free)(cp->rstate);
- cp->rstate = NULL;
- }
- cp->flags &= ~CCP_ISUP;
- }
- error = 0;
- iop->ioc_count = sizeof(int);
- ((int *) mp->b_cont->b_rptr)[0] = cp->flags;
- mp->b_cont->b_wptr = mp->b_cont->b_rptr + sizeof(int);
- break;
-
- case PPPIO_VJINIT:
- /*
- * Initialize VJ compressor/decompressor
- */
- if (iop->ioc_count != 2)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("ppp_comp_wput/%d: PPPIO_VJINIT b_cont = 0!\n", cp->unit);
- break;
- }
- nxslots = mp->b_cont->b_rptr[0] + 1;
- nrslots = mp->b_cont->b_rptr[1] + 1;
- if (nxslots > MAX_STATES || nrslots > MAX_STATES)
- break;
- vj_compress_init(&cp->vj_comp, nxslots);
- cp->vj_last_ierrors = cp->stats.ppp_ierrors;
- error = 0;
- iop->ioc_count = 0;
- break;
-
- case PPPIO_XCOMP:
- case PPPIO_RCOMP:
- if (iop->ioc_count <= 0)
- break;
- if (mp->b_cont == 0) {
- DPRINT1("ppp_comp_wput/%d: PPPIO_[XR]COMP b_cont = 0!\n", cp->unit);
- break;
- }
- opt_data = mp->b_cont->b_rptr;
- len = mp->b_cont->b_wptr - opt_data;
- if (len > iop->ioc_count)
- len = iop->ioc_count;
- if (opt_data[1] < 2 || opt_data[1] > len)
- break;
- for (comp = ppp_compressors; *comp != NULL; ++comp)
- if ((*comp)->compress_proto == opt_data[0]) {
- /* here's the handler! */
- error = 0;
-#ifndef __osf__
- if (iop->ioc_cmd == PPPIO_XCOMP) {
- /* A previous call may have fetched memory for a compressor
- * that's now being retired or reset. Free it using it's
- * mechanism for freeing stuff.
- */
- if (cp->xstate != NULL) {
- (*cp->xcomp->comp_free)(cp->xstate);
- cp->xstate = NULL;
- }
- cp->xcomp = *comp;
- cp->xstate = (*comp)->comp_alloc(opt_data, len);
- if (cp->xstate == NULL)
- error = ENOSR;
- } else {
- if (cp->rstate != NULL) {
- (*cp->rcomp->decomp_free)(cp->rstate);
- cp->rstate = NULL;
- }
- cp->rcomp = *comp;
- cp->rstate = (*comp)->decomp_alloc(opt_data, len);
- if (cp->rstate == NULL)
- error = ENOSR;
- }
-#else
- if ((error = cp->memreq.thread_status) != EAGAIN)
- if (iop->ioc_cmd == PPPIO_XCOMP) {
- if (cp->xstate) {
- (*cp->xcomp->comp_free)(cp->xstate);
- cp->xstate = 0;
- }
- /* sanity check for compressor options
- */
- if (sizeof (cp->memreq.comp_opts) < len) {
- printf("can't handle options for compressor %d (%d)\n", opt_data[0],
- opt_data[1]);
- cp->memreq.thread_status = ENOSR;
- cp->memreq.returned_mem = 0;
- }
- /* fill in request for the thread and kick it off
- */
- if (cp->memreq.thread_status == 0 && !cp->memreq.returned_mem) {
- bcopy(opt_data, cp->memreq.comp_opts, len);
- cp->memreq.cmd = PPPIO_XCOMP;
- cp->xcomp = *comp;
- error = cp->memreq.thread_status = EAGAIN;
- thread_wakeup((vm_offset_t)&cp->memreq.thread_status);
- } else {
- cp->xstate = cp->memreq.returned_mem;
- cp->memreq.returned_mem = 0;
- cp->memreq.thread_status = 0;
- }
- } else {
- if (cp->rstate) {
- (*cp->rcomp->decomp_free)(cp->rstate);
- cp->rstate = NULL;
- }
- if (sizeof (cp->memreq.comp_opts) < len) {
- printf("can't handle options for compressor %d (%d)\n", opt_data[0],
- opt_data[1]);
- cp->memreq.thread_status = ENOSR;
- cp->memreq.returned_mem = 0;
- }
- if (cp->memreq.thread_status == 0 && !cp->memreq.returned_mem) {
- bcopy(opt_data, cp->memreq.comp_opts, len);
- cp->memreq.cmd = PPPIO_RCOMP;
- cp->rcomp = *comp;
- error = cp->memreq.thread_status = EAGAIN;
- thread_wakeup((vm_offset_t)&cp->memreq.thread_status);
- } else {
- cp->rstate = cp->memreq.returned_mem;
- cp->memreq.returned_mem = 0;
- cp->memreq.thread_status = 0;
- }
- }
-#endif
- break;
- }
- iop->ioc_count = 0;
- break;
-
- case PPPIO_GETSTAT:
- if ((cp->flags & LAST_MOD) == 0) {
- error = -1; /* let the ppp_ahdl module handle it */
- break;
- }
- np = allocb(sizeof(struct ppp_stats), BPRI_HI);
- if (np == 0) {
- error = ENOSR;
- break;
- }
- if (mp->b_cont != 0)
- freemsg(mp->b_cont);
- mp->b_cont = np;
- psp = (struct ppp_stats *) np->b_wptr;
- np->b_wptr += sizeof(struct ppp_stats);
- iop->ioc_count = sizeof(struct ppp_stats);
- psp->p = cp->stats;
- psp->vj = cp->vj_comp.stats;
- error = 0;
- break;
-
- case PPPIO_GETCSTAT:
- np = allocb(sizeof(struct ppp_comp_stats), BPRI_HI);
- if (np == 0) {
- error = ENOSR;
- break;
- }
- if (mp->b_cont != 0)
- freemsg(mp->b_cont);
- mp->b_cont = np;
- csp = (struct ppp_comp_stats *) np->b_wptr;
- np->b_wptr += sizeof(struct ppp_comp_stats);
- iop->ioc_count = sizeof(struct ppp_comp_stats);
- bzero((caddr_t)csp, sizeof(struct ppp_comp_stats));
- if (cp->xstate != 0)
- (*cp->xcomp->comp_stat)(cp->xstate, &csp->c);
- if (cp->rstate != 0)
- (*cp->rcomp->decomp_stat)(cp->rstate, &csp->d);
- error = 0;
- break;
-
- case PPPIO_DEBUG:
- if (iop->ioc_count != sizeof(int))
- break;
- if (mp->b_cont == 0) {
- DPRINT1("ppp_comp_wput/%d: PPPIO_DEBUG b_cont = 0!\n", cp->unit);
- break;
- }
- n = *(int *)mp->b_cont->b_rptr;
- if (n == PPPDBG_LOG + PPPDBG_COMP) {
- DPRINT1("ppp_comp%d: debug log enabled\n", cp->unit);
- cp->flags |= DBGLOG;
- error = 0;
- iop->ioc_count = 0;
- } else {
- error = -1;
- }
- break;
-
- case PPPIO_LASTMOD:
- cp->flags |= LAST_MOD;
- error = 0;
- break;
-
- default:
- error = -1;
- break;
- }
-
- if (error < 0)
- putnext(q, mp);
- else if (error == 0) {
- mp->b_datap->db_type = M_IOCACK;
- qreply(q, mp);
- } else {
- mp->b_datap->db_type = M_IOCNAK;
- iop->ioc_error = error;
- iop->ioc_count = 0;
- qreply(q, mp);
- }
- break;
-
- case M_CTL:
- switch (*mp->b_rptr) {
- case PPPCTL_MTU:
- cp->mtu = ((unsigned short *)mp->b_rptr)[1];
- break;
- case PPPCTL_MRU:
- cp->mru = ((unsigned short *)mp->b_rptr)[1];
- break;
- case PPPCTL_UNIT:
- cp->unit = mp->b_rptr[1];
- break;
- }
- putnext(q, mp);
- break;
-
- default:
- putnext(q, mp);
- }
-
- return 0;
-}
-
-static int
-ppp_comp_wsrv(q)
- queue_t *q;
-{
- mblk_t *mp, *cmp = NULL;
- comp_state_t *cp;
- int len, proto, type, hlen, code;
- struct ip *ip;
- unsigned char *vjhdr, *dp;
-
- cp = (comp_state_t *) q->q_ptr;
- if (cp == 0) {
- DPRINT("cp == 0 in ppp_comp_wsrv\n");
- return 0;
- }
-
- while ((mp = getq(q)) != 0) {
- /* assert(mp->b_datap->db_type == M_DATA) */
-#ifdef PRIOQ
- if (!bcanputnext(q,mp->b_band))
-#else
- if (!canputnext(q))
-#endif PRIOQ
- {
- putbq(q, mp);
- break;
- }
-
- /*
- * First check the packet length and work out what the protocol is.
- */
- len = msgdsize(mp);
- if (len < PPP_HDRLEN) {
- DPRINT1("ppp_comp_wsrv: bogus short packet (%d)\n", len);
- freemsg(mp);
- cp->stats.ppp_oerrors++;
- putctl1(RD(q)->q_next, M_CTL, PPPCTL_OERROR);
- continue;
- }
- proto = (MSG_BYTE(mp, 2) << 8) + MSG_BYTE(mp, 3);
-
- /*
- * Make sure we've got enough data in the first mblk
- * and that we are its only user.
- */
- if (proto == PPP_CCP)
- hlen = len;
- else if (proto == PPP_IP)
- hlen = PPP_HDRLEN + MAX_IPHDR;
- else
- hlen = PPP_HDRLEN;
- if (hlen > len)
- hlen = len;
- if (mp->b_wptr < mp->b_rptr + hlen || mp->b_datap->db_ref > 1) {
- PULLUP(mp, hlen);
- if (mp == 0) {
- DPRINT1("ppp_comp_wsrv: pullup failed (%d)\n", hlen);
- cp->stats.ppp_oerrors++;
- putctl1(RD(q)->q_next, M_CTL, PPPCTL_OERROR);
- continue;
- }
- }
-
- /*
- * Do VJ compression if requested.
- */
- if (proto == PPP_IP && (cp->flags & COMP_VJC)) {
- ip = (struct ip *) (mp->b_rptr + PPP_HDRLEN);
- if (ip->ip_p == IPPROTO_TCP) {
- type = vj_compress_tcp(ip, len - PPP_HDRLEN, &cp->vj_comp,
- (cp->flags & COMP_VJCCID), &vjhdr);
- switch (type) {
- case TYPE_UNCOMPRESSED_TCP:
- mp->b_rptr[3] = proto = PPP_VJC_UNCOMP;
- break;
- case TYPE_COMPRESSED_TCP:
- dp = vjhdr - PPP_HDRLEN;
- dp[1] = mp->b_rptr[1]; /* copy control field */
- dp[0] = mp->b_rptr[0]; /* copy address field */
- dp[2] = 0; /* set protocol field */
- dp[3] = proto = PPP_VJC_COMP;
- mp->b_rptr = dp;
- break;
- }
- }
- }
-
- /*
- * Do packet compression if enabled.
- */
- if (proto == PPP_CCP)
- ppp_comp_ccp(q, mp, 0);
- else if (proto != PPP_LCP && (cp->flags & CCP_COMP_RUN)
- && cp->xstate != NULL) {
- len = msgdsize(mp);
- (*cp->xcomp->compress)(cp->xstate, &cmp, mp, len,
- (cp->flags & CCP_ISUP? cp->mtu + PPP_HDRLEN: 0));
- if (cmp != NULL) {
-#ifdef PRIOQ
- cmp->b_band=mp->b_band;
-#endif PRIOQ
- freemsg(mp);
- mp = cmp;
- }
- }
-
- /*
- * Do address/control and protocol compression if enabled.
- */
- if ((cp->flags & COMP_AC)
- && !(proto == PPP_LCP && LCP_USE_DFLT(mp))) {
- mp->b_rptr += 2; /* drop the address & ctrl fields */
- if (proto < 0x100 && (cp->flags & COMP_PROT))
- ++mp->b_rptr; /* drop the high protocol byte */
- } else if (proto < 0x100 && (cp->flags & COMP_PROT)) {
- /* shuffle up the address & ctrl fields */
- mp->b_rptr[2] = mp->b_rptr[1];
- mp->b_rptr[1] = mp->b_rptr[0];
- ++mp->b_rptr;
- }
-
- cp->stats.ppp_opackets++;
- cp->stats.ppp_obytes += msgdsize(mp);
- putnext(q, mp);
- }
-
- return 0;
-}
-
-static int
-ppp_comp_rput(q, mp)
- queue_t *q;
- mblk_t *mp;
-{
- comp_state_t *cp;
- struct iocblk *iop;
- struct ppp_stats *psp;
-
- cp = (comp_state_t *) q->q_ptr;
- if (cp == 0) {
- DPRINT("cp == 0 in ppp_comp_rput\n");
- freemsg(mp);
- return 0;
- }
-
- switch (mp->b_datap->db_type) {
-
- case M_DATA:
- putq(q, mp);
- break;
-
- case M_IOCACK:
- iop = (struct iocblk *) mp->b_rptr;
- switch (iop->ioc_cmd) {
- case PPPIO_GETSTAT:
- /*
- * Catch this on the way back from the ppp_ahdl module
- * so we can fill in the VJ stats.
- */
- if (mp->b_cont == 0 || iop->ioc_count != sizeof(struct ppp_stats))
- break;
- psp = (struct ppp_stats *) mp->b_cont->b_rptr;
- psp->vj = cp->vj_comp.stats;
- break;
- }
- putnext(q, mp);
- break;
-
- case M_CTL:
- switch (mp->b_rptr[0]) {
- case PPPCTL_IERROR:
- ++cp->stats.ppp_ierrors;
- break;
- case PPPCTL_OERROR:
- ++cp->stats.ppp_oerrors;
- break;
- }
- putnext(q, mp);
- break;
-
- default:
- putnext(q, mp);
- }
-
- return 0;
-}
-
-static int
-ppp_comp_rsrv(q)
- queue_t *q;
-{
- int proto, rv, i;
- mblk_t *mp, *dmp = NULL, *np;
- uchar_t *dp, *iphdr;
- comp_state_t *cp;
- int len, hlen, vjlen;
- u_int iphlen;
-
- cp = (comp_state_t *) q->q_ptr;
- if (cp == 0) {
- DPRINT("cp == 0 in ppp_comp_rsrv\n");
- return 0;
- }
-
- while ((mp = getq(q)) != 0) {
- /* assert(mp->b_datap->db_type == M_DATA) */
- if (!canputnext(q)) {
- putbq(q, mp);
- break;
- }
-
- len = msgdsize(mp);
- cp->stats.ppp_ibytes += len;
- cp->stats.ppp_ipackets++;
-
- /*
- * First work out the protocol and where the PPP header ends.
- */
- i = 0;
- proto = MSG_BYTE(mp, 0);
- if (proto == PPP_ALLSTATIONS) {
- i = 2;
- proto = MSG_BYTE(mp, 2);
- }
- if ((proto & 1) == 0) {
- ++i;
- proto = (proto << 8) + MSG_BYTE(mp, i);
- }
- hlen = i + 1;
-
- /*
- * Now reconstruct a complete, contiguous PPP header at the
- * start of the packet.
- */
- if (hlen < ((cp->flags & DECOMP_AC)? 0: 2)
- + ((cp->flags & DECOMP_PROT)? 1: 2)) {
- /* count these? */
- goto bad;
- }
- if (mp->b_rptr + hlen > mp->b_wptr) {
- adjmsg(mp, hlen); /* XXX check this call */
- hlen = 0;
- }
- if (hlen != PPP_HDRLEN) {
- /*
- * We need to put some bytes on the front of the packet
- * to make a full-length PPP header.
- * If we can put them in *mp, we do, otherwise we
- * tack another mblk on the front.
- * XXX we really shouldn't need to carry around
- * the address and control at this stage.
- */
- dp = mp->b_rptr + hlen - PPP_HDRLEN;
- if (dp < mp->b_datap->db_base || mp->b_datap->db_ref > 1) {
- np = allocb(PPP_HDRLEN, BPRI_MED);
- if (np == 0)
- goto bad;
- np->b_cont = mp;
- mp->b_rptr += hlen;
- mp = np;
- dp = mp->b_wptr;
- mp->b_wptr += PPP_HDRLEN;
- } else
- mp->b_rptr = dp;
-
- dp[0] = PPP_ALLSTATIONS;
- dp[1] = PPP_UI;
- dp[2] = proto >> 8;
- dp[3] = proto;
- }
-
- /*
- * Now see if we have a compressed packet to decompress,
- * or a CCP packet to take notice of.
- */
- proto = PPP_PROTOCOL(mp->b_rptr);
- if (proto == PPP_CCP) {
- len = msgdsize(mp);
- if (mp->b_wptr < mp->b_rptr + len) {
- PULLUP(mp, len);
- if (mp == 0)
- goto bad;
- }
- ppp_comp_ccp(q, mp, 1);
- } else if (proto == PPP_COMP) {
- if ((cp->flags & CCP_ISUP)
- && (cp->flags & CCP_DECOMP_RUN) && cp->rstate
- && (cp->flags & CCP_ERR) == 0) {
- rv = (*cp->rcomp->decompress)(cp->rstate, mp, &dmp);
- switch (rv) {
- case DECOMP_OK:
- freemsg(mp);
- mp = dmp;
- if (mp == NULL) {
- /* no error, but no packet returned either. */
- continue;
- }
- break;
- case DECOMP_ERROR:
- cp->flags |= CCP_ERROR;
- ++cp->stats.ppp_ierrors;
- putctl1(q->q_next, M_CTL, PPPCTL_IERROR);
- break;
- case DECOMP_FATALERROR:
- cp->flags |= CCP_FATALERROR;
- ++cp->stats.ppp_ierrors;
- putctl1(q->q_next, M_CTL, PPPCTL_IERROR);
- break;
- }
- }
- } else if (cp->rstate && (cp->flags & CCP_DECOMP_RUN)) {
- (*cp->rcomp->incomp)(cp->rstate, mp);
- }
-
- /*
- * Now do VJ decompression.
- */
- proto = PPP_PROTOCOL(mp->b_rptr);
- if (proto == PPP_VJC_COMP || proto == PPP_VJC_UNCOMP) {
- len = msgdsize(mp) - PPP_HDRLEN;
- if ((cp->flags & DECOMP_VJC) == 0 || len <= 0)
- goto bad;
-
- /*
- * Advance past the ppp header.
- * Here we assume that the whole PPP header is in the first mblk.
- */
- np = mp;
- dp = np->b_rptr + PPP_HDRLEN;
- if (dp >= mp->b_wptr) {
- np = np->b_cont;
- dp = np->b_rptr;
- }
-
- /*
- * Make sure we have sufficient contiguous data at this point.
- */
- hlen = (proto == PPP_VJC_COMP)? MAX_VJHDR: MAX_IPHDR;
- if (hlen > len)
- hlen = len;
- if (np->b_wptr < dp + hlen || np->b_datap->db_ref > 1) {
- PULLUP(mp, hlen + PPP_HDRLEN);
- if (mp == 0)
- goto bad;
- np = mp;
- dp = np->b_rptr + PPP_HDRLEN;
- }
-
- if (proto == PPP_VJC_COMP) {
- /*
- * Decompress VJ-compressed packet.
- * First reset compressor if an input error has occurred.
- */
- if (cp->stats.ppp_ierrors != cp->vj_last_ierrors) {
- if (cp->flags & DBGLOG)
- DPRINT1("ppp%d: resetting VJ\n", cp->unit);
- vj_uncompress_err(&cp->vj_comp);
- cp->vj_last_ierrors = cp->stats.ppp_ierrors;
- }
-
- vjlen = vj_uncompress_tcp(dp, np->b_wptr - dp, len,
- &cp->vj_comp, &iphdr, &iphlen);
- if (vjlen < 0) {
- if (cp->flags & DBGLOG)
- DPRINT2("ppp%d: vj_uncomp_tcp failed, pkt len %d\n",
- cp->unit, len);
- ++cp->vj_last_ierrors; /* so we don't reset next time */
- goto bad;
- }
-
- /* drop ppp and vj headers off */
- if (mp != np) {
- freeb(mp);
- mp = np;
- }
- mp->b_rptr = dp + vjlen;
-
- /* allocate a new mblk for the ppp and ip headers */
- if ((np = allocb(iphlen + PPP_HDRLEN + 4, BPRI_MED)) == 0)
- goto bad;
- dp = np->b_rptr; /* prepend mblk with TCP/IP hdr */
- dp[0] = PPP_ALLSTATIONS; /* reconstruct PPP header */
- dp[1] = PPP_UI;
- dp[2] = PPP_IP >> 8;
- dp[3] = PPP_IP;
- bcopy((caddr_t)iphdr, (caddr_t)dp + PPP_HDRLEN, iphlen);
- np->b_wptr = dp + iphlen + PPP_HDRLEN;
- np->b_cont = mp;
-
- /* XXX there seems to be a bug which causes panics in strread
- if we make an mbuf with only the IP header in it :-( */
- if (mp->b_wptr - mp->b_rptr > 4) {
- bcopy((caddr_t)mp->b_rptr, (caddr_t)np->b_wptr, 4);
- mp->b_rptr += 4;
- np->b_wptr += 4;
- } else {
- bcopy((caddr_t)mp->b_rptr, (caddr_t)np->b_wptr,
- mp->b_wptr - mp->b_rptr);
- np->b_wptr += mp->b_wptr - mp->b_rptr;
- np->b_cont = mp->b_cont;
- freeb(mp);
- }
-
- mp = np;
-
- } else {
- /*
- * "Decompress" a VJ-uncompressed packet.
- */
- cp->vj_last_ierrors = cp->stats.ppp_ierrors;
- if (!vj_uncompress_uncomp(dp, hlen, &cp->vj_comp)) {
- if (cp->flags & DBGLOG)
- DPRINT2("ppp%d: vj_uncomp_uncomp failed, pkt len %d\n",
- cp->unit, len);
- ++cp->vj_last_ierrors; /* don't need to reset next time */
- goto bad;
- }
- mp->b_rptr[3] = PPP_IP; /* fix up the PPP protocol field */
- }
- }
-
- putnext(q, mp);
- continue;
-
- bad:
- if (mp != 0)
- freemsg(mp);
- cp->stats.ppp_ierrors++;
- putctl1(q->q_next, M_CTL, PPPCTL_IERROR);
- }
-
- return 0;
-}
-
-/*
- * Handle a CCP packet being sent or received.
- * Here all the data in the packet is in a single mbuf.
- */
-static void
-ppp_comp_ccp(q, mp, rcvd)
- queue_t *q;
- mblk_t *mp;
- int rcvd;
-{
- int len, clen;
- comp_state_t *cp;
- unsigned char *dp;
-
- len = msgdsize(mp);
- if (len < PPP_HDRLEN + CCP_HDRLEN)
- return;
-
- cp = (comp_state_t *) q->q_ptr;
- dp = mp->b_rptr + PPP_HDRLEN;
- len -= PPP_HDRLEN;
- clen = CCP_LENGTH(dp);
- if (clen > len)
- return;
-
- switch (CCP_CODE(dp)) {
- case CCP_CONFREQ:
- case CCP_TERMREQ:
- case CCP_TERMACK:
- cp->flags &= ~CCP_ISUP;
- break;
-
- case CCP_CONFACK:
- if ((cp->flags & (CCP_ISOPEN | CCP_ISUP)) == CCP_ISOPEN
- && clen >= CCP_HDRLEN + CCP_OPT_MINLEN
- && clen >= CCP_HDRLEN + CCP_OPT_LENGTH(dp + CCP_HDRLEN)) {
- if (!rcvd) {
- if (cp->xstate != NULL
- && (*cp->xcomp->comp_init)
- (cp->xstate, dp + CCP_HDRLEN, clen - CCP_HDRLEN,
- cp->unit, 0, ((cp->flags & DBGLOG) != 0)))
- cp->flags |= CCP_COMP_RUN;
- } else {
- if (cp->rstate != NULL
- && (*cp->rcomp->decomp_init)
- (cp->rstate, dp + CCP_HDRLEN, clen - CCP_HDRLEN,
- cp->unit, 0, cp->mru, ((cp->flags & DBGLOG) != 0)))
- cp->flags = (cp->flags & ~CCP_ERR) | CCP_DECOMP_RUN;
- }
- }
- break;
-
- case CCP_RESETACK:
- if (cp->flags & CCP_ISUP) {
- if (!rcvd) {
- if (cp->xstate && (cp->flags & CCP_COMP_RUN))
- (*cp->xcomp->comp_reset)(cp->xstate);
- } else {
- if (cp->rstate && (cp->flags & CCP_DECOMP_RUN)) {
- (*cp->rcomp->decomp_reset)(cp->rstate);
- cp->flags &= ~CCP_ERROR;
- }
- }
- }
- break;
- }
-}
-
-#if 0
-dump_msg(mp)
- mblk_t *mp;
-{
- dblk_t *db;
-
- while (mp != 0) {
- db = mp->b_datap;
- DPRINT2("mp=%x cont=%x ", mp, mp->b_cont);
- DPRINT3("rptr=%x wptr=%x datap=%x\n", mp->b_rptr, mp->b_wptr, db);
- DPRINT2(" base=%x lim=%x", db->db_base, db->db_lim);
- DPRINT2(" ref=%d type=%d\n", db->db_ref, db->db_type);
- mp = mp->b_cont;
- }
-}
-#endif
-
-static int
-msg_byte(mp, i)
- mblk_t *mp;
- unsigned int i;
-{
- while (mp != 0 && i >= mp->b_wptr - mp->b_rptr)
- mp = mp->b_cont;
- if (mp == 0)
- return -1;
- return mp->b_rptr[i];
-}
diff --git a/mdk-stage1/ppp/modules/ppp_mod.h b/mdk-stage1/ppp/modules/ppp_mod.h
deleted file mode 100644
index f0af00886..000000000
--- a/mdk-stage1/ppp/modules/ppp_mod.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Miscellaneous definitions for PPP STREAMS modules.
- */
-
-/*
- * Macros for allocating and freeing kernel memory.
- */
-#ifdef SVR4 /* SVR4, including Solaris 2 */
-#include <sys/kmem.h>
-#define ALLOC_SLEEP(n) kmem_alloc((n), KM_SLEEP)
-#define ALLOC_NOSLEEP(n) kmem_alloc((n), KM_NOSLEEP)
-#define FREE(p, n) kmem_free((p), (n))
-#endif
-
-#ifdef SUNOS4
-#include <sys/kmem_alloc.h> /* SunOS 4.x */
-#define ALLOC_SLEEP(n) kmem_alloc((n), KMEM_SLEEP)
-#define ALLOC_NOSLEEP(n) kmem_alloc((n), KMEM_NOSLEEP)
-#define FREE(p, n) kmem_free((p), (n))
-#define NOTSUSER() (suser()? 0: EPERM)
-#define bcanputnext(q, band) canputnext((q))
-#endif /* SunOS 4 */
-
-#ifdef __osf__
-#include <sys/malloc.h>
-
-/* caution: this mirrors macros in sys/malloc.h, and uses interfaces
- * which are subject to change.
- * The problems are that:
- * - the official MALLOC macro wants the lhs of the assignment as an argument,
- * and it takes care of the assignment itself (yuck.)
- * - PPP insists on using "FREE" which conflicts with a macro of the same name.
- *
- */
-#ifdef BUCKETINDX /* V2.0 */
-#define ALLOC_SLEEP(n) (void *)malloc((u_long)(n), BUCKETP(n), M_DEVBUF, M_WAITOK)
-#define ALLOC_NOSLEEP(n) (void *)malloc((u_long)(n), BUCKETP(n), M_DEVBUF, M_NOWAIT)
-#else
-#define ALLOC_SLEEP(n) (void *)malloc((u_long)(n), BUCKETINDEX(n), M_DEVBUF, M_WAITOK)
-#define ALLOC_NOSLEEP(n) (void *)malloc((u_long)(n), BUCKETINDEX(n), M_DEVBUF, M_NOWAIT)
-#endif
-
-#define bcanputnext(q, band) canputnext((q))
-
-#ifdef FREE
-#undef FREE
-#endif
-#define FREE(p, n) free((void *)(p), M_DEVBUF)
-
-#define NO_DLPI 1
-
-#ifndef IFT_PPP
-#define IFT_PPP 0x17
-#endif
-
-#include <sys/proc.h>
-#define NOTSUSER() (suser(u.u_procp->p_rcred, &u.u_acflag) ? EPERM : 0)
-
-/* #include "ppp_osf.h" */
-
-#endif /* __osf__ */
-
-#ifdef AIX4
-#define ALLOC_SLEEP(n) xmalloc((n), 0, pinned_heap) /* AIX V4.x */
-#define ALLOC_NOSLEEP(n) xmalloc((n), 0, pinned_heap) /* AIX V4.x */
-#define FREE(p, n) xmfree((p), pinned_heap)
-#define NOTSUSER() (suser()? 0: EPERM)
-#endif /* AIX */
-
-/*
- * Macros for printing debugging stuff.
- */
-#ifdef DEBUG
-#if defined(SVR4) || defined(__osf__)
-#if defined(SNI)
-#include <sys/strlog.h>
-#define STRLOG_ID 4712
-#define DPRINT(f) strlog(STRLOG_ID, 0, 0, SL_TRACE, f)
-#define DPRINT1(f, a1) strlog(STRLOG_ID, 0, 0, SL_TRACE, f, a1)
-#define DPRINT2(f, a1, a2) strlog(STRLOG_ID, 0, 0, SL_TRACE, f, a1, a2)
-#define DPRINT3(f, a1, a2, a3) strlog(STRLOG_ID, 0, 0, SL_TRACE, f, a1, a2, a3)
-#else
-#define DPRINT(f) cmn_err(CE_CONT, f)
-#define DPRINT1(f, a1) cmn_err(CE_CONT, f, a1)
-#define DPRINT2(f, a1, a2) cmn_err(CE_CONT, f, a1, a2)
-#define DPRINT3(f, a1, a2, a3) cmn_err(CE_CONT, f, a1, a2, a3)
-#endif /* SNI */
-#else
-#define DPRINT(f) printf(f)
-#define DPRINT1(f, a1) printf(f, a1)
-#define DPRINT2(f, a1, a2) printf(f, a1, a2)
-#define DPRINT3(f, a1, a2, a3) printf(f, a1, a2, a3)
-#endif /* SVR4 or OSF */
-
-#else
-#define DPRINT(f) 0
-#define DPRINT1(f, a1) 0
-#define DPRINT2(f, a1, a2) 0
-#define DPRINT3(f, a1, a2, a3) 0
-#endif /* DEBUG */
-
-#ifndef SVR4
-typedef unsigned char uchar_t;
-typedef unsigned short ushort_t;
-#ifndef __osf__
-typedef int minor_t;
-#endif
-#endif
-
-/*
- * If we don't have multithreading support, define substitutes.
- */
-#ifndef D_MP
-# define qprocson(q)
-# define qprocsoff(q)
-# define put(q, mp) ((*(q)->q_qinfo->qi_putp)((q), (mp)))
-# define canputnext(q) canput((q)->q_next)
-# define qwriter(q, mp, func, scope) (func)((q), (mp))
-#endif
-
-#ifdef D_MP
-/* Use msgpullup if we have other multithreading support. */
-#define PULLUP(mp, len) \
- do { \
- mblk_t *np = msgpullup((mp), (len)); \
- freemsg((mp)); \
- mp = np; \
- } while (0)
-
-#else
-/* Use pullupmsg if we don't have any multithreading support. */
-#define PULLUP(mp, len) \
- do { \
- if (!pullupmsg((mp), (len))) { \
- freemsg((mp)); \
- mp = 0; \
- } \
- } while (0)
-#endif
-
-/*
- * How to declare the open and close procedures for a module.
- */
-#ifdef SVR4
-#define MOD_OPEN_DECL(name) \
-static int name __P((queue_t *, dev_t *, int, int, cred_t *))
-
-#define MOD_CLOSE_DECL(name) \
-static int name __P((queue_t *, int, cred_t *))
-
-#define MOD_OPEN(name) \
-static int name(q, devp, flag, sflag, credp) \
- queue_t *q; \
- dev_t *devp; \
- int flag, sflag; \
- cred_t *credp;
-
-#define MOD_CLOSE(name) \
-static int name(q, flag, credp) \
- queue_t *q; \
- int flag; \
- cred_t *credp;
-
-#define OPEN_ERROR(x) return (x)
-#define DRV_OPEN_OK(dev) return 0
-
-#define NOTSUSER() (drv_priv(credp))
-
-#else /* not SVR4 */
-#define MOD_OPEN_DECL(name) \
-static int name __P((queue_t *, int, int, int))
-
-#define MOD_CLOSE_DECL(name) \
-static int name __P((queue_t *, int))
-
-#define MOD_OPEN(name) \
-static int name(q, dev, flag, sflag) \
- queue_t *q; \
- int dev; \
- int flag, sflag;
-
-#define MOD_CLOSE(name) \
-static int name(q, flag) \
- queue_t *q; \
- int flag;
-
-#define OPEN_ERROR(x) { u.u_error = (x); return OPENFAIL; }
-#define DRV_OPEN_OK(dev) return (dev)
-
-#endif /* SVR4 */
diff --git a/mdk-stage1/ppp/modules/vjcompress.c b/mdk-stage1/ppp/modules/vjcompress.c
deleted file mode 100644
index 809b87231..000000000
--- a/mdk-stage1/ppp/modules/vjcompress.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * Routines to compress and uncompess tcp packets (for transmission
- * over low speed serial lines.
- *
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
- * - Initial distribution.
- *
- * Modified June 1993 by Paul Mackerras, paulus@cs.anu.edu.au,
- * so that the entire packet being decompressed doesn't have
- * to be in contiguous memory (just the compressed header).
- */
-
-/*
- * This version is used under SunOS 4.x, Digital UNIX, AIX 4.x,
- * and SVR4 systems including Solaris 2.
- *
- * $Id$
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-
-#ifdef SVR4
-#ifndef __GNUC__
-#include <sys/byteorder.h> /* for ntohl, etc. */
-#else
-/* make sure we don't get the gnu "fixed" one! */
-#include "/usr/include/sys/byteorder.h"
-#endif
-#endif
-
-#ifdef __osf__
-#include <net/net_globals.h>
-#endif
-#include <netinet/in.h>
-
-#ifdef AIX4
-#define _NETINET_IN_SYSTM_H_
-typedef u_long n_long;
-#else
-#include <netinet/in_systm.h>
-#endif
-
-#include <netinet/ip.h>
-#include <netinet/tcp.h>
-
-#include <net/ppp_defs.h>
-#include <net/vjcompress.h>
-
-#ifndef VJ_NO_STATS
-#define INCR(counter) ++comp->stats.counter
-#else
-#define INCR(counter)
-#endif
-
-#define BCMP(p1, p2, n) bcmp((char *)(p1), (char *)(p2), (int)(n))
-#undef BCOPY
-#define BCOPY(p1, p2, n) bcopy((char *)(p1), (char *)(p2), (int)(n))
-#ifndef KERNEL
-#define ovbcopy bcopy
-#endif
-
-#ifdef __osf__
-#define getip_hl(base) (((base).ip_vhl)&0xf)
-#define getth_off(base) ((((base).th_xoff)&0xf0)>>4)
-
-#else
-#define getip_hl(base) ((base).ip_hl)
-#define getth_off(base) ((base).th_off)
-#endif
-
-void
-vj_compress_init(comp, max_state)
- struct vjcompress *comp;
- int max_state;
-{
- register u_int i;
- register struct cstate *tstate = comp->tstate;
-
- if (max_state == -1)
- max_state = MAX_STATES - 1;
- bzero((char *)comp, sizeof(*comp));
- for (i = max_state; i > 0; --i) {
- tstate[i].cs_id = i;
- tstate[i].cs_next = &tstate[i - 1];
- }
- tstate[0].cs_next = &tstate[max_state];
- tstate[0].cs_id = 0;
- comp->last_cs = &tstate[0];
- comp->last_recv = 255;
- comp->last_xmit = 255;
- comp->flags = VJF_TOSS;
-}
-
-
-/* ENCODE encodes a number that is known to be non-zero. ENCODEZ
- * checks for zero (since zero has to be encoded in the long, 3 byte
- * form).
- */
-#define ENCODE(n) { \
- if ((u_short)(n) >= 256) { \
- *cp++ = 0; \
- cp[1] = (n); \
- cp[0] = (n) >> 8; \
- cp += 2; \
- } else { \
- *cp++ = (n); \
- } \
-}
-#define ENCODEZ(n) { \
- if ((u_short)(n) >= 256 || (u_short)(n) == 0) { \
- *cp++ = 0; \
- cp[1] = (n); \
- cp[0] = (n) >> 8; \
- cp += 2; \
- } else { \
- *cp++ = (n); \
- } \
-}
-
-#define DECODEL(f) { \
- if (*cp == 0) {\
- u_int32_t tmp = ntohl(f) + ((cp[1] << 8) | cp[2]); \
- (f) = htonl(tmp); \
- cp += 3; \
- } else { \
- u_int32_t tmp = ntohl(f) + (u_int32_t)*cp++; \
- (f) = htonl(tmp); \
- } \
-}
-
-#define DECODES(f) { \
- if (*cp == 0) {\
- u_short tmp = ntohs(f) + ((cp[1] << 8) | cp[2]); \
- (f) = htons(tmp); \
- cp += 3; \
- } else { \
- u_short tmp = ntohs(f) + (u_int32_t)*cp++; \
- (f) = htons(tmp); \
- } \
-}
-
-#define DECODEU(f) { \
- if (*cp == 0) {\
- (f) = htons((cp[1] << 8) | cp[2]); \
- cp += 3; \
- } else { \
- (f) = htons((u_int32_t)*cp++); \
- } \
-}
-
-u_int
-vj_compress_tcp(ip, mlen, comp, compress_cid, vjhdrp)
- register struct ip *ip;
- u_int mlen;
- struct vjcompress *comp;
- int compress_cid;
- u_char **vjhdrp;
-{
- register struct cstate *cs = comp->last_cs->cs_next;
- register u_int hlen = getip_hl(*ip);
- register struct tcphdr *oth;
- register struct tcphdr *th;
- register u_int deltaS, deltaA;
- register u_int changes = 0;
- u_char new_seq[16];
- register u_char *cp = new_seq;
-
- /*
- * Bail if this is an IP fragment or if the TCP packet isn't
- * `compressible' (i.e., ACK isn't set or some other control bit is
- * set). (We assume that the caller has already made sure the
- * packet is IP proto TCP).
- */
- if ((ip->ip_off & htons(0x3fff)) || mlen < 40)
- return (TYPE_IP);
-
- th = (struct tcphdr *)&((int *)ip)[hlen];
- if ((th->th_flags & (TH_SYN|TH_FIN|TH_RST|TH_ACK)) != TH_ACK)
- return (TYPE_IP);
- /*
- * Packet is compressible -- we're going to send either a
- * COMPRESSED_TCP or UNCOMPRESSED_TCP packet. Either way we need
- * to locate (or create) the connection state. Special case the
- * most recently used connection since it's most likely to be used
- * again & we don't have to do any reordering if it's used.
- */
- INCR(vjs_packets);
- if (ip->ip_src.s_addr != cs->cs_ip.ip_src.s_addr ||
- ip->ip_dst.s_addr != cs->cs_ip.ip_dst.s_addr ||
- *(int *)th != ((int *)&cs->cs_ip)[getip_hl(cs->cs_ip)]) {
- /*
- * Wasn't the first -- search for it.
- *
- * States are kept in a circularly linked list with
- * last_cs pointing to the end of the list. The
- * list is kept in lru order by moving a state to the
- * head of the list whenever it is referenced. Since
- * the list is short and, empirically, the connection
- * we want is almost always near the front, we locate
- * states via linear search. If we don't find a state
- * for the datagram, the oldest state is (re-)used.
- */
- register struct cstate *lcs;
- register struct cstate *lastcs = comp->last_cs;
-
- do {
- lcs = cs; cs = cs->cs_next;
- INCR(vjs_searches);
- if (ip->ip_src.s_addr == cs->cs_ip.ip_src.s_addr
- && ip->ip_dst.s_addr == cs->cs_ip.ip_dst.s_addr
- && *(int *)th == ((int *)&cs->cs_ip)[getip_hl(cs->cs_ip)])
- goto found;
- } while (cs != lastcs);
-
- /*
- * Didn't find it -- re-use oldest cstate. Send an
- * uncompressed packet that tells the other side what
- * connection number we're using for this conversation.
- * Note that since the state list is circular, the oldest
- * state points to the newest and we only need to set
- * last_cs to update the lru linkage.
- */
- INCR(vjs_misses);
- comp->last_cs = lcs;
- hlen += getth_off(*th);
- hlen <<= 2;
- if (hlen > mlen)
- return (TYPE_IP);
- goto uncompressed;
-
- found:
- /*
- * Found it -- move to the front on the connection list.
- */
- if (cs == lastcs)
- comp->last_cs = lcs;
- else {
- lcs->cs_next = cs->cs_next;
- cs->cs_next = lastcs->cs_next;
- lastcs->cs_next = cs;
- }
- }
-
- /*
- * Make sure that only what we expect to change changed. The first
- * line of the `if' checks the IP protocol version, header length &
- * type of service. The 2nd line checks the "Don't fragment" bit.
- * The 3rd line checks the time-to-live and protocol (the protocol
- * check is unnecessary but costless). The 4th line checks the TCP
- * header length. The 5th line checks IP options, if any. The 6th
- * line checks TCP options, if any. If any of these things are
- * different between the previous & current datagram, we send the
- * current datagram `uncompressed'.
- */
- oth = (struct tcphdr *)&((int *)&cs->cs_ip)[hlen];
- deltaS = hlen;
- hlen += getth_off(*th);
- hlen <<= 2;
- if (hlen > mlen)
- return (TYPE_IP);
-
- if (((u_short *)ip)[0] != ((u_short *)&cs->cs_ip)[0] ||
- ((u_short *)ip)[3] != ((u_short *)&cs->cs_ip)[3] ||
- ((u_short *)ip)[4] != ((u_short *)&cs->cs_ip)[4] ||
- getth_off(*th) != getth_off(*oth) ||
- (deltaS > 5 && BCMP(ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2)) ||
- (getth_off(*th) > 5 && BCMP(th + 1, oth + 1, (getth_off(*th) - 5) << 2)))
- goto uncompressed;
-
- /*
- * Figure out which of the changing fields changed. The
- * receiver expects changes in the order: urgent, window,
- * ack, seq (the order minimizes the number of temporaries
- * needed in this section of code).
- */
- if (th->th_flags & TH_URG) {
- deltaS = ntohs(th->th_urp);
- ENCODEZ(deltaS);
- changes |= NEW_U;
- } else if (th->th_urp != oth->th_urp)
- /* argh! URG not set but urp changed -- a sensible
- * implementation should never do this but RFC793
- * doesn't prohibit the change so we have to deal
- * with it. */
- goto uncompressed;
-
- if ((deltaS = (u_short)(ntohs(th->th_win) - ntohs(oth->th_win))) > 0) {
- ENCODE(deltaS);
- changes |= NEW_W;
- }
-
- if ((deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack)) > 0) {
- if (deltaA > 0xffff)
- goto uncompressed;
- ENCODE(deltaA);
- changes |= NEW_A;
- }
-
- if ((deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq)) > 0) {
- if (deltaS > 0xffff)
- goto uncompressed;
- ENCODE(deltaS);
- changes |= NEW_S;
- }
-
- switch(changes) {
-
- case 0:
- /*
- * Nothing changed. If this packet contains data and the
- * last one didn't, this is probably a data packet following
- * an ack (normal on an interactive connection) and we send
- * it compressed. Otherwise it's probably a retransmit,
- * retransmitted ack or window probe. Send it uncompressed
- * in case the other side missed the compressed version.
- */
- if (ip->ip_len != cs->cs_ip.ip_len &&
- ntohs(cs->cs_ip.ip_len) == hlen)
- break;
-
- /* (fall through) */
-
- case SPECIAL_I:
- case SPECIAL_D:
- /*
- * actual changes match one of our special case encodings --
- * send packet uncompressed.
- */
- goto uncompressed;
-
- case NEW_S|NEW_A:
- if (deltaS == deltaA && deltaS == ntohs(cs->cs_ip.ip_len) - hlen) {
- /* special case for echoed terminal traffic */
- changes = SPECIAL_I;
- cp = new_seq;
- }
- break;
-
- case NEW_S:
- if (deltaS == ntohs(cs->cs_ip.ip_len) - hlen) {
- /* special case for data xfer */
- changes = SPECIAL_D;
- cp = new_seq;
- }
- break;
- }
-
- deltaS = ntohs(ip->ip_id) - ntohs(cs->cs_ip.ip_id);
- if (deltaS != 1) {
- ENCODEZ(deltaS);
- changes |= NEW_I;
- }
- if (th->th_flags & TH_PUSH)
- changes |= TCP_PUSH_BIT;
- /*
- * Grab the cksum before we overwrite it below. Then update our
- * state with this packet's header.
- */
- deltaA = ntohs(th->th_sum);
- BCOPY(ip, &cs->cs_ip, hlen);
-
- /*
- * We want to use the original packet as our compressed packet.
- * (cp - new_seq) is the number of bytes we need for compressed
- * sequence numbers. In addition we need one byte for the change
- * mask, one for the connection id and two for the tcp checksum.
- * So, (cp - new_seq) + 4 bytes of header are needed. hlen is how
- * many bytes of the original packet to toss so subtract the two to
- * get the new packet size.
- */
- deltaS = cp - new_seq;
- cp = (u_char *)ip;
- if (compress_cid == 0 || comp->last_xmit != cs->cs_id) {
- comp->last_xmit = cs->cs_id;
- hlen -= deltaS + 4;
- *vjhdrp = (cp += hlen);
- *cp++ = changes | NEW_C;
- *cp++ = cs->cs_id;
- } else {
- hlen -= deltaS + 3;
- *vjhdrp = (cp += hlen);
- *cp++ = changes;
- }
- *cp++ = deltaA >> 8;
- *cp++ = deltaA;
- BCOPY(new_seq, cp, deltaS);
- INCR(vjs_compressed);
- return (TYPE_COMPRESSED_TCP);
-
- /*
- * Update connection state cs & send uncompressed packet (that is,
- * a regular ip/tcp packet but with the 'conversation id' we hope
- * to use on future compressed packets in the protocol field).
- */
- uncompressed:
- BCOPY(ip, &cs->cs_ip, hlen);
- ip->ip_p = cs->cs_id;
- comp->last_xmit = cs->cs_id;
- return (TYPE_UNCOMPRESSED_TCP);
-}
-
-/*
- * Called when we may have missed a packet.
- */
-void
-vj_uncompress_err(comp)
- struct vjcompress *comp;
-{
- comp->flags |= VJF_TOSS;
- INCR(vjs_errorin);
-}
-
-/*
- * "Uncompress" a packet of type TYPE_UNCOMPRESSED_TCP.
- */
-int
-vj_uncompress_uncomp(buf, buflen, comp)
- u_char *buf;
- int buflen;
- struct vjcompress *comp;
-{
- register u_int hlen;
- register struct cstate *cs;
- register struct ip *ip;
-
- ip = (struct ip *) buf;
- hlen = getip_hl(*ip) << 2;
- if (ip->ip_p >= MAX_STATES
- || hlen + sizeof(struct tcphdr) > buflen
- || (hlen += getth_off(*((struct tcphdr *)&((char *)ip)[hlen])) << 2)
- > buflen
- || hlen > MAX_HDR) {
- comp->flags |= VJF_TOSS;
- INCR(vjs_errorin);
- return (0);
- }
- cs = &comp->rstate[comp->last_recv = ip->ip_p];
- comp->flags &=~ VJF_TOSS;
- ip->ip_p = IPPROTO_TCP;
- BCOPY(ip, &cs->cs_ip, hlen);
- cs->cs_hlen = hlen;
- INCR(vjs_uncompressedin);
- return (1);
-}
-
-/*
- * Uncompress a packet of type TYPE_COMPRESSED_TCP.
- * The packet starts at buf and is of total length total_len.
- * The first buflen bytes are at buf; this must include the entire
- * compressed TCP/IP header. This procedure returns the length
- * of the VJ header, with a pointer to the uncompressed IP header
- * in *hdrp and its length in *hlenp.
- */
-int
-vj_uncompress_tcp(buf, buflen, total_len, comp, hdrp, hlenp)
- u_char *buf;
- int buflen, total_len;
- struct vjcompress *comp;
- u_char **hdrp;
- u_int *hlenp;
-{
- register u_char *cp;
- register u_int hlen, changes;
- register struct tcphdr *th;
- register struct cstate *cs;
- register u_short *bp;
- register u_int vjlen;
- register u_int32_t tmp;
-
- INCR(vjs_compressedin);
- cp = buf;
- changes = *cp++;
- if (changes & NEW_C) {
- /* Make sure the state index is in range, then grab the state.
- * If we have a good state index, clear the 'discard' flag. */
- if (*cp >= MAX_STATES)
- goto bad;
-
- comp->flags &=~ VJF_TOSS;
- comp->last_recv = *cp++;
- } else {
- /* this packet has an implicit state index. If we've
- * had a line error since the last time we got an
- * explicit state index, we have to toss the packet. */
- if (comp->flags & VJF_TOSS) {
- INCR(vjs_tossed);
- return (-1);
- }
- }
- cs = &comp->rstate[comp->last_recv];
- hlen = getip_hl(cs->cs_ip) << 2;
- th = (struct tcphdr *)&((u_char *)&cs->cs_ip)[hlen];
- th->th_sum = htons((*cp << 8) | cp[1]);
- cp += 2;
- if (changes & TCP_PUSH_BIT)
- th->th_flags |= TH_PUSH;
- else
- th->th_flags &=~ TH_PUSH;
-
- switch (changes & SPECIALS_MASK) {
- case SPECIAL_I:
- {
- register u_int32_t i = ntohs(cs->cs_ip.ip_len) - cs->cs_hlen;
- /* some compilers can't nest inline assembler.. */
- tmp = ntohl(th->th_ack) + i;
- th->th_ack = htonl(tmp);
- tmp = ntohl(th->th_seq) + i;
- th->th_seq = htonl(tmp);
- }
- break;
-
- case SPECIAL_D:
- /* some compilers can't nest inline assembler.. */
- tmp = ntohl(th->th_seq) + ntohs(cs->cs_ip.ip_len) - cs->cs_hlen;
- th->th_seq = htonl(tmp);
- break;
-
- default:
- if (changes & NEW_U) {
- th->th_flags |= TH_URG;
- DECODEU(th->th_urp);
- } else
- th->th_flags &=~ TH_URG;
- if (changes & NEW_W)
- DECODES(th->th_win);
- if (changes & NEW_A)
- DECODEL(th->th_ack);
- if (changes & NEW_S)
- DECODEL(th->th_seq);
- break;
- }
- if (changes & NEW_I) {
- DECODES(cs->cs_ip.ip_id);
- } else {
- cs->cs_ip.ip_id = ntohs(cs->cs_ip.ip_id) + 1;
- cs->cs_ip.ip_id = htons(cs->cs_ip.ip_id);
- }
-
- /*
- * At this point, cp points to the first byte of data in the
- * packet. Fill in the IP total length and update the IP
- * header checksum.
- */
- vjlen = cp - buf;
- buflen -= vjlen;
- if (buflen < 0)
- /* we must have dropped some characters (crc should detect
- * this but the old slip framing won't) */
- goto bad;
-
- total_len += cs->cs_hlen - vjlen;
- cs->cs_ip.ip_len = htons(total_len);
-
- /* recompute the ip header checksum */
- bp = (u_short *) &cs->cs_ip;
- cs->cs_ip.ip_sum = 0;
- for (changes = 0; hlen > 0; hlen -= 2)
- changes += *bp++;
- changes = (changes & 0xffff) + (changes >> 16);
- changes = (changes & 0xffff) + (changes >> 16);
- cs->cs_ip.ip_sum = ~ changes;
-
- *hdrp = (u_char *) &cs->cs_ip;
- *hlenp = cs->cs_hlen;
- return vjlen;
-
- bad:
- comp->flags |= VJF_TOSS;
- INCR(vjs_errorin);
- return (-1);
-}
diff --git a/mdk-stage1/ppp/pppd/.cvsignore b/mdk-stage1/ppp/pppd/.cvsignore
deleted file mode 100644
index 476ef2253..000000000
--- a/mdk-stage1/ppp/pppd/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-pppd
-pppd-DIET
diff --git a/mdk-stage1/ppp/pppd/Makefile b/mdk-stage1/ppp/pppd/Makefile
deleted file mode 100644
index 3544dd19d..000000000
--- a/mdk-stage1/ppp/pppd/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
- #******************************************************************************
- #
- # Guillaume Cottenceau (gc@mandrakesoft.com)
- #
- # Copyright 2000 Mandrakesoft
- #
- # This software may be freely redistributed under the terms of the GNU
- # public license.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- #
- #*****************************************************************************
-
-top_dir = ../..
-
-include $(top_dir)/Makefile.common
-
-
-TARGETS = pppd
-
-BINTARGET = ../pppd-bin
-
-
-all: $(TARGETS)
-
-clean:
- rm -f *.o *.a $(BINTARGET) pppd
-
-FLAGS = -Wall -Wno-deprecated-declarations -Werror -Os -fomit-frame-pointer -DDO_BSD_COMPRESS=0 -D_linux_=1 -DHAVE_MMAP -DNO_DRAND48 -D_BSD_SOURCE -D_GNU_SOURCE
-
-INCS = -I../include -I.
-
-ifeq (GLIBC, $(L))
-LIBS = -static -lcrypt
-endif
-
-
-OBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o auth.o options.o demand.o utils.o sys-linux.o ipxcp.o multilink.o tdb.o tty.o
-
-
-pppd: $(OBJS)
- $(DIET) gcc -o $@ $^ $(LIBS)
- $(STRIPCMD) $@
- cp -f $@ $(BINTARGET)
-
-$(OBJS): %.o: %.c
- $(DIET) gcc $(FLAGS) $(INCS) $(INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/ppp/pppd/Makefile.linux b/mdk-stage1/ppp/pppd/Makefile.linux
deleted file mode 100644
index 47d6ba01e..000000000
--- a/mdk-stage1/ppp/pppd/Makefile.linux
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# pppd makefile for Linux
-# $Id$
-#
-
-# Default installation locations
-BINDIR = $(DESTDIR)/usr/sbin
-MANDIR = $(DESTDIR)/usr/man
-
-PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
- ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c cbcp.c \
- demand.c utils.c multilink.c tdb.c tty.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h chap_ms.h md4.h \
- ipxcp.h cbcp.h tdb.h
-MANPAGES = pppd.8
-PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
- auth.o options.o demand.o utils.o sys-linux.o ipxcp.o multilink.o \
- tdb.o tty.o
-
-all: pppd
-
-#
-# include dependancies if present and backup if as a header file
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
-
-CC = gcc
-#
-COPTS = -Wall $(RPM_OPT_FLAGS)
-LIBS = -lutil
-
-ifneq ($(wildcard /usr/lib/libcrypt.*),)
-LIBS += -lcrypt
-endif
-
-# Uncomment the next 2 lines to include support for Microsoft's
-# MS-CHAP authentication protocol.
-CHAPMS=y
-USE_CRYPT=y
-ifneq ($(wildcard /usr/lib/libcrypt.*),)
-HAVE_CRYPT_H=y
-endif
-
-# Uncomment the next line to include support for PPP packet filtering.
-# This requires that the libpcap library and headers be installed
-# and that the kernel driver support PPP packet filtering, which it
-# doesn't yet.
-#FILTER=y
-
-HAS_SHADOW=y
-USE_PAM=y
-#HAVE_INET6=y
-
-PLUGIN=y
-
-INCLUDE_DIRS= -I../include
-
-COMPILE_FLAGS= -D_linux_=1 -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MULTILINK -DHAVE_MMAP
-
-CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS)
-
-ifdef CHAPMS
-CFLAGS += -DCHAPMS=1
-ifndef USE_CRYPT
-LIBS := -ldes $(LIBS)
-else
-CFLAGS += -DUSE_CRYPT=1
-ifneq ($(wildcard /usr/include/crypt.h),)
-CFLAGS += -DHAVE_CRYPT_H=1
-endif
-endif
-PPPDOBJS += md4.o chap_ms.o
-ifdef MSLANMAN
-CFLAGS += -DMSLANMAN=1
-endif
-endif
-
-ifdef HAS_SHADOW
-CFLAGS += -DHAS_SHADOW
-#LIBS := -lshadow $(LIBS)
-endif
-
-# For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
-ifdef USE_PAM
-CFLAGS += -DUSE_PAM
-LIBS := -lpam -ldl $(LIBS)
-endif
-
-# Lock library binary for Linux is included in 'linux' subdirectory.
-ifdef LOCKLIB
-LIBS := -llock $(LIBS)
-CFLAGS += -DLOCKLIB=1
-endif
-
-ifdef PLUGIN
-CFLAGS += -DPLUGIN
-LDFLAGS += -Wl,-E
-LIBS += -ldl
-endif
-
-ifdef FILTER
-LIBS += -lpcap
-CFLAGS += -DPPP_FILTER -I/usr/include/pcap
-endif
-
-ifdef HAVE_INET6
- PPPDSRCS += ipv6cp.c eui64.c
- HEADERS += ipv6cp.h eui64.h
- PPPDOBJS += ipv6cp.o eui64.o
- CFLAGS += -DINET6=1
-endif
-
-
-INSTALL= install
-
-install: pppd
- mkdir -p $(BINDIR) $(MANDIR)
- $(INSTALL) -m 555 pppd $(BINDIR)/pppd
- $(INSTALL) -c -m 444 pppd.8 $(MANDIR)/man8
-
-pppd: $(PPPDOBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
-
-clean:
- rm -f $(PPPDOBJS) pppd *~ #* core
-
-depend:
- $(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
diff --git a/mdk-stage1/ppp/pppd/Makefile.linux.make b/mdk-stage1/ppp/pppd/Makefile.linux.make
deleted file mode 100644
index d98a32562..000000000
--- a/mdk-stage1/ppp/pppd/Makefile.linux.make
+++ /dev/null
@@ -1,131 +0,0 @@
-#
-# pppd makefile for Linux
-# $Id$
-#
-
-# Default installation locations
-BINDIR = /usr/sbin
-MANDIR = /usr/man
-
-PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
- ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c cbcp.c \
- demand.c utils.c multilink.c tdb.c tty.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h chap_ms.h md4.h \
- ipxcp.h cbcp.h tdb.h
-MANPAGES = pppd.8
-PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
- auth.o options.o demand.o utils.o sys-linux.o ipxcp.o multilink.o \
- tdb.o tty.o
-
-all: pppd
-
-#
-# include dependancies if present and backup if as a header file
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
-
-# CC = gcc
-#
-COPTS = -O2 -pipe -Wall -g
-LIBS =
-
-ifneq ($(wildcard /usr/lib/libcrypt.*),)
-LIBS += -lcrypt
-endif
-
-# Uncomment the next 2 lines to include support for Microsoft's
-# MS-CHAP authentication protocol.
-CHAPMS=y
-USE_CRYPT=y
-ifneq ($(wildcard /usr/lib/libcrypt.*),)
-HAVE_CRYPT_H=y
-endif
-
-# Uncomment the next line to include support for PPP packet filtering.
-# This requires that the libpcap library and headers be installed
-# and that the kernel driver support PPP packet filtering, which it
-# doesn't yet.
-#FILTER=y
-
-HAS_SHADOW=y
-#USE_PAM=y
-#HAVE_INET6=y
-
-PLUGIN=y
-
-INCLUDE_DIRS= -I../include
-
-COMPILE_FLAGS= -D_linux_=1 -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MULTILINK -DHAVE_MMAP
-
-CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS)
-
-ifdef CHAPMS
-CFLAGS += -DCHAPMS=1
-ifndef USE_CRYPT
-LIBS := -ldes $(LIBS)
-else
-CFLAGS += -DUSE_CRYPT=1
-ifneq ($(wildcard /usr/include/crypt.h),)
-CFLAGS += -DHAVE_CRYPT_H=1
-endif
-endif
-PPPDOBJS += md4.o chap_ms.o
-ifdef MSLANMAN
-CFLAGS += -DMSLANMAN=1
-endif
-endif
-
-ifdef HAS_SHADOW
-CFLAGS += -DHAS_SHADOW
-#LIBS := -lshadow $(LIBS)
-endif
-
-# For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
-ifdef USE_PAM
-CFLAGS += -DUSE_PAM
-LIBS := -lpam -ldl $(LIBS)
-endif
-
-# Lock library binary for Linux is included in 'linux' subdirectory.
-ifdef LOCKLIB
-LIBS := -llock $(LIBS)
-CFLAGS += -DLOCKLIB=1
-endif
-
-ifdef PLUGIN
-CFLAGS += -DPLUGIN
-LDFLAGS += -Wl,-E
-LIBS += -ldl
-endif
-
-ifdef FILTER
-LIBS += -lpcap
-CFLAGS += -DPPP_FILTER -I/usr/include/pcap
-endif
-
-ifdef HAVE_INET6
- PPPDSRCS += ipv6cp.c eui64.c
- HEADERS += ipv6cp.h eui64.h
- PPPDOBJS += ipv6cp.o eui64.o
- CFLAGS += -DINET6=1
-endif
-
-
-INSTALL= install -o root
-
-install: pppd
- mkdir -p $(BINDIR) $(MANDIR)
- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
- if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
- chmod o-rx,u+s $(BINDIR)/pppd; fi
- $(INSTALL) -c -m 444 pppd.8 $(MANDIR)/man8
-
-pppd: $(PPPDOBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
-
-clean:
- rm -f $(PPPDOBJS) pppd *~ #* core
-
-depend:
- $(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
diff --git a/mdk-stage1/ppp/pppd/Makefile.linux.makeopt b/mdk-stage1/ppp/pppd/Makefile.linux.makeopt
deleted file mode 100644
index 3094c941c..000000000
--- a/mdk-stage1/ppp/pppd/Makefile.linux.makeopt
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# pppd makefile for Linux
-# $Id$
-#
-
-# Default installation locations
-BINDIR = $(DESTDIR)/usr/sbin
-MANDIR = $(DESTDIR)/usr/man
-
-PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
- ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c cbcp.c \
- demand.c utils.c multilink.c tdb.c tty.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h chap_ms.h md4.h \
- ipxcp.h cbcp.h tdb.h
-MANPAGES = pppd.8
-PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
- auth.o options.o demand.o utils.o sys-linux.o ipxcp.o multilink.o \
- tdb.o tty.o
-
-all: pppd
-
-#
-# include dependancies if present and backup if as a header file
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
-
-CC = gcc
-#
-COPTS = -O2 -pipe -Wall -g
-LIBS = -lutil
-
-ifneq ($(wildcard /usr/lib/libcrypt.*),)
-LIBS += -lcrypt
-endif
-
-# Uncomment the next 2 lines to include support for Microsoft's
-# MS-CHAP authentication protocol.
-CHAPMS=y
-USE_CRYPT=y
-ifneq ($(wildcard /usr/lib/libcrypt.*),)
-HAVE_CRYPT_H=y
-endif
-
-# Uncomment the next line to include support for PPP packet filtering.
-# This requires that the libpcap library and headers be installed
-# and that the kernel driver support PPP packet filtering, which it
-# doesn't yet.
-#FILTER=y
-
-HAS_SHADOW=y
-USE_PAM=y
-#HAVE_INET6=y
-
-PLUGIN=y
-
-INCLUDE_DIRS= -I../include
-
-COMPILE_FLAGS= -D_linux_=1 -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MULTILINK -DHAVE_MMAP
-
-CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS)
-
-ifdef CHAPMS
-CFLAGS += -DCHAPMS=1
-ifndef USE_CRYPT
-LIBS := -ldes $(LIBS)
-else
-CFLAGS += -DUSE_CRYPT=1
-ifneq ($(wildcard /usr/include/crypt.h),)
-CFLAGS += -DHAVE_CRYPT_H=1
-endif
-endif
-PPPDOBJS += md4.o chap_ms.o
-ifdef MSLANMAN
-CFLAGS += -DMSLANMAN=1
-endif
-endif
-
-ifdef HAS_SHADOW
-CFLAGS += -DHAS_SHADOW
-#LIBS := -lshadow $(LIBS)
-endif
-
-# For "Pluggable Authentication Modules", see ftp.redhat.com:/pub/pam/.
-ifdef USE_PAM
-CFLAGS += -DUSE_PAM
-LIBS := -lpam -ldl $(LIBS)
-endif
-
-# Lock library binary for Linux is included in 'linux' subdirectory.
-ifdef LOCKLIB
-LIBS := -llock $(LIBS)
-CFLAGS += -DLOCKLIB=1
-endif
-
-ifdef PLUGIN
-CFLAGS += -DPLUGIN
-LDFLAGS += -Wl,-E
-LIBS += -ldl
-endif
-
-ifdef FILTER
-LIBS += -lpcap
-CFLAGS += -DPPP_FILTER -I/usr/include/pcap
-endif
-
-ifdef HAVE_INET6
- PPPDSRCS += ipv6cp.c eui64.c
- HEADERS += ipv6cp.h eui64.h
- PPPDOBJS += ipv6cp.o eui64.o
- CFLAGS += -DINET6=1
-endif
-
-
-INSTALL= install
-
-install: pppd
- mkdir -p $(BINDIR) $(MANDIR)
- $(INSTALL) -m 555 pppd $(BINDIR)/pppd
- $(INSTALL) -c -m 444 pppd.8 $(MANDIR)/man8
-
-pppd: $(PPPDOBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
-
-clean:
- rm -f $(PPPDOBJS) pppd *~ #* core
-
-depend:
- $(CPP) -M $(CFLAGS) $(PPPDSRCS) >.depend
diff --git a/mdk-stage1/ppp/pppd/Makefile.sol2 b/mdk-stage1/ppp/pppd/Makefile.sol2
deleted file mode 100644
index dfdcddd97..000000000
--- a/mdk-stage1/ppp/pppd/Makefile.sol2
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Makefile for pppd under Solaris 2.
-# $Id$
-#
-
-include ../solaris/Makedefs
-
-COPTS += -xO2 -xspace -W0,-Lt
-CFLAGS = -I../include -DSVR4 -DSOL2 $(COPTS)
-LIBS = -lsocket -lnsl
-
-OBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o tty.o \
- ccp.o auth.o options.o demand.o utils.o sys-solaris.o tdb.o
-
-#
-# uncomment the following to enable plugins
-#
-CFLAGS += -DPLUGIN
-LIBS += -ldl
-
-#
-# Solaris 8 and above accomodates /var/run, so uncomment the
-# following to place pppd process IDs on that location
-#
-#CFLAGS += -D_PATH_VARRUN='"/var/run/"'
-
-#
-# uncomment the following to enable IPv6
-#
-# Solaris 8 and on includes support for IPv6
-#
-#CFLAGS += -DINET6
-#OBJS += ipv6cp.o eui64.o
-
-#
-# Make targets
-#
-all: pppd
-
-pppd: $(OBJS)
- $(CC) -o pppd $(OBJS) $(LIBS)
-
-install:
- $(INSTALL) -f $(BINDIR) -m 4755 -u root pppd
- $(INSTALL) -f $(MANDIR)/man8 -m 444 pppd.8
-
-clean:
- rm -f $(OBJS) pppd *~ core y.tab.c y.tab.h
diff --git a/mdk-stage1/ppp/pppd/Makefile.sunos4 b/mdk-stage1/ppp/pppd/Makefile.sunos4
deleted file mode 100644
index 694ac341f..000000000
--- a/mdk-stage1/ppp/pppd/Makefile.sunos4
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Makefile for pppd under SunOS 4.
-# $Id$
-#
-
-include ../sunos4/Makedefs
-
-LIBS =
-
-CFLAGS = $(COPTS) -I../include -DSUNOS4 -DGIDSET_TYPE=int \
- -DLOCK_DIR=\"/usr/spool/locks\"
-
-all: pppd
-
-OBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
- auth.o options.o demand.o utils.o sys-sunos4.o tty.o
-
-pppd: $(OBJS)
- $(CC) -o pppd $(OBJS) $(LIBS)
-
-install:
- $(INSTALL) -c -m 4555 pppd $(BINDIR)/pppd
- $(INSTALL) -c -m 444 pppd.8 $(MANDIR)/man8/pppd.8
-
-clean:
- rm -f $(OBJS) pppd *~ core
diff --git a/mdk-stage1/ppp/pppd/auth.c b/mdk-stage1/ppp/pppd/auth.c
deleted file mode 100644
index 5f95a2982..000000000
--- a/mdk-stage1/ppp/pppd/auth.c
+++ /dev/null
@@ -1,1939 +0,0 @@
-/*
- * auth.c - PPP authentication and phase control.
- *
- * Copyright (c) 1993 The Australian National University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the Australian National University. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <grp.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <utmp.h>
-#include <fcntl.h>
-#if defined(_PATH_LASTLOG) && defined(_linux_)
-#include <lastlog.h>
-#endif
-
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#ifdef USE_PAM
-#include <security/pam_appl.h>
-#endif
-
-#ifdef HAS_SHADOW
-#include <shadow.h>
-#ifndef PW_PPP
-#define PW_PPP PW_LOGIN
-#endif
-#endif
-
-#include "pppd.h"
-#include "fsm.h"
-#include "lcp.h"
-#include "ipcp.h"
-#include "upap.h"
-#include "chap.h"
-#ifdef CBCP_SUPPORT
-#include "cbcp.h"
-#endif
-#include "pathnames.h"
-
-#include <time.h>
-
-static const char rcsid[] = RCSID;
-
-/* Bits in scan_authfile return value */
-#define NONWILD_SERVER 1
-#define NONWILD_CLIENT 2
-
-#define ISWILD(word) (word[0] == '*' && word[1] == 0)
-
-/* The name by which the peer authenticated itself to us. */
-char peer_authname[MAXNAMELEN];
-
-/* Records which authentication operations haven't completed yet. */
-static int auth_pending[NUM_PPP];
-
-/* Set if we have successfully called plogin() */
-static int logged_in;
-
-/* List of addresses which the peer may use. */
-static struct permitted_ip *addresses[NUM_PPP];
-
-/* Wordlist giving addresses which the peer may use
- without authenticating itself. */
-static struct wordlist *noauth_addrs;
-
-/* Extra options to apply, from the secrets file entry for the peer. */
-static struct wordlist *extra_options;
-
-/* Number of network protocols which we have opened. */
-static int num_np_open;
-
-/* Number of network protocols which have come up. */
-static int num_np_up;
-
-/* Set if we got the contents of passwd[] from the pap-secrets file. */
-static int passwd_from_file;
-
-/* Set if we require authentication only because we have a default route. */
-static bool default_auth;
-
-/* Hook to enable a plugin to control the idle time limit */
-int (*idle_time_hook) __P((struct ppp_idle *)) = NULL;
-
-/* Hook for a plugin to say whether we can possibly authenticate any peer */
-int (*pap_check_hook) __P((void)) = NULL;
-
-/* Hook for a plugin to check the PAP user and password */
-int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp,
- struct wordlist **paddrs,
- struct wordlist **popts)) = NULL;
-
-/* Hook for a plugin to know about the PAP user logout */
-void (*pap_logout_hook) __P((void)) = NULL;
-
-/* Hook for a plugin to get the PAP password for authenticating us */
-int (*pap_passwd_hook) __P((char *user, char *passwd)) = NULL;
-
-/*
- * This is used to ensure that we don't start an auth-up/down
- * script while one is already running.
- */
-enum script_state {
- s_down,
- s_up
-};
-
-static enum script_state auth_state = s_down;
-static enum script_state auth_script_state = s_down;
-static pid_t auth_script_pid = 0;
-
-static int used_login; /* peer authenticated against login database */
-
-/*
- * Option variables.
- */
-bool uselogin = 0; /* Use /etc/passwd for checking PAP */
-bool cryptpap = 0; /* Passwords in pap-secrets are encrypted */
-bool refuse_pap = 0; /* Don't wanna auth. ourselves with PAP */
-bool refuse_chap = 0; /* Don't wanna auth. ourselves with CHAP */
-bool usehostname = 0; /* Use hostname for our_name */
-bool auth_required = 0; /* Always require authentication from peer */
-bool allow_any_ip = 0; /* Allow peer to use any IP address */
-bool explicit_remote = 0; /* User specified explicit remote name */
-char remote_name[MAXNAMELEN]; /* Peer's name for authentication */
-
-static char *uafname; /* name of most recent +ua file */
-
-/* Bits in auth_pending[] */
-#define PAP_WITHPEER 1
-#define PAP_PEER 2
-#define CHAP_WITHPEER 4
-#define CHAP_PEER 8
-
-extern char *crypt __P((const char *, const char *));
-
-/* Prototypes for procedures local to this file. */
-
-static void network_phase __P((int));
-static void check_idle __P((void *));
-static void connect_time_expired __P((void *));
-static int plogin __P((char *, char *, char **));
-static void plogout __P((void));
-static int null_login __P((int));
-static int get_pap_passwd __P((char *));
-static int have_pap_secret __P((int *));
-static int have_chap_secret __P((char *, char *, int, int *));
-static int ip_addr_check __P((u_int32_t, struct permitted_ip *));
-static int scan_authfile __P((FILE *, char *, char *, char *,
- struct wordlist **, struct wordlist **,
- char *));
-static void free_wordlist __P((struct wordlist *));
-static void auth_script __P((char *));
-static void auth_script_done __P((void *));
-static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *));
-static int some_ip_ok __P((struct wordlist *));
-static int setupapfile __P((char **));
-static int privgroup __P((char **));
-static int set_noauth_addr __P((char **));
-static void check_access __P((FILE *, char *));
-static int wordlist_count __P((struct wordlist *));
-
-/*
- * Authentication-related options.
- */
-option_t auth_options[] = {
- { "auth", o_bool, &auth_required,
- "Require authentication from peer", OPT_PRIO | 1 },
- { "noauth", o_bool, &auth_required,
- "Don't require peer to authenticate", OPT_PRIOSUB | OPT_PRIV,
- &allow_any_ip },
- { "require-pap", o_bool, &lcp_wantoptions[0].neg_upap,
- "Require PAP authentication from peer",
- OPT_PRIOSUB | 1, &auth_required },
- { "+pap", o_bool, &lcp_wantoptions[0].neg_upap,
- "Require PAP authentication from peer",
- OPT_ALIAS | OPT_PRIOSUB | 1, &auth_required },
- { "require-chap", o_bool, &lcp_wantoptions[0].neg_chap,
- "Require CHAP authentication from peer",
- OPT_PRIOSUB | 1, &auth_required },
- { "+chap", o_bool, &lcp_wantoptions[0].neg_chap,
- "Require CHAP authentication from peer",
- OPT_ALIAS | OPT_PRIOSUB | 1, &auth_required },
-
- { "refuse-pap", o_bool, &refuse_pap,
- "Don't agree to auth to peer with PAP", 1 },
- { "-pap", o_bool, &refuse_pap,
- "Don't allow PAP authentication with peer", OPT_ALIAS | 1 },
-
- { "refuse-chap", o_bool, &refuse_chap,
- "Don't agree to auth to peer with CHAP", 1 },
- { "-chap", o_bool, &refuse_chap,
- "Don't allow CHAP authentication with peer", OPT_ALIAS | 1 },
-
- { "name", o_string, our_name,
- "Set local name for authentication",
- OPT_PRIO | OPT_PRIV | OPT_STATIC, NULL, MAXNAMELEN },
-
- { "+ua", o_special, (void *)setupapfile,
- "Get PAP user and password from file",
- OPT_PRIO | OPT_A2STRVAL, &uafname },
-
- { "user", o_string, user,
- "Set name for auth with peer", OPT_PRIO | OPT_STATIC, NULL, MAXNAMELEN },
-
- { "password", o_string, passwd,
- "Password for authenticating us to the peer",
- OPT_PRIO | OPT_STATIC | OPT_HIDE, NULL, MAXSECRETLEN },
-
- { "usehostname", o_bool, &usehostname,
- "Must use hostname for authentication", 1 },
-
- { "remotename", o_string, remote_name,
- "Set remote name for authentication", OPT_PRIO | OPT_STATIC,
- &explicit_remote, MAXNAMELEN },
-
- { "login", o_bool, &uselogin,
- "Use system password database for PAP", 1 },
-
- { "papcrypt", o_bool, &cryptpap,
- "PAP passwords are encrypted", 1 },
-
- { "privgroup", o_special, (void *)privgroup,
- "Allow group members to use privileged options", OPT_PRIV | OPT_A2LIST },
-
- { "allow-ip", o_special, (void *)set_noauth_addr,
- "Set IP address(es) which can be used without authentication",
- OPT_PRIV | OPT_A2LIST },
-
- { NULL }
-};
-
-/*
- * setupapfile - specifies UPAP info for authenticating with peer.
- */
-static int
-setupapfile(argv)
- char **argv;
-{
- FILE *ufile;
- int l;
- char u[MAXNAMELEN], p[MAXSECRETLEN];
- char *fname;
-
- lcp_allowoptions[0].neg_upap = 1;
-
- /* open user info file */
- fname = strdup(*argv);
- if (fname == NULL)
- novm("+ua file name");
- seteuid(getuid());
- ufile = fopen(fname, "r");
- seteuid(0);
- if (ufile == NULL) {
- option_error("unable to open user login data file %s", fname);
- return 0;
- }
- check_access(ufile, fname);
- uafname = fname;
-
- /* get username */
- if (fgets(u, MAXNAMELEN - 1, ufile) == NULL
- || fgets(p, MAXSECRETLEN - 1, ufile) == NULL){
- option_error("unable to read user login data file %s", fname);
- return 0;
- }
- fclose(ufile);
-
- /* get rid of newlines */
- l = strlen(u);
- if (l > 0 && u[l-1] == '\n')
- u[l-1] = 0;
- l = strlen(p);
- if (l > 0 && p[l-1] == '\n')
- p[l-1] = 0;
-
- if (override_value("user", option_priority, fname))
- strlcpy(user, u, sizeof(user));
- if (override_value("passwd", option_priority, fname))
- strlcpy(passwd, p, sizeof(passwd));
-
- return (1);
-}
-
-
-/*
- * privgroup - allow members of the group to have privileged access.
- */
-static int
-privgroup(argv)
- char **argv;
-{
- struct group *g;
- int i;
-
- g = getgrnam(*argv);
- if (g == 0) {
- option_error("group %s is unknown", *argv);
- return 0;
- }
- for (i = 0; i < ngroups; ++i) {
- if (groups[i] == g->gr_gid) {
- privileged = 1;
- break;
- }
- }
- return 1;
-}
-
-
-/*
- * set_noauth_addr - set address(es) that can be used without authentication.
- * Equivalent to specifying an entry like `"" * "" addr' in pap-secrets.
- */
-static int
-set_noauth_addr(argv)
- char **argv;
-{
- char *addr = *argv;
- int l = strlen(addr) + 1;
- struct wordlist *wp;
-
- wp = (struct wordlist *) malloc(sizeof(struct wordlist) + l);
- if (wp == NULL)
- novm("allow-ip argument");
- wp->word = (char *) (wp + 1);
- wp->next = noauth_addrs;
- BCOPY(addr, wp->word, l);
- noauth_addrs = wp;
- return 1;
-}
-
-
-/*
- * An Open on LCP has requested a change from Dead to Establish phase.
- * Do what's necessary to bring the physical layer up.
- */
-void
-link_required(unit)
- int unit;
-{
-}
-
-/*
- * LCP has terminated the link; go to the Dead phase and take the
- * physical layer down.
- */
-void
-link_terminated(unit)
- int unit;
-{
- if (phase == PHASE_DEAD)
- return;
- if (pap_logout_hook) {
- pap_logout_hook();
- } else {
- if (logged_in)
- plogout();
- }
- new_phase(PHASE_DEAD);
- notice("Connection terminated.");
-}
-
-/*
- * LCP has gone down; it will either die or try to re-establish.
- */
-void
-link_down(unit)
- int unit;
-{
- int i;
- struct protent *protp;
-
- auth_state = s_down;
- if (auth_script_state == s_up && auth_script_pid == 0) {
- update_link_stats(unit);
- auth_script_state = s_down;
- auth_script(_PATH_AUTHDOWN);
- }
- for (i = 0; (protp = protocols[i]) != NULL; ++i) {
- if (!protp->enabled_flag)
- continue;
- if (protp->protocol != PPP_LCP && protp->lowerdown != NULL)
- (*protp->lowerdown)(unit);
- if (protp->protocol < 0xC000 && protp->close != NULL)
- (*protp->close)(unit, "LCP down");
- }
- num_np_open = 0;
- num_np_up = 0;
- if (phase != PHASE_DEAD)
- new_phase(PHASE_TERMINATE);
-}
-
-/*
- * The link is established.
- * Proceed to the Dead, Authenticate or Network phase as appropriate.
- */
-void
-link_established(unit)
- int unit;
-{
- int auth;
- lcp_options *wo = &lcp_wantoptions[unit];
- lcp_options *go = &lcp_gotoptions[unit];
- lcp_options *ho = &lcp_hisoptions[unit];
- int i;
- struct protent *protp;
-
- /*
- * Tell higher-level protocols that LCP is up.
- */
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->protocol != PPP_LCP && protp->enabled_flag
- && protp->lowerup != NULL)
- (*protp->lowerup)(unit);
-
- if (auth_required && !(go->neg_chap || go->neg_upap)) {
- /*
- * We wanted the peer to authenticate itself, and it refused:
- * if we have some address(es) it can use without auth, fine,
- * otherwise treat it as though it authenticated with PAP using
- * a username * of "" and a password of "". If that's not OK,
- * boot it out.
- */
- if (noauth_addrs != NULL) {
- set_allowed_addrs(unit, NULL, NULL);
- } else if (!wo->neg_upap || uselogin || !null_login(unit)) {
- warn("peer refused to authenticate: terminating link");
- lcp_close(unit, "peer refused to authenticate");
- status = EXIT_PEER_AUTH_FAILED;
- return;
- }
- }
-
- new_phase(PHASE_AUTHENTICATE);
- used_login = 0;
- auth = 0;
- if (go->neg_chap) {
- ChapAuthPeer(unit, our_name, go->chap_mdtype);
- auth |= CHAP_PEER;
- } else if (go->neg_upap) {
- upap_authpeer(unit);
- auth |= PAP_PEER;
- }
- if (ho->neg_chap) {
- ChapAuthWithPeer(unit, user, ho->chap_mdtype);
- auth |= CHAP_WITHPEER;
- } else if (ho->neg_upap) {
- if (passwd[0] == 0) {
- passwd_from_file = 1;
- if (!get_pap_passwd(passwd))
- error("No secret found for PAP login");
- }
- upap_authwithpeer(unit, user, passwd);
- auth |= PAP_WITHPEER;
- }
- auth_pending[unit] = auth;
-
- if (!auth)
- network_phase(unit);
-}
-
-/*
- * Proceed to the network phase.
- */
-static void
-network_phase(unit)
- int unit;
-{
- lcp_options *go = &lcp_gotoptions[unit];
-
- /*
- * If the peer had to authenticate, run the auth-up script now.
- */
- if (go->neg_chap || go->neg_upap) {
- auth_state = s_up;
- if (auth_script_state == s_down && auth_script_pid == 0) {
- auth_script_state = s_up;
- auth_script(_PATH_AUTHUP);
- }
- }
-
-#ifdef CBCP_SUPPORT
- /*
- * If we negotiated callback, do it now.
- */
- if (go->neg_cbcp) {
- new_phase(PHASE_CALLBACK);
- (*cbcp_protent.open)(unit);
- return;
- }
-#endif
-
- /*
- * Process extra options from the secrets file
- */
- if (extra_options) {
- options_from_list(extra_options, 1);
- free_wordlist(extra_options);
- extra_options = 0;
- }
- start_networks();
-}
-
-void
-start_networks()
-{
- int i;
- struct protent *protp;
-
- new_phase(PHASE_NETWORK);
-
-#ifdef HAVE_MULTILINK
- if (multilink) {
- if (mp_join_bundle()) {
- if (updetach && !nodetach)
- detach();
- return;
- }
- }
-#endif /* HAVE_MULTILINK */
-
-#ifdef PPP_FILTER
- if (!demand)
- set_filters(&pass_filter, &active_filter);
-#endif
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->protocol < 0xC000 && protp->enabled_flag
- && protp->open != NULL) {
- (*protp->open)(0);
- if (protp->protocol != PPP_CCP)
- ++num_np_open;
- }
-
- if (num_np_open == 0)
- /* nothing to do */
- lcp_close(0, "No network protocols running");
-}
-
-/*
- * The peer has failed to authenticate himself using `protocol'.
- */
-void
-auth_peer_fail(unit, protocol)
- int unit, protocol;
-{
- /*
- * Authentication failure: take the link down
- */
- lcp_close(unit, "Authentication failed");
- status = EXIT_PEER_AUTH_FAILED;
-}
-
-/*
- * The peer has been successfully authenticated using `protocol'.
- */
-void
-auth_peer_success(unit, protocol, name, namelen)
- int unit, protocol;
- char *name;
- int namelen;
-{
- int bit;
-
- switch (protocol) {
- case PPP_CHAP:
- bit = CHAP_PEER;
- break;
- case PPP_PAP:
- bit = PAP_PEER;
- break;
- default:
- warn("auth_peer_success: unknown protocol %x", protocol);
- return;
- }
-
- /*
- * Save the authenticated name of the peer for later.
- */
- if (namelen > sizeof(peer_authname) - 1)
- namelen = sizeof(peer_authname) - 1;
- BCOPY(name, peer_authname, namelen);
- peer_authname[namelen] = 0;
- script_setenv("PEERNAME", peer_authname, 0);
-
- /*
- * If there is no more authentication still to be done,
- * proceed to the network (or callback) phase.
- */
- if ((auth_pending[unit] &= ~bit) == 0)
- network_phase(unit);
-}
-
-/*
- * We have failed to authenticate ourselves to the peer using `protocol'.
- */
-void
-auth_withpeer_fail(unit, protocol)
- int unit, protocol;
-{
- if (passwd_from_file)
- BZERO(passwd, MAXSECRETLEN);
- /*
- * We've failed to authenticate ourselves to our peer.
- * Some servers keep sending CHAP challenges, but there
- * is no point in persisting without any way to get updated
- * authentication secrets.
- */
- lcp_close(unit, "Failed to authenticate ourselves to peer");
- status = EXIT_AUTH_TOPEER_FAILED;
-}
-
-/*
- * We have successfully authenticated ourselves with the peer using `protocol'.
- */
-void
-auth_withpeer_success(unit, protocol)
- int unit, protocol;
-{
- int bit;
-
- switch (protocol) {
- case PPP_CHAP:
- bit = CHAP_WITHPEER;
- break;
- case PPP_PAP:
- if (passwd_from_file)
- BZERO(passwd, MAXSECRETLEN);
- bit = PAP_WITHPEER;
- break;
- default:
- warn("auth_withpeer_success: unknown protocol %x", protocol);
- bit = 0;
- }
-
- /*
- * If there is no more authentication still being done,
- * proceed to the network (or callback) phase.
- */
- if ((auth_pending[unit] &= ~bit) == 0)
- network_phase(unit);
-}
-
-
-/*
- * np_up - a network protocol has come up.
- */
-void
-np_up(unit, proto)
- int unit, proto;
-{
- int tlim;
-
- if (num_np_up == 0) {
- /*
- * At this point we consider that the link has come up successfully.
- */
- status = EXIT_OK;
- unsuccess = 0;
- new_phase(PHASE_RUNNING);
-
- if (idle_time_hook != 0)
- tlim = (*idle_time_hook)(NULL);
- else
- tlim = idle_time_limit;
- if (tlim > 0)
- TIMEOUT(check_idle, NULL, tlim);
-
- /*
- * Set a timeout to close the connection once the maximum
- * connect time has expired.
- */
- if (maxconnect > 0)
- TIMEOUT(connect_time_expired, 0, maxconnect);
-
- /*
- * Detach now, if the updetach option was given.
- */
- if (updetach && !nodetach)
- detach();
- }
- ++num_np_up;
-}
-
-/*
- * np_down - a network protocol has gone down.
- */
-void
-np_down(unit, proto)
- int unit, proto;
-{
- if (--num_np_up == 0) {
- UNTIMEOUT(check_idle, NULL);
- new_phase(PHASE_NETWORK);
- }
-}
-
-/*
- * np_finished - a network protocol has finished using the link.
- */
-void
-np_finished(unit, proto)
- int unit, proto;
-{
- if (--num_np_open <= 0) {
- /* no further use for the link: shut up shop. */
- lcp_close(0, "No network protocols running");
- }
-}
-
-/*
- * check_idle - check whether the link has been idle for long
- * enough that we can shut it down.
- */
-static void
-check_idle(arg)
- void *arg;
-{
- struct ppp_idle idle;
- time_t itime;
- int tlim;
-
- if (!get_idle_time(0, &idle))
- return;
- if (idle_time_hook != 0) {
- tlim = idle_time_hook(&idle);
- } else {
- itime = MIN(idle.xmit_idle, idle.recv_idle);
- tlim = idle_time_limit - itime;
- }
- if (tlim <= 0) {
- /* link is idle: shut it down. */
- notice("Terminating connection due to lack of activity.");
- lcp_close(0, "Link inactive");
- need_holdoff = 0;
- status = EXIT_IDLE_TIMEOUT;
- } else {
- TIMEOUT(check_idle, NULL, tlim);
- }
-}
-
-/*
- * connect_time_expired - log a message and close the connection.
- */
-static void
-connect_time_expired(arg)
- void *arg;
-{
- info("Connect time expired");
- lcp_close(0, "Connect time expired"); /* Close connection */
- status = EXIT_CONNECT_TIME;
-}
-
-/*
- * auth_check_options - called to check authentication options.
- */
-void
-auth_check_options()
-{
- lcp_options *wo = &lcp_wantoptions[0];
- int can_auth;
- int lacks_ip;
-
- /* Default our_name to hostname, and user to our_name */
- if (our_name[0] == 0 || usehostname)
- strlcpy(our_name, hostname, sizeof(our_name));
- if (user[0] == 0)
- strlcpy(user, our_name, sizeof(user));
-
- /*
- * If we have a default route, require the peer to authenticate
- * unless the noauth option was given or the real user is root.
- */
- if (!auth_required && !allow_any_ip && have_route_to(0) && !privileged) {
- auth_required = 1;
- default_auth = 1;
- }
-
- /* If authentication is required, ask peer for CHAP or PAP. */
- if (auth_required) {
- allow_any_ip = 0;
- if (!wo->neg_chap && !wo->neg_upap) {
- wo->neg_chap = 1;
- wo->neg_upap = 1;
- }
- } else {
- wo->neg_chap = 0;
- wo->neg_upap = 0;
- }
-
- /*
- * Check whether we have appropriate secrets to use
- * to authenticate the peer.
- */
- lacks_ip = 0;
- can_auth = wo->neg_upap && (uselogin || have_pap_secret(&lacks_ip));
- if (!can_auth && wo->neg_chap) {
- can_auth = have_chap_secret((explicit_remote? remote_name: NULL),
- our_name, 1, &lacks_ip);
- }
-
- if (auth_required && !can_auth && noauth_addrs == NULL) {
- if (default_auth) {
- option_error(
-"By default the remote system is required to authenticate itself");
- option_error(
-"(because this system has a default route to the internet)");
- } else if (explicit_remote)
- option_error(
-"The remote system (%s) is required to authenticate itself",
- remote_name);
- else
- option_error(
-"The remote system is required to authenticate itself");
- option_error(
-"but I couldn't find any suitable secret (password) for it to use to do so.");
- if (lacks_ip)
- option_error(
-"(None of the available passwords would let it use an IP address.)");
-
- exit(1);
- }
-}
-
-/*
- * auth_reset - called when LCP is starting negotiations to recheck
- * authentication options, i.e. whether we have appropriate secrets
- * to use for authenticating ourselves and/or the peer.
- */
-void
-auth_reset(unit)
- int unit;
-{
- lcp_options *go = &lcp_gotoptions[unit];
- lcp_options *ao = &lcp_allowoptions[0];
-
- ao->neg_upap = !refuse_pap && (passwd[0] != 0 || get_pap_passwd(NULL));
- ao->neg_chap = !refuse_chap
- && (passwd[0] != 0
- || have_chap_secret(user, (explicit_remote? remote_name: NULL),
- 0, NULL));
-
- if (go->neg_upap && !uselogin && !have_pap_secret(NULL))
- go->neg_upap = 0;
- if (go->neg_chap) {
- if (!have_chap_secret((explicit_remote? remote_name: NULL),
- our_name, 1, NULL))
- go->neg_chap = 0;
- }
-}
-
-
-/*
- * check_passwd - Check the user name and passwd against the PAP secrets
- * file. If requested, also check against the system password database,
- * and login the user if OK.
- *
- * returns:
- * UPAP_AUTHNAK: Authentication failed.
- * UPAP_AUTHACK: Authentication succeeded.
- * In either case, msg points to an appropriate message.
- */
-int
-check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
- int unit;
- char *auser;
- int userlen;
- char *apasswd;
- int passwdlen;
- char **msg;
-{
- int ret;
- char *filename;
- FILE *f;
- struct wordlist *addrs = NULL, *opts = NULL;
- char passwd[256], user[256];
- char secret[MAXWORDLEN];
- static int attempts = 0;
-
- /*
- * Make copies of apasswd and auser, then null-terminate them.
- * If there are unprintable characters in the password, make
- * them visible.
- */
- slprintf(passwd, sizeof(passwd), "%.*v", passwdlen, apasswd);
- slprintf(user, sizeof(user), "%.*v", userlen, auser);
- *msg = "";
-
- /*
- * Check if a plugin wants to handle this.
- */
- if (pap_auth_hook) {
- ret = (*pap_auth_hook)(user, passwd, msg, &addrs, &opts);
- if (ret >= 0) {
- if (ret)
- set_allowed_addrs(unit, addrs, opts);
- BZERO(passwd, sizeof(passwd));
- if (addrs != 0)
- free_wordlist(addrs);
- return ret? UPAP_AUTHACK: UPAP_AUTHNAK;
- }
- }
-
- /*
- * Open the file of pap secrets and scan for a suitable secret
- * for authenticating this user.
- */
- filename = _PATH_UPAPFILE;
- addrs = opts = NULL;
- ret = UPAP_AUTHNAK;
- f = fopen(filename, "r");
- if (f == NULL) {
- error("Can't open PAP password file %s: %m", filename);
-
- } else {
- check_access(f, filename);
- if (scan_authfile(f, user, our_name, secret, &addrs, &opts, filename) < 0) {
- warn("no PAP secret found for %s", user);
- } else {
- /*
- * If the secret is "@login", it means to check
- * the password against the login database.
- */
- int login_secret = strcmp(secret, "@login") == 0;
- ret = UPAP_AUTHACK;
- if (uselogin || login_secret) {
- /* login option or secret is @login */
- ret = plogin(user, passwd, msg);
- if (ret == UPAP_AUTHNAK)
- warn("PAP login failure for %s", user);
- else
- used_login = 1;
- }
- if (secret[0] != 0 && !login_secret) {
- /* password given in pap-secrets - must match */
- if ((cryptpap || strcmp(passwd, secret) != 0)
- && strcmp(crypt(passwd, secret), secret) != 0) {
- ret = UPAP_AUTHNAK;
- warn("PAP authentication failure for %s", user);
- }
- }
- }
- fclose(f);
- }
-
- if (ret == UPAP_AUTHNAK) {
- if (**msg == 0)
- *msg = "Login incorrect";
- /*
- * XXX can we ever get here more than once??
- * Frustrate passwd stealer programs.
- * Allow 10 tries, but start backing off after 3 (stolen from login).
- * On 10'th, drop the connection.
- */
- if (attempts++ >= 10) {
- warn("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user);
- lcp_close(unit, "login failed");
- }
- if (attempts > 3)
- sleep((u_int) (attempts - 3) * 5);
- if (opts != NULL)
- free_wordlist(opts);
-
- } else {
- attempts = 0; /* Reset count */
- if (**msg == 0)
- *msg = "Login ok";
- set_allowed_addrs(unit, addrs, opts);
- }
-
- if (addrs != NULL)
- free_wordlist(addrs);
- BZERO(passwd, sizeof(passwd));
- BZERO(secret, sizeof(secret));
-
- return ret;
-}
-
-/*
- * This function is needed for PAM.
- */
-
-#ifdef USE_PAM
-/* Static variables used to communicate between the conversation function
- * and the server_login function
- */
-static char *PAM_username;
-static char *PAM_password;
-static int PAM_error = 0;
-static pam_handle_t *pamh = NULL;
-
-/* PAM conversation function
- * Here we assume (for now, at least) that echo on means login name, and
- * echo off means password.
- */
-
-static int PAM_conv (int num_msg, const struct pam_message **msg,
- struct pam_response **resp, void *appdata_ptr)
-{
- int replies = 0;
- struct pam_response *reply = NULL;
-
-#define COPY_STRING(s) (s) ? strdup(s) : NULL
-
- reply = malloc(sizeof(struct pam_response) * num_msg);
- if (!reply) return PAM_CONV_ERR;
-
- for (replies = 0; replies < num_msg; replies++) {
- switch (msg[replies]->msg_style) {
- case PAM_PROMPT_ECHO_ON:
- reply[replies].resp_retcode = PAM_SUCCESS;
- reply[replies].resp = COPY_STRING(PAM_username);
- /* PAM frees resp */
- break;
- case PAM_PROMPT_ECHO_OFF:
- reply[replies].resp_retcode = PAM_SUCCESS;
- reply[replies].resp = COPY_STRING(PAM_password);
- /* PAM frees resp */
- break;
- case PAM_TEXT_INFO:
- /* fall through */
- case PAM_ERROR_MSG:
- /* ignore it, but pam still wants a NULL response... */
- reply[replies].resp_retcode = PAM_SUCCESS;
- reply[replies].resp = NULL;
- break;
- default:
- /* Must be an error of some sort... */
- free (reply);
- PAM_error = 1;
- return PAM_CONV_ERR;
- }
- }
- *resp = reply;
- return PAM_SUCCESS;
-}
-
-static struct pam_conv PAM_conversation = {
- &PAM_conv,
- NULL
-};
-#endif /* USE_PAM */
-
-/*
- * plogin - Check the user name and password against the system
- * password database, and login the user if OK.
- *
- * returns:
- * UPAP_AUTHNAK: Login failed.
- * UPAP_AUTHACK: Login succeeded.
- * In either case, msg points to an appropriate message.
- */
-
-static int
-plogin(user, passwd, msg)
- char *user;
- char *passwd;
- char **msg;
-{
- char *tty;
-
-#ifdef USE_PAM
- int pam_error;
-
- pam_error = pam_start ("ppp", user, &PAM_conversation, &pamh);
- if (pam_error != PAM_SUCCESS) {
- *msg = (char *) pam_strerror (pamh, pam_error);
- reopen_log();
- return UPAP_AUTHNAK;
- }
- /*
- * Define the fields for the credential validation
- */
-
- PAM_username = user;
- PAM_password = passwd;
- PAM_error = 0;
- pam_set_item (pamh, PAM_TTY, devnam); /* this might be useful to some modules */
-
- /*
- * Validate the user
- */
- pam_error = pam_authenticate (pamh, PAM_SILENT);
- if (pam_error == PAM_SUCCESS && !PAM_error) {
- pam_error = pam_acct_mgmt (pamh, PAM_SILENT);
- if (pam_error == PAM_SUCCESS)
- pam_error = pam_open_session (pamh, PAM_SILENT);
- }
-
- *msg = (char *) pam_strerror (pamh, pam_error);
-
- /*
- * Clean up the mess
- */
- reopen_log(); /* apparently the PAM stuff does closelog() */
- PAM_username = NULL;
- PAM_password = NULL;
- if (pam_error != PAM_SUCCESS)
- return UPAP_AUTHNAK;
-#else /* #ifdef USE_PAM */
-
-/*
- * Use the non-PAM methods directly
- */
-
-#ifdef HAS_SHADOW
- struct spwd *spwd;
- struct spwd *getspnam();
-#endif
- struct passwd *pw = getpwnam(user);
-
- endpwent();
- if (pw == NULL)
- return (UPAP_AUTHNAK);
-
-#ifdef HAS_SHADOW
- spwd = getspnam(user);
- endspent();
- if (spwd) {
- /* check the age of the password entry */
- long now = time(NULL) / 86400L;
-
- if ((spwd->sp_expire > 0 && now >= spwd->sp_expire)
- || ((spwd->sp_max >= 0 && spwd->sp_max < 10000)
- && spwd->sp_lstchg >= 0
- && now >= spwd->sp_lstchg + spwd->sp_max)) {
- warn("Password for %s has expired", user);
- return (UPAP_AUTHNAK);
- }
- pw->pw_passwd = spwd->sp_pwdp;
- }
-#endif
-
- /*
- * If no passwd, don't let them login.
- */
- if (pw->pw_passwd == NULL || strlen(pw->pw_passwd) < 2
- || strcmp(crypt(passwd, pw->pw_passwd), pw->pw_passwd) != 0)
- return (UPAP_AUTHNAK);
-
-#endif /* #ifdef USE_PAM */
-
- /*
- * Write a wtmp entry for this user.
- */
-
- tty = devnam;
- if (strncmp(tty, "/dev/", 5) == 0)
- tty += 5;
-// logwtmp(tty, user, remote_name); /* Add wtmp login entry */
-
-#if defined(_PATH_LASTLOG) && !defined(USE_PAM)
- if (pw != (struct passwd *)NULL) {
- struct lastlog ll;
- int fd;
-
- if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) {
- (void)lseek(fd, (off_t)(pw->pw_uid * sizeof(ll)), SEEK_SET);
- memset((void *)&ll, 0, sizeof(ll));
- (void)time(&ll.ll_time);
- (void)strncpy(ll.ll_line, tty, sizeof(ll.ll_line));
- (void)write(fd, (char *)&ll, sizeof(ll));
- (void)close(fd);
- }
- }
-#endif /* _PATH_LASTLOG and not USE_PAM */
-
- info("user %s logged in", user);
- logged_in = 1;
-
- return (UPAP_AUTHACK);
-}
-
-/*
- * plogout - Logout the user.
- */
-static void
-plogout()
-{
-#ifdef USE_PAM
- int pam_error;
-
- if (pamh != NULL) {
- pam_error = pam_close_session (pamh, PAM_SILENT);
- pam_end (pamh, pam_error);
- pamh = NULL;
- }
- /* Apparently the pam stuff does closelog(). */
- reopen_log();
-#else /* ! USE_PAM */
- char *tty;
-
- tty = devnam;
- if (strncmp(tty, "/dev/", 5) == 0)
- tty += 5;
-// logwtmp(tty, "", ""); /* Wipe out utmp logout entry */
-#endif /* ! USE_PAM */
- logged_in = 0;
-}
-
-
-/*
- * null_login - Check if a username of "" and a password of "" are
- * acceptable, and iff so, set the list of acceptable IP addresses
- * and return 1.
- */
-static int
-null_login(unit)
- int unit;
-{
- char *filename;
- FILE *f;
- int i, ret;
- struct wordlist *addrs, *opts;
- char secret[MAXWORDLEN];
-
- /*
- * Open the file of pap secrets and scan for a suitable secret.
- */
- filename = _PATH_UPAPFILE;
- addrs = NULL;
- f = fopen(filename, "r");
- if (f == NULL)
- return 0;
- check_access(f, filename);
-
- i = scan_authfile(f, "", our_name, secret, &addrs, &opts, filename);
- ret = i >= 0 && secret[0] == 0;
- BZERO(secret, sizeof(secret));
-
- if (ret)
- set_allowed_addrs(unit, addrs, opts);
- else if (opts != 0)
- free_wordlist(opts);
- if (addrs != 0)
- free_wordlist(addrs);
-
- fclose(f);
- return ret;
-}
-
-
-/*
- * get_pap_passwd - get a password for authenticating ourselves with
- * our peer using PAP. Returns 1 on success, 0 if no suitable password
- * could be found.
- * Assumes passwd points to MAXSECRETLEN bytes of space (if non-null).
- */
-static int
-get_pap_passwd(passwd)
- char *passwd;
-{
- char *filename;
- FILE *f;
- int ret;
- char secret[MAXWORDLEN];
-
- /*
- * Check whether a plugin wants to supply this.
- */
- if (pap_passwd_hook) {
- ret = (*pap_passwd_hook)(user, passwd);
- if (ret >= 0)
- return ret;
- }
-
- filename = _PATH_UPAPFILE;
- f = fopen(filename, "r");
- if (f == NULL)
- return 0;
- check_access(f, filename);
- ret = scan_authfile(f, user,
- (remote_name[0]? remote_name: NULL),
- secret, NULL, NULL, filename);
- fclose(f);
- if (ret < 0)
- return 0;
- if (passwd != NULL)
- strlcpy(passwd, secret, MAXSECRETLEN);
- BZERO(secret, sizeof(secret));
- return 1;
-}
-
-
-/*
- * have_pap_secret - check whether we have a PAP file with any
- * secrets that we could possibly use for authenticating the peer.
- */
-static int
-have_pap_secret(lacks_ipp)
- int *lacks_ipp;
-{
- FILE *f;
- int ret;
- char *filename;
- struct wordlist *addrs;
-
- /* let the plugin decide, if there is one */
- if (pap_check_hook) {
- ret = (*pap_check_hook)();
- if (ret >= 0)
- return ret;
- }
-
- filename = _PATH_UPAPFILE;
- f = fopen(filename, "r");
- if (f == NULL)
- return 0;
-
- ret = scan_authfile(f, (explicit_remote? remote_name: NULL), our_name,
- NULL, &addrs, NULL, filename);
- fclose(f);
- if (ret >= 0 && !some_ip_ok(addrs)) {
- if (lacks_ipp != 0)
- *lacks_ipp = 1;
- ret = -1;
- }
- if (addrs != 0)
- free_wordlist(addrs);
-
- return ret >= 0;
-}
-
-
-/*
- * have_chap_secret - check whether we have a CHAP file with a
- * secret that we could possibly use for authenticating `client'
- * on `server'. Either can be the null string, meaning we don't
- * know the identity yet.
- */
-static int
-have_chap_secret(client, server, need_ip, lacks_ipp)
- char *client;
- char *server;
- int need_ip;
- int *lacks_ipp;
-{
- FILE *f;
- int ret;
- char *filename;
- struct wordlist *addrs;
-
- filename = _PATH_CHAPFILE;
- f = fopen(filename, "r");
- if (f == NULL)
- return 0;
-
- if (client != NULL && client[0] == 0)
- client = NULL;
- else if (server != NULL && server[0] == 0)
- server = NULL;
-
- ret = scan_authfile(f, client, server, NULL, &addrs, NULL, filename);
- fclose(f);
- if (ret >= 0 && need_ip && !some_ip_ok(addrs)) {
- if (lacks_ipp != 0)
- *lacks_ipp = 1;
- ret = -1;
- }
- if (addrs != 0)
- free_wordlist(addrs);
-
- return ret >= 0;
-}
-
-
-/*
- * get_secret - open the CHAP secret file and return the secret
- * for authenticating the given client on the given server.
- * (We could be either client or server).
- */
-int
-get_secret(unit, client, server, secret, secret_len, am_server)
- int unit;
- char *client;
- char *server;
- char *secret;
- int *secret_len;
- int am_server;
-{
- FILE *f;
- int ret, len;
- char *filename;
- struct wordlist *addrs, *opts;
- char secbuf[MAXWORDLEN];
-
- if (!am_server && passwd[0] != 0) {
- strlcpy(secbuf, passwd, sizeof(secbuf));
- } else {
- filename = _PATH_CHAPFILE;
- addrs = NULL;
- secbuf[0] = 0;
-
- f = fopen(filename, "r");
- if (f == NULL) {
- error("Can't open chap secret file %s: %m", filename);
- return 0;
- }
- check_access(f, filename);
-
- ret = scan_authfile(f, client, server, secbuf, &addrs, &opts, filename);
- fclose(f);
- if (ret < 0)
- return 0;
-
- if (am_server)
- set_allowed_addrs(unit, addrs, opts);
- else if (opts != 0)
- free_wordlist(opts);
- if (addrs != 0)
- free_wordlist(addrs);
- }
-
- len = strlen(secbuf);
- if (len > MAXSECRETLEN) {
- error("Secret for %s on %s is too long", client, server);
- len = MAXSECRETLEN;
- }
- BCOPY(secbuf, secret, len);
- BZERO(secbuf, sizeof(secbuf));
- *secret_len = len;
-
- return 1;
-}
-
-/*
- * set_allowed_addrs() - set the list of allowed addresses.
- * Also looks for `--' indicating options to apply for this peer
- * and leaves the following words in extra_options.
- */
-static void
-set_allowed_addrs(unit, addrs, opts)
- int unit;
- struct wordlist *addrs;
- struct wordlist *opts;
-{
- int n;
- struct wordlist *ap, **plink;
- struct permitted_ip *ip;
- char *ptr_word, *ptr_mask;
- struct hostent *hp;
- u_int32_t a, mask, offset;
- struct ipcp_options *wo = &ipcp_wantoptions[unit];
- u_int32_t suggested_ip = 0;
-
- if (addresses[unit] != NULL)
- free(addresses[unit]);
- addresses[unit] = NULL;
- if (extra_options != NULL)
- free_wordlist(extra_options);
- extra_options = opts;
-
- /*
- * Count the number of IP addresses given.
- */
- n = wordlist_count(addrs) + wordlist_count(noauth_addrs);
- if (n == 0)
- return;
- ip = (struct permitted_ip *) malloc((n + 1) * sizeof(struct permitted_ip));
- if (ip == 0)
- return;
-
- /* temporarily append the noauth_addrs list to addrs */
- for (plink = &addrs; *plink != NULL; plink = &(*plink)->next)
- ;
- *plink = noauth_addrs;
-
- n = 0;
- for (ap = addrs; ap != NULL; ap = ap->next) {
- /* "-" means no addresses authorized, "*" means any address allowed */
- ptr_word = ap->word;
- if (strcmp(ptr_word, "-") == 0)
- break;
- if (strcmp(ptr_word, "*") == 0) {
- ip[n].permit = 1;
- ip[n].base = ip[n].mask = 0;
- ++n;
- break;
- }
-
- ip[n].permit = 1;
- if (*ptr_word == '!') {
- ip[n].permit = 0;
- ++ptr_word;
- }
-
- mask = ~ (u_int32_t) 0;
- offset = 0;
- ptr_mask = strchr (ptr_word, '/');
- if (ptr_mask != NULL) {
- int bit_count;
- char *endp;
-
- bit_count = (int) strtol (ptr_mask+1, &endp, 10);
- if (bit_count <= 0 || bit_count > 32) {
- warn("invalid address length %v in auth. address list",
- ptr_mask+1);
- continue;
- }
- bit_count = 32 - bit_count; /* # bits in host part */
- if (*endp == '+') {
- offset = ifunit + 1;
- ++endp;
- }
- if (*endp != 0) {
- warn("invalid address length syntax: %v", ptr_mask+1);
- continue;
- }
- *ptr_mask = '\0';
- mask <<= bit_count;
- }
-
- hp = gethostbyname(ptr_word);
- if (hp != NULL && hp->h_addrtype == AF_INET) {
- a = *(u_int32_t *)hp->h_addr;
- } else {
- printf("*** getnetbyname is unsupported, please report bug! ***\n");
- return;
- }
-
- if (ptr_mask != NULL)
- *ptr_mask = '/';
-
- if (a == (u_int32_t)-1L) {
- warn("unknown host %s in auth. address list", ap->word);
- continue;
- }
- if (offset != 0) {
- if (offset >= ~mask) {
- warn("interface unit %d too large for subnet %v",
- ifunit, ptr_word);
- continue;
- }
- a = htonl((ntohl(a) & mask) + offset);
- mask = ~(u_int32_t)0;
- }
- ip[n].mask = htonl(mask);
- ip[n].base = a & ip[n].mask;
- ++n;
- if (~mask == 0 && suggested_ip == 0)
- suggested_ip = a;
- }
- *plink = NULL;
-
- ip[n].permit = 0; /* make the last entry forbid all addresses */
- ip[n].base = 0; /* to terminate the list */
- ip[n].mask = 0;
-
- addresses[unit] = ip;
-
- /*
- * If the address given for the peer isn't authorized, or if
- * the user hasn't given one, AND there is an authorized address
- * which is a single host, then use that if we find one.
- */
- if (suggested_ip != 0
- && (wo->hisaddr == 0 || !auth_ip_addr(unit, wo->hisaddr))) {
- wo->hisaddr = suggested_ip;
- /*
- * Do we insist on this address? No, if there are other
- * addresses authorized than the suggested one.
- */
- if (n > 1)
- wo->accept_remote = 1;
- }
-}
-
-/*
- * auth_ip_addr - check whether the peer is authorized to use
- * a given IP address. Returns 1 if authorized, 0 otherwise.
- */
-int
-auth_ip_addr(unit, addr)
- int unit;
- u_int32_t addr;
-{
- int ok;
-
- /* don't allow loopback or multicast address */
- if (bad_ip_adrs(addr))
- return 0;
-
- if (addresses[unit] != NULL) {
- ok = ip_addr_check(addr, addresses[unit]);
- if (ok >= 0)
- return ok;
- }
- if (auth_required)
- return 0; /* no addresses authorized */
- return allow_any_ip || privileged || !have_route_to(addr);
-}
-
-static int
-ip_addr_check(addr, addrs)
- u_int32_t addr;
- struct permitted_ip *addrs;
-{
- for (; ; ++addrs)
- if ((addr & addrs->mask) == addrs->base)
- return addrs->permit;
-}
-
-/*
- * bad_ip_adrs - return 1 if the IP address is one we don't want
- * to use, such as an address in the loopback net or a multicast address.
- * addr is in network byte order.
- */
-int
-bad_ip_adrs(addr)
- u_int32_t addr;
-{
- addr = ntohl(addr);
- return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET
- || IN_MULTICAST(addr) || IN_BADCLASS(addr);
-}
-
-/*
- * some_ip_ok - check a wordlist to see if it authorizes any
- * IP address(es).
- */
-static int
-some_ip_ok(addrs)
- struct wordlist *addrs;
-{
- for (; addrs != 0; addrs = addrs->next) {
- if (addrs->word[0] == '-')
- break;
- if (addrs->word[0] != '!')
- return 1; /* some IP address is allowed */
- }
- return 0;
-}
-
-/*
- * check_access - complain if a secret file has too-liberal permissions.
- */
-static void
-check_access(f, filename)
- FILE *f;
- char *filename;
-{
- struct stat sbuf;
-
- if (fstat(fileno(f), &sbuf) < 0) {
- warn("cannot stat secret file %s: %m", filename);
- } else if ((sbuf.st_mode & (S_IRWXG | S_IRWXO)) != 0) {
- warn("Warning - secret file %s has world and/or group access",
- filename);
- }
-}
-
-
-/*
- * scan_authfile - Scan an authorization file for a secret suitable
- * for authenticating `client' on `server'. The return value is -1
- * if no secret is found, otherwise >= 0. The return value has
- * NONWILD_CLIENT set if the secret didn't have "*" for the client, and
- * NONWILD_SERVER set if the secret didn't have "*" for the server.
- * Any following words on the line up to a "--" (i.e. address authorization
- * info) are placed in a wordlist and returned in *addrs. Any
- * following words (extra options) are placed in a wordlist and
- * returned in *opts.
- * We assume secret is NULL or points to MAXWORDLEN bytes of space.
- */
-static int
-scan_authfile(f, client, server, secret, addrs, opts, filename)
- FILE *f;
- char *client;
- char *server;
- char *secret;
- struct wordlist **addrs;
- struct wordlist **opts;
- char *filename;
-{
- int newline, xxx;
- int got_flag, best_flag;
- FILE *sf;
- struct wordlist *ap, *addr_list, *alist, **app;
- char word[MAXWORDLEN];
- char atfile[MAXWORDLEN];
- char lsecret[MAXWORDLEN];
-
- if (addrs != NULL)
- *addrs = NULL;
- if (opts != NULL)
- *opts = NULL;
- addr_list = NULL;
- if (!getword(f, word, &newline, filename))
- return -1; /* file is empty??? */
- newline = 1;
- best_flag = -1;
- for (;;) {
- /*
- * Skip until we find a word at the start of a line.
- */
- while (!newline && getword(f, word, &newline, filename))
- ;
- if (!newline)
- break; /* got to end of file */
-
- /*
- * Got a client - check if it's a match or a wildcard.
- */
- got_flag = 0;
- if (client != NULL && strcmp(word, client) != 0 && !ISWILD(word)) {
- newline = 0;
- continue;
- }
- if (!ISWILD(word))
- got_flag = NONWILD_CLIENT;
-
- /*
- * Now get a server and check if it matches.
- */
- if (!getword(f, word, &newline, filename))
- break;
- if (newline)
- continue;
- if (!ISWILD(word)) {
- if (server != NULL && strcmp(word, server) != 0)
- continue;
- got_flag |= NONWILD_SERVER;
- }
-
- /*
- * Got some sort of a match - see if it's better than what
- * we have already.
- */
- if (got_flag <= best_flag)
- continue;
-
- /*
- * Get the secret.
- */
- if (!getword(f, word, &newline, filename))
- break;
- if (newline)
- continue;
-
- if (secret != NULL) {
- /*
- * Special syntax: @/pathname means read secret from file.
- */
- if (word[0] == '@' && word[1] == '/') {
- strlcpy(atfile, word+1, sizeof(atfile));
- if ((sf = fopen(atfile, "r")) == NULL) {
- warn("can't open indirect secret file %s", atfile);
- continue;
- }
- check_access(sf, atfile);
- if (!getword(sf, word, &xxx, atfile)) {
- warn("no secret in indirect secret file %s", atfile);
- fclose(sf);
- continue;
- }
- fclose(sf);
- }
- strlcpy(lsecret, word, sizeof(lsecret));
- }
-
- /*
- * Now read address authorization info and make a wordlist.
- */
- app = &alist;
- for (;;) {
- if (!getword(f, word, &newline, filename) || newline)
- break;
- ap = (struct wordlist *)
- malloc(sizeof(struct wordlist) + strlen(word) + 1);
- if (ap == NULL)
- novm("authorized addresses");
- ap->word = (char *) (ap + 1);
- strcpy(ap->word, word);
- *app = ap;
- app = &ap->next;
- }
- *app = NULL;
-
- /*
- * This is the best so far; remember it.
- */
- best_flag = got_flag;
- if (addr_list)
- free_wordlist(addr_list);
- addr_list = alist;
- if (secret != NULL)
- strlcpy(secret, lsecret, MAXWORDLEN);
-
- if (!newline)
- break;
- }
-
- /* scan for a -- word indicating the start of options */
- for (app = &addr_list; (ap = *app) != NULL; app = &ap->next)
- if (strcmp(ap->word, "--") == 0)
- break;
- /* ap = start of options */
- if (ap != NULL) {
- ap = ap->next; /* first option */
- free(*app); /* free the "--" word */
- *app = NULL; /* terminate addr list */
- }
- if (opts != NULL)
- *opts = ap;
- else if (ap != NULL)
- free_wordlist(ap);
- if (addrs != NULL)
- *addrs = addr_list;
- else if (addr_list != NULL)
- free_wordlist(addr_list);
-
- return best_flag;
-}
-
-/*
- * wordlist_count - return the number of items in a wordlist
- */
-static int
-wordlist_count(wp)
- struct wordlist *wp;
-{
- int n;
-
- for (n = 0; wp != NULL; wp = wp->next)
- ++n;
- return n;
-}
-
-/*
- * free_wordlist - release memory allocated for a wordlist.
- */
-static void
-free_wordlist(wp)
- struct wordlist *wp;
-{
- struct wordlist *next;
-
- while (wp != NULL) {
- next = wp->next;
- free(wp);
- wp = next;
- }
-}
-
-/*
- * auth_script_done - called when the auth-up or auth-down script
- * has finished.
- */
-static void
-auth_script_done(arg)
- void *arg;
-{
- auth_script_pid = 0;
- switch (auth_script_state) {
- case s_up:
- if (auth_state == s_down) {
- auth_script_state = s_down;
- auth_script(_PATH_AUTHDOWN);
- }
- break;
- case s_down:
- if (auth_state == s_up) {
- auth_script_state = s_up;
- auth_script(_PATH_AUTHUP);
- }
- break;
- }
-}
-
-/*
- * auth_script - execute a script with arguments
- * interface-name peer-name real-user tty speed
- */
-static void
-auth_script(script)
- char *script;
-{
- char strspeed[32];
- struct passwd *pw;
- char struid[32];
- char *user_name;
- char *argv[8];
-
- if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL)
- user_name = pw->pw_name;
- else {
- slprintf(struid, sizeof(struid), "%d", getuid());
- user_name = struid;
- }
- slprintf(strspeed, sizeof(strspeed), "%d", baud_rate);
-
- argv[0] = script;
- argv[1] = ifname;
- argv[2] = peer_authname;
- argv[3] = user_name;
- argv[4] = devnam;
- argv[5] = strspeed;
- argv[6] = NULL;
-
- auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL);
-}
diff --git a/mdk-stage1/ppp/pppd/cbcp.c b/mdk-stage1/ppp/pppd/cbcp.c
deleted file mode 100644
index 8c57b3cde..000000000
--- a/mdk-stage1/ppp/pppd/cbcp.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * cbcp - Call Back Configuration Protocol.
- *
- * Copyright (c) 1995 Pedro Roque Marques
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Pedro Roque Marques. The name of the author may not be used to
- * endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include "pppd.h"
-#include "cbcp.h"
-#include "fsm.h"
-#include "lcp.h"
-
-static const char rcsid[] = RCSID;
-
-/*
- * Options.
- */
-static int setcbcp __P((char **));
-
-static option_t cbcp_option_list[] = {
- { "callback", o_special, setcbcp,
- "Ask for callback", OPT_PRIO | OPT_A2STRVAL, &cbcp[0].us_number },
- { NULL }
-};
-
-/*
- * Protocol entry points.
- */
-static void cbcp_init __P((int unit));
-static void cbcp_open __P((int unit));
-static void cbcp_lowerup __P((int unit));
-static void cbcp_input __P((int unit, u_char *pkt, int len));
-static void cbcp_protrej __P((int unit));
-static int cbcp_printpkt __P((u_char *pkt, int len,
- void (*printer) __P((void *, char *, ...)),
- void *arg));
-
-struct protent cbcp_protent = {
- PPP_CBCP,
- cbcp_init,
- cbcp_input,
- cbcp_protrej,
- cbcp_lowerup,
- NULL,
- cbcp_open,
- NULL,
- cbcp_printpkt,
- NULL,
- 0,
- "CBCP",
- NULL,
- cbcp_option_list,
- NULL,
- NULL,
- NULL
-};
-
-cbcp_state cbcp[NUM_PPP];
-
-/* internal prototypes */
-
-static void cbcp_recvreq __P((cbcp_state *us, char *pckt, int len));
-static void cbcp_resp __P((cbcp_state *us));
-static void cbcp_up __P((cbcp_state *us));
-static void cbcp_recvack __P((cbcp_state *us, char *pckt, int len));
-static void cbcp_send __P((cbcp_state *us, u_char code, u_char *buf, int len));
-
-/* option processing */
-static int
-setcbcp(argv)
- char **argv;
-{
- lcp_wantoptions[0].neg_cbcp = 1;
- cbcp_protent.enabled_flag = 1;
- cbcp[0].us_number = strdup(*argv);
- if (cbcp[0].us_number == 0)
- novm("callback number");
- cbcp[0].us_type |= (1 << CB_CONF_USER);
- cbcp[0].us_type |= (1 << CB_CONF_ADMIN);
- return (1);
-}
-
-/* init state */
-static void
-cbcp_init(iface)
- int iface;
-{
- cbcp_state *us;
-
- us = &cbcp[iface];
- memset(us, 0, sizeof(cbcp_state));
- us->us_unit = iface;
- us->us_type |= (1 << CB_CONF_NO);
-}
-
-/* lower layer is up */
-static void
-cbcp_lowerup(iface)
- int iface;
-{
- cbcp_state *us = &cbcp[iface];
-
- dbglog("cbcp_lowerup");
- dbglog("want: %d", us->us_type);
-
- if (us->us_type == CB_CONF_USER)
- dbglog("phone no: %s", us->us_number);
-}
-
-static void
-cbcp_open(unit)
- int unit;
-{
- dbglog("cbcp_open");
-}
-
-/* process an incomming packet */
-static void
-cbcp_input(unit, inpacket, pktlen)
- int unit;
- u_char *inpacket;
- int pktlen;
-{
- u_char *inp;
- u_char code, id;
- u_short len;
-
- cbcp_state *us = &cbcp[unit];
-
- inp = inpacket;
-
- if (pktlen < CBCP_MINLEN) {
- error("CBCP packet is too small");
- return;
- }
-
- GETCHAR(code, inp);
- GETCHAR(id, inp);
- GETSHORT(len, inp);
-
-#if 0
- if (len > pktlen) {
- error("CBCP packet: invalid length");
- return;
- }
-#endif
-
- len -= CBCP_MINLEN;
-
- switch(code) {
- case CBCP_REQ:
- us->us_id = id;
- cbcp_recvreq(us, inp, len);
- break;
-
- case CBCP_RESP:
- dbglog("CBCP_RESP received");
- break;
-
- case CBCP_ACK:
- if (id != us->us_id)
- dbglog("id doesn't match: expected %d recv %d",
- us->us_id, id);
-
- cbcp_recvack(us, inp, len);
- break;
-
- default:
- break;
- }
-}
-
-/* protocol was rejected by foe */
-void cbcp_protrej(int iface)
-{
-}
-
-char *cbcp_codenames[] = {
- "Request", "Response", "Ack"
-};
-
-char *cbcp_optionnames[] = {
- "NoCallback",
- "UserDefined",
- "AdminDefined",
- "List"
-};
-
-/* pretty print a packet */
-static int
-cbcp_printpkt(p, plen, printer, arg)
- u_char *p;
- int plen;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- int code, opt, id, len, olen, delay;
- u_char *pstart;
-
- if (plen < HEADERLEN)
- return 0;
- pstart = p;
- GETCHAR(code, p);
- GETCHAR(id, p);
- GETSHORT(len, p);
- if (len < HEADERLEN || len > plen)
- return 0;
-
- if (code >= 1 && code <= sizeof(cbcp_codenames) / sizeof(char *))
- printer(arg, " %s", cbcp_codenames[code-1]);
- else
- printer(arg, " code=0x%x", code);
-
- printer(arg, " id=0x%x", id);
- len -= HEADERLEN;
-
- switch (code) {
- case CBCP_REQ:
- case CBCP_RESP:
- case CBCP_ACK:
- while(len >= 2) {
- GETCHAR(opt, p);
- GETCHAR(olen, p);
-
- if (olen < 2 || olen > len) {
- break;
- }
-
- printer(arg, " <");
- len -= olen;
-
- if (opt >= 1 && opt <= sizeof(cbcp_optionnames) / sizeof(char *))
- printer(arg, " %s", cbcp_optionnames[opt-1]);
- else
- printer(arg, " option=0x%x", opt);
-
- if (olen > 2) {
- GETCHAR(delay, p);
- printer(arg, " delay = %d", delay);
- }
-
- if (olen > 3) {
- int addrt;
- char str[256];
-
- GETCHAR(addrt, p);
- memcpy(str, p, olen - 4);
- str[olen - 4] = 0;
- printer(arg, " number = %s", str);
- }
- printer(arg, ">");
- break;
- }
-
- default:
- break;
- }
-
- for (; len > 0; --len) {
- GETCHAR(code, p);
- printer(arg, " %.2x", code);
- }
-
- return p - pstart;
-}
-
-/* received CBCP request */
-static void
-cbcp_recvreq(us, pckt, pcktlen)
- cbcp_state *us;
- char *pckt;
- int pcktlen;
-{
- u_char type, opt_len, delay, addr_type;
- char address[256];
- int len = pcktlen;
-
- address[0] = 0;
-
- while (len) {
- dbglog("length: %d", len);
-
- GETCHAR(type, pckt);
- GETCHAR(opt_len, pckt);
-
- if (opt_len > 2)
- GETCHAR(delay, pckt);
-
- us->us_allowed |= (1 << type);
-
- switch(type) {
- case CB_CONF_NO:
- dbglog("no callback allowed");
- break;
-
- case CB_CONF_USER:
- dbglog("user callback allowed");
- if (opt_len > 4) {
- GETCHAR(addr_type, pckt);
- memcpy(address, pckt, opt_len - 4);
- address[opt_len - 4] = 0;
- if (address[0])
- dbglog("address: %s", address);
- }
- break;
-
- case CB_CONF_ADMIN:
- dbglog("user admin defined allowed");
- break;
-
- case CB_CONF_LIST:
- break;
- }
- len -= opt_len;
- }
-
- cbcp_resp(us);
-}
-
-static void
-cbcp_resp(us)
- cbcp_state *us;
-{
- u_char cb_type;
- u_char buf[256];
- u_char *bufp = buf;
- int len = 0;
-
- cb_type = us->us_allowed & us->us_type;
- dbglog("cbcp_resp cb_type=%d", cb_type);
-
-#if 0
- if (!cb_type)
- lcp_down(us->us_unit);
-#endif
-
- if (cb_type & ( 1 << CB_CONF_USER ) ) {
- dbglog("cbcp_resp CONF_USER");
- PUTCHAR(CB_CONF_USER, bufp);
- len = 3 + 1 + strlen(us->us_number) + 1;
- PUTCHAR(len , bufp);
- PUTCHAR(5, bufp); /* delay */
- PUTCHAR(1, bufp);
- BCOPY(us->us_number, bufp, strlen(us->us_number) + 1);
- cbcp_send(us, CBCP_RESP, buf, len);
- return;
- }
-
- if (cb_type & ( 1 << CB_CONF_ADMIN ) ) {
- dbglog("cbcp_resp CONF_ADMIN");
- PUTCHAR(CB_CONF_ADMIN, bufp);
- len = 3;
- PUTCHAR(len, bufp);
- PUTCHAR(5, bufp); /* delay */
- cbcp_send(us, CBCP_RESP, buf, len);
- return;
- }
-
- if (cb_type & ( 1 << CB_CONF_NO ) ) {
- dbglog("cbcp_resp CONF_NO");
- PUTCHAR(CB_CONF_NO, bufp);
- len = 3;
- PUTCHAR(len , bufp);
- PUTCHAR(0, bufp);
- cbcp_send(us, CBCP_RESP, buf, len);
- start_networks();
- return;
- }
-}
-
-static void
-cbcp_send(us, code, buf, len)
- cbcp_state *us;
- u_char code;
- u_char *buf;
- int len;
-{
- u_char *outp;
- int outlen;
-
- outp = outpacket_buf;
-
- outlen = 4 + len;
-
- MAKEHEADER(outp, PPP_CBCP);
-
- PUTCHAR(code, outp);
- PUTCHAR(us->us_id, outp);
- PUTSHORT(outlen, outp);
-
- if (len)
- BCOPY(buf, outp, len);
-
- output(us->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
-}
-
-static void
-cbcp_recvack(us, pckt, len)
- cbcp_state *us;
- char *pckt;
- int len;
-{
- u_char type, delay, addr_type;
- int opt_len;
- char address[256];
-
- if (len) {
- GETCHAR(type, pckt);
- GETCHAR(opt_len, pckt);
-
- if (opt_len > 2)
- GETCHAR(delay, pckt);
-
- if (opt_len > 4) {
- GETCHAR(addr_type, pckt);
- memcpy(address, pckt, opt_len - 4);
- address[opt_len - 4] = 0;
- if (address[0])
- dbglog("peer will call: %s", address);
- }
- if (type == CB_CONF_NO)
- return;
- }
-
- cbcp_up(us);
-}
-
-/* ok peer will do callback */
-static void
-cbcp_up(us)
- cbcp_state *us;
-{
- persist = 0;
- lcp_close(0, "Call me back, please");
- status = EXIT_CALLBACK;
-}
diff --git a/mdk-stage1/ppp/pppd/cbcp.h b/mdk-stage1/ppp/pppd/cbcp.h
deleted file mode 100644
index c2ab3f689..000000000
--- a/mdk-stage1/ppp/pppd/cbcp.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef CBCP_H
-#define CBCP_H
-
-typedef struct cbcp_state {
- int us_unit; /* Interface unit number */
- u_char us_id; /* Current id */
- u_char us_allowed;
- int us_type;
- char *us_number; /* Telefone Number */
-} cbcp_state;
-
-extern cbcp_state cbcp[];
-
-extern struct protent cbcp_protent;
-
-#define CBCP_MINLEN 4
-
-#define CBCP_REQ 1
-#define CBCP_RESP 2
-#define CBCP_ACK 3
-
-#define CB_CONF_NO 1
-#define CB_CONF_USER 2
-#define CB_CONF_ADMIN 3
-#define CB_CONF_LIST 4
-#endif
diff --git a/mdk-stage1/ppp/pppd/ccp.c b/mdk-stage1/ppp/pppd/ccp.c
deleted file mode 100644
index 7e36e384e..000000000
--- a/mdk-stage1/ppp/pppd/ccp.c
+++ /dev/null
@@ -1,1257 +0,0 @@
-/*
- * ccp.c - PPP Compression Control Protocol.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- */
-
-#define RCSID "$Id$"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "pppd.h"
-#include "fsm.h"
-#include "ccp.h"
-#include <net/ppp-comp.h>
-
-static const char rcsid[] = RCSID;
-
-/*
- * Unfortunately there is a bug in zlib which means that using a
- * size of 8 (window size = 256) for Deflate compression will cause
- * buffer overruns and kernel crashes in the deflate module.
- * Until this is fixed we only accept sizes in the range 9 .. 15.
- * Thanks to James Carlson for pointing this out.
- */
-#define DEFLATE_MIN_WORKS 9
-
-/*
- * Command-line options.
- */
-static int setbsdcomp __P((char **));
-static int setdeflate __P((char **));
-static char bsd_value[8];
-static char deflate_value[8];
-
-static option_t ccp_option_list[] = {
- { "noccp", o_bool, &ccp_protent.enabled_flag,
- "Disable CCP negotiation" },
- { "-ccp", o_bool, &ccp_protent.enabled_flag,
- "Disable CCP negotiation", OPT_ALIAS },
-
- { "bsdcomp", o_special, (void *)setbsdcomp,
- "Request BSD-Compress packet compression",
- OPT_PRIO | OPT_A2STRVAL | OPT_STATIC, bsd_value },
- { "nobsdcomp", o_bool, &ccp_wantoptions[0].bsd_compress,
- "don't allow BSD-Compress", OPT_PRIOSUB | OPT_A2CLR,
- &ccp_allowoptions[0].bsd_compress },
- { "-bsdcomp", o_bool, &ccp_wantoptions[0].bsd_compress,
- "don't allow BSD-Compress", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
- &ccp_allowoptions[0].bsd_compress },
-
- { "deflate", o_special, (void *)setdeflate,
- "request Deflate compression",
- OPT_PRIO | OPT_A2STRVAL | OPT_STATIC, deflate_value },
- { "nodeflate", o_bool, &ccp_wantoptions[0].deflate,
- "don't allow Deflate compression", OPT_PRIOSUB | OPT_A2CLR,
- &ccp_allowoptions[0].deflate },
- { "-deflate", o_bool, &ccp_wantoptions[0].deflate,
- "don't allow Deflate compression", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
- &ccp_allowoptions[0].deflate },
-
- { "nodeflatedraft", o_bool, &ccp_wantoptions[0].deflate_draft,
- "don't use draft deflate #", OPT_A2COPY,
- &ccp_allowoptions[0].deflate_draft },
-
- { "predictor1", o_bool, &ccp_wantoptions[0].predictor_1,
- "request Predictor-1", 1, &ccp_allowoptions[0].predictor_1, OPT_PRIO },
- { "nopredictor1", o_bool, &ccp_wantoptions[0].predictor_1,
- "don't allow Predictor-1", OPT_PRIOSUB | OPT_A2CLR,
- &ccp_allowoptions[0].predictor_1 },
- { "-predictor1", o_bool, &ccp_wantoptions[0].predictor_1,
- "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
- &ccp_allowoptions[0].predictor_1 },
-
- { NULL }
-};
-
-/*
- * Protocol entry points from main code.
- */
-static void ccp_init __P((int unit));
-static void ccp_open __P((int unit));
-static void ccp_close __P((int unit, char *));
-static void ccp_lowerup __P((int unit));
-static void ccp_lowerdown __P((int));
-static void ccp_input __P((int unit, u_char *pkt, int len));
-static void ccp_protrej __P((int unit));
-static int ccp_printpkt __P((u_char *pkt, int len,
- void (*printer) __P((void *, char *, ...)),
- void *arg));
-static void ccp_datainput __P((int unit, u_char *pkt, int len));
-
-struct protent ccp_protent = {
- PPP_CCP,
- ccp_init,
- ccp_input,
- ccp_protrej,
- ccp_lowerup,
- ccp_lowerdown,
- ccp_open,
- ccp_close,
- ccp_printpkt,
- ccp_datainput,
- 1,
- "CCP",
- "Compressed",
- ccp_option_list,
- NULL,
- NULL,
- NULL
-};
-
-fsm ccp_fsm[NUM_PPP];
-ccp_options ccp_wantoptions[NUM_PPP]; /* what to request the peer to use */
-ccp_options ccp_gotoptions[NUM_PPP]; /* what the peer agreed to do */
-ccp_options ccp_allowoptions[NUM_PPP]; /* what we'll agree to do */
-ccp_options ccp_hisoptions[NUM_PPP]; /* what we agreed to do */
-
-/*
- * Callbacks for fsm code.
- */
-static void ccp_resetci __P((fsm *));
-static int ccp_cilen __P((fsm *));
-static void ccp_addci __P((fsm *, u_char *, int *));
-static int ccp_ackci __P((fsm *, u_char *, int));
-static int ccp_nakci __P((fsm *, u_char *, int));
-static int ccp_rejci __P((fsm *, u_char *, int));
-static int ccp_reqci __P((fsm *, u_char *, int *, int));
-static void ccp_up __P((fsm *));
-static void ccp_down __P((fsm *));
-static int ccp_extcode __P((fsm *, int, int, u_char *, int));
-static void ccp_rack_timeout __P((void *));
-static char *method_name __P((ccp_options *, ccp_options *));
-
-static fsm_callbacks ccp_callbacks = {
- ccp_resetci,
- ccp_cilen,
- ccp_addci,
- ccp_ackci,
- ccp_nakci,
- ccp_rejci,
- ccp_reqci,
- ccp_up,
- ccp_down,
- NULL,
- NULL,
- NULL,
- NULL,
- ccp_extcode,
- "CCP"
-};
-
-/*
- * Do we want / did we get any compression?
- */
-#define ANY_COMPRESS(opt) ((opt).deflate || (opt).bsd_compress \
- || (opt).predictor_1 || (opt).predictor_2)
-
-/*
- * Local state (mainly for handling reset-reqs and reset-acks).
- */
-static int ccp_localstate[NUM_PPP];
-#define RACK_PENDING 1 /* waiting for reset-ack */
-#define RREQ_REPEAT 2 /* send another reset-req if no reset-ack */
-
-#define RACKTIMEOUT 1 /* second */
-
-static int all_rejected[NUM_PPP]; /* we rejected all peer's options */
-
-/*
- * Option parsing.
- */
-static int
-setbsdcomp(argv)
- char **argv;
-{
- int rbits, abits;
- char *str, *endp;
-
- str = *argv;
- abits = rbits = strtol(str, &endp, 0);
- if (endp != str && *endp == ',') {
- str = endp + 1;
- abits = strtol(str, &endp, 0);
- }
- if (*endp != 0 || endp == str) {
- option_error("invalid parameter '%s' for bsdcomp option", *argv);
- return 0;
- }
- if ((rbits != 0 && (rbits < BSD_MIN_BITS || rbits > BSD_MAX_BITS))
- || (abits != 0 && (abits < BSD_MIN_BITS || abits > BSD_MAX_BITS))) {
- option_error("bsdcomp option values must be 0 or %d .. %d",
- BSD_MIN_BITS, BSD_MAX_BITS);
- return 0;
- }
- if (rbits > 0) {
- ccp_wantoptions[0].bsd_compress = 1;
- ccp_wantoptions[0].bsd_bits = rbits;
- } else
- ccp_wantoptions[0].bsd_compress = 0;
- if (abits > 0) {
- ccp_allowoptions[0].bsd_compress = 1;
- ccp_allowoptions[0].bsd_bits = abits;
- } else
- ccp_allowoptions[0].bsd_compress = 0;
- slprintf(bsd_value, sizeof(bsd_value),
- rbits == abits? "%d": "%d,%d", rbits, abits);
-
- return 1;
-}
-
-static int
-setdeflate(argv)
- char **argv;
-{
- int rbits, abits;
- char *str, *endp;
-
- str = *argv;
- abits = rbits = strtol(str, &endp, 0);
- if (endp != str && *endp == ',') {
- str = endp + 1;
- abits = strtol(str, &endp, 0);
- }
- if (*endp != 0 || endp == str) {
- option_error("invalid parameter '%s' for deflate option", *argv);
- return 0;
- }
- if ((rbits != 0 && (rbits < DEFLATE_MIN_SIZE || rbits > DEFLATE_MAX_SIZE))
- || (abits != 0 && (abits < DEFLATE_MIN_SIZE
- || abits > DEFLATE_MAX_SIZE))) {
- option_error("deflate option values must be 0 or %d .. %d",
- DEFLATE_MIN_SIZE, DEFLATE_MAX_SIZE);
- return 0;
- }
- if (rbits == DEFLATE_MIN_SIZE || abits == DEFLATE_MIN_SIZE) {
- if (rbits == DEFLATE_MIN_SIZE)
- rbits = DEFLATE_MIN_WORKS;
- if (abits == DEFLATE_MIN_SIZE)
- abits = DEFLATE_MIN_WORKS;
- warn("deflate option value of %d changed to %d to avoid zlib bug",
- DEFLATE_MIN_SIZE, DEFLATE_MIN_WORKS);
- }
- if (rbits > 0) {
- ccp_wantoptions[0].deflate = 1;
- ccp_wantoptions[0].deflate_size = rbits;
- } else
- ccp_wantoptions[0].deflate = 0;
- if (abits > 0) {
- ccp_allowoptions[0].deflate = 1;
- ccp_allowoptions[0].deflate_size = abits;
- } else
- ccp_allowoptions[0].deflate = 0;
- slprintf(deflate_value, sizeof(deflate_value),
- rbits == abits? "%d": "%d,%d", rbits, abits);
-
- return 1;
-}
-
-/*
- * ccp_init - initialize CCP.
- */
-static void
-ccp_init(unit)
- int unit;
-{
- fsm *f = &ccp_fsm[unit];
-
- f->unit = unit;
- f->protocol = PPP_CCP;
- f->callbacks = &ccp_callbacks;
- fsm_init(f);
-
- memset(&ccp_wantoptions[unit], 0, sizeof(ccp_options));
- memset(&ccp_gotoptions[unit], 0, sizeof(ccp_options));
- memset(&ccp_allowoptions[unit], 0, sizeof(ccp_options));
- memset(&ccp_hisoptions[unit], 0, sizeof(ccp_options));
-
- ccp_wantoptions[0].deflate = 1;
- ccp_wantoptions[0].deflate_size = DEFLATE_MAX_SIZE;
- ccp_wantoptions[0].deflate_correct = 1;
- ccp_wantoptions[0].deflate_draft = 1;
- ccp_allowoptions[0].deflate = 1;
- ccp_allowoptions[0].deflate_size = DEFLATE_MAX_SIZE;
- ccp_allowoptions[0].deflate_correct = 1;
- ccp_allowoptions[0].deflate_draft = 1;
-
- ccp_wantoptions[0].bsd_compress = 1;
- ccp_wantoptions[0].bsd_bits = BSD_MAX_BITS;
- ccp_allowoptions[0].bsd_compress = 1;
- ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS;
-
- ccp_allowoptions[0].predictor_1 = 1;
-}
-
-/*
- * ccp_open - CCP is allowed to come up.
- */
-static void
-ccp_open(unit)
- int unit;
-{
- fsm *f = &ccp_fsm[unit];
-
- if (f->state != OPENED)
- ccp_flags_set(unit, 1, 0);
-
- /*
- * Find out which compressors the kernel supports before
- * deciding whether to open in silent mode.
- */
- ccp_resetci(f);
- if (!ANY_COMPRESS(ccp_gotoptions[unit]))
- f->flags |= OPT_SILENT;
-
- fsm_open(f);
-}
-
-/*
- * ccp_close - Terminate CCP.
- */
-static void
-ccp_close(unit, reason)
- int unit;
- char *reason;
-{
- ccp_flags_set(unit, 0, 0);
- fsm_close(&ccp_fsm[unit], reason);
-}
-
-/*
- * ccp_lowerup - we may now transmit CCP packets.
- */
-static void
-ccp_lowerup(unit)
- int unit;
-{
- fsm_lowerup(&ccp_fsm[unit]);
-}
-
-/*
- * ccp_lowerdown - we may not transmit CCP packets.
- */
-static void
-ccp_lowerdown(unit)
- int unit;
-{
- fsm_lowerdown(&ccp_fsm[unit]);
-}
-
-/*
- * ccp_input - process a received CCP packet.
- */
-static void
-ccp_input(unit, p, len)
- int unit;
- u_char *p;
- int len;
-{
- fsm *f = &ccp_fsm[unit];
- int oldstate;
-
- /*
- * Check for a terminate-request so we can print a message.
- */
- oldstate = f->state;
- fsm_input(f, p, len);
- if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED)
- notice("Compression disabled by peer.");
-
- /*
- * If we get a terminate-ack and we're not asking for compression,
- * close CCP.
- */
- if (oldstate == REQSENT && p[0] == TERMACK
- && !ANY_COMPRESS(ccp_gotoptions[unit]))
- ccp_close(unit, "No compression negotiated");
-}
-
-/*
- * Handle a CCP-specific code.
- */
-static int
-ccp_extcode(f, code, id, p, len)
- fsm *f;
- int code, id;
- u_char *p;
- int len;
-{
- switch (code) {
- case CCP_RESETREQ:
- if (f->state != OPENED)
- break;
- /* send a reset-ack, which the transmitter will see and
- reset its compression state. */
- fsm_sdata(f, CCP_RESETACK, id, NULL, 0);
- break;
-
- case CCP_RESETACK:
- if (ccp_localstate[f->unit] & RACK_PENDING && id == f->reqid) {
- ccp_localstate[f->unit] &= ~(RACK_PENDING | RREQ_REPEAT);
- UNTIMEOUT(ccp_rack_timeout, f);
- }
- break;
-
- default:
- return 0;
- }
-
- return 1;
-}
-
-/*
- * ccp_protrej - peer doesn't talk CCP.
- */
-static void
-ccp_protrej(unit)
- int unit;
-{
- ccp_flags_set(unit, 0, 0);
- fsm_lowerdown(&ccp_fsm[unit]);
-}
-
-/*
- * ccp_resetci - initialize at start of negotiation.
- */
-static void
-ccp_resetci(f)
- fsm *f;
-{
- ccp_options *go = &ccp_gotoptions[f->unit];
- u_char opt_buf[16];
-
- *go = ccp_wantoptions[f->unit];
- all_rejected[f->unit] = 0;
-
- /*
- * Check whether the kernel knows about the various
- * compression methods we might request.
- */
- if (go->bsd_compress) {
- opt_buf[0] = CI_BSD_COMPRESS;
- opt_buf[1] = CILEN_BSD_COMPRESS;
- opt_buf[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, BSD_MIN_BITS);
- if (ccp_test(f->unit, opt_buf, CILEN_BSD_COMPRESS, 0) <= 0)
- go->bsd_compress = 0;
- }
- if (go->deflate) {
- if (go->deflate_correct) {
- opt_buf[0] = CI_DEFLATE;
- opt_buf[1] = CILEN_DEFLATE;
- opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_WORKS);
- opt_buf[3] = DEFLATE_CHK_SEQUENCE;
- if (ccp_test(f->unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
- go->deflate_correct = 0;
- }
- if (go->deflate_draft) {
- opt_buf[0] = CI_DEFLATE_DRAFT;
- opt_buf[1] = CILEN_DEFLATE;
- opt_buf[2] = DEFLATE_MAKE_OPT(DEFLATE_MIN_WORKS);
- opt_buf[3] = DEFLATE_CHK_SEQUENCE;
- if (ccp_test(f->unit, opt_buf, CILEN_DEFLATE, 0) <= 0)
- go->deflate_draft = 0;
- }
- if (!go->deflate_correct && !go->deflate_draft)
- go->deflate = 0;
- }
- if (go->predictor_1) {
- opt_buf[0] = CI_PREDICTOR_1;
- opt_buf[1] = CILEN_PREDICTOR_1;
- if (ccp_test(f->unit, opt_buf, CILEN_PREDICTOR_1, 0) <= 0)
- go->predictor_1 = 0;
- }
- if (go->predictor_2) {
- opt_buf[0] = CI_PREDICTOR_2;
- opt_buf[1] = CILEN_PREDICTOR_2;
- if (ccp_test(f->unit, opt_buf, CILEN_PREDICTOR_2, 0) <= 0)
- go->predictor_2 = 0;
- }
-}
-
-/*
- * ccp_cilen - Return total length of our configuration info.
- */
-static int
-ccp_cilen(f)
- fsm *f;
-{
- ccp_options *go = &ccp_gotoptions[f->unit];
-
- return (go->bsd_compress? CILEN_BSD_COMPRESS: 0)
- + (go->deflate? CILEN_DEFLATE: 0)
- + (go->predictor_1? CILEN_PREDICTOR_1: 0)
- + (go->predictor_2? CILEN_PREDICTOR_2: 0);
-}
-
-/*
- * ccp_addci - put our requests in a packet.
- */
-static void
-ccp_addci(f, p, lenp)
- fsm *f;
- u_char *p;
- int *lenp;
-{
- int res;
- ccp_options *go = &ccp_gotoptions[f->unit];
- u_char *p0 = p;
-
- /*
- * Add the compression types that we can receive, in decreasing
- * preference order. Get the kernel to allocate the first one
- * in case it gets Acked.
- */
- if (go->deflate) {
- p[0] = go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT;
- p[1] = CILEN_DEFLATE;
- p[2] = DEFLATE_MAKE_OPT(go->deflate_size);
- p[3] = DEFLATE_CHK_SEQUENCE;
- for (;;) {
- res = ccp_test(f->unit, p, CILEN_DEFLATE, 0);
- if (res > 0) {
- p += CILEN_DEFLATE;
- break;
- }
- if (res < 0 || go->deflate_size <= DEFLATE_MIN_WORKS) {
- go->deflate = 0;
- break;
- }
- --go->deflate_size;
- p[2] = DEFLATE_MAKE_OPT(go->deflate_size);
- }
- if (p != p0 && go->deflate_correct && go->deflate_draft) {
- p[0] = CI_DEFLATE_DRAFT;
- p[1] = CILEN_DEFLATE;
- p[2] = p[2 - CILEN_DEFLATE];
- p[3] = DEFLATE_CHK_SEQUENCE;
- p += CILEN_DEFLATE;
- }
- }
- if (go->bsd_compress) {
- p[0] = CI_BSD_COMPRESS;
- p[1] = CILEN_BSD_COMPRESS;
- p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits);
- if (p != p0) {
- p += CILEN_BSD_COMPRESS; /* not the first option */
- } else {
- for (;;) {
- res = ccp_test(f->unit, p, CILEN_BSD_COMPRESS, 0);
- if (res > 0) {
- p += CILEN_BSD_COMPRESS;
- break;
- }
- if (res < 0 || go->bsd_bits <= BSD_MIN_BITS) {
- go->bsd_compress = 0;
- break;
- }
- --go->bsd_bits;
- p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits);
- }
- }
- }
- /* XXX Should Predictor 2 be preferable to Predictor 1? */
- if (go->predictor_1) {
- p[0] = CI_PREDICTOR_1;
- p[1] = CILEN_PREDICTOR_1;
- if (p == p0 && ccp_test(f->unit, p, CILEN_PREDICTOR_1, 0) <= 0) {
- go->predictor_1 = 0;
- } else {
- p += CILEN_PREDICTOR_1;
- }
- }
- if (go->predictor_2) {
- p[0] = CI_PREDICTOR_2;
- p[1] = CILEN_PREDICTOR_2;
- if (p == p0 && ccp_test(f->unit, p, CILEN_PREDICTOR_2, 0) <= 0) {
- go->predictor_2 = 0;
- } else {
- p += CILEN_PREDICTOR_2;
- }
- }
-
- go->method = (p > p0)? p0[0]: -1;
-
- *lenp = p - p0;
-}
-
-/*
- * ccp_ackci - process a received configure-ack, and return
- * 1 iff the packet was OK.
- */
-static int
-ccp_ackci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ccp_options *go = &ccp_gotoptions[f->unit];
- u_char *p0 = p;
-
- if (go->deflate) {
- if (len < CILEN_DEFLATE
- || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
- || p[1] != CILEN_DEFLATE
- || p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
- || p[3] != DEFLATE_CHK_SEQUENCE)
- return 0;
- p += CILEN_DEFLATE;
- len -= CILEN_DEFLATE;
- /* XXX Cope with first/fast ack */
- if (len == 0)
- return 1;
- if (go->deflate_correct && go->deflate_draft) {
- if (len < CILEN_DEFLATE
- || p[0] != CI_DEFLATE_DRAFT
- || p[1] != CILEN_DEFLATE
- || p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
- || p[3] != DEFLATE_CHK_SEQUENCE)
- return 0;
- p += CILEN_DEFLATE;
- len -= CILEN_DEFLATE;
- }
- }
- if (go->bsd_compress) {
- if (len < CILEN_BSD_COMPRESS
- || p[0] != CI_BSD_COMPRESS || p[1] != CILEN_BSD_COMPRESS
- || p[2] != BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits))
- return 0;
- p += CILEN_BSD_COMPRESS;
- len -= CILEN_BSD_COMPRESS;
- /* XXX Cope with first/fast ack */
- if (p == p0 && len == 0)
- return 1;
- }
- if (go->predictor_1) {
- if (len < CILEN_PREDICTOR_1
- || p[0] != CI_PREDICTOR_1 || p[1] != CILEN_PREDICTOR_1)
- return 0;
- p += CILEN_PREDICTOR_1;
- len -= CILEN_PREDICTOR_1;
- /* XXX Cope with first/fast ack */
- if (p == p0 && len == 0)
- return 1;
- }
- if (go->predictor_2) {
- if (len < CILEN_PREDICTOR_2
- || p[0] != CI_PREDICTOR_2 || p[1] != CILEN_PREDICTOR_2)
- return 0;
- p += CILEN_PREDICTOR_2;
- len -= CILEN_PREDICTOR_2;
- /* XXX Cope with first/fast ack */
- if (p == p0 && len == 0)
- return 1;
- }
-
- if (len != 0)
- return 0;
- return 1;
-}
-
-/*
- * ccp_nakci - process received configure-nak.
- * Returns 1 iff the nak was OK.
- */
-static int
-ccp_nakci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ccp_options *go = &ccp_gotoptions[f->unit];
- ccp_options no; /* options we've seen already */
- ccp_options try; /* options to ask for next time */
-
- memset(&no, 0, sizeof(no));
- try = *go;
-
- if (go->deflate && len >= CILEN_DEFLATE
- && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
- && p[1] == CILEN_DEFLATE) {
- no.deflate = 1;
- /*
- * Peer wants us to use a different code size or something.
- * Stop asking for Deflate if we don't understand his suggestion.
- */
- if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL
- || DEFLATE_SIZE(p[2]) < DEFLATE_MIN_WORKS
- || p[3] != DEFLATE_CHK_SEQUENCE)
- try.deflate = 0;
- else if (DEFLATE_SIZE(p[2]) < go->deflate_size)
- try.deflate_size = DEFLATE_SIZE(p[2]);
- p += CILEN_DEFLATE;
- len -= CILEN_DEFLATE;
- if (go->deflate_correct && go->deflate_draft
- && len >= CILEN_DEFLATE && p[0] == CI_DEFLATE_DRAFT
- && p[1] == CILEN_DEFLATE) {
- p += CILEN_DEFLATE;
- len -= CILEN_DEFLATE;
- }
- }
-
- if (go->bsd_compress && len >= CILEN_BSD_COMPRESS
- && p[0] == CI_BSD_COMPRESS && p[1] == CILEN_BSD_COMPRESS) {
- no.bsd_compress = 1;
- /*
- * Peer wants us to use a different number of bits
- * or a different version.
- */
- if (BSD_VERSION(p[2]) != BSD_CURRENT_VERSION)
- try.bsd_compress = 0;
- else if (BSD_NBITS(p[2]) < go->bsd_bits)
- try.bsd_bits = BSD_NBITS(p[2]);
- p += CILEN_BSD_COMPRESS;
- len -= CILEN_BSD_COMPRESS;
- }
-
- /*
- * Predictor-1 and 2 have no options, so they can't be Naked.
- *
- * There may be remaining options but we ignore them.
- */
-
- if (f->state != OPENED)
- *go = try;
- return 1;
-}
-
-/*
- * ccp_rejci - reject some of our suggested compression methods.
- */
-static int
-ccp_rejci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ccp_options *go = &ccp_gotoptions[f->unit];
- ccp_options try; /* options to request next time */
-
- try = *go;
-
- /*
- * Cope with empty configure-rejects by ceasing to send
- * configure-requests.
- */
- if (len == 0 && all_rejected[f->unit])
- return -1;
-
- if (go->deflate && len >= CILEN_DEFLATE
- && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
- && p[1] == CILEN_DEFLATE) {
- if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
- || p[3] != DEFLATE_CHK_SEQUENCE)
- return 0; /* Rej is bad */
- if (go->deflate_correct)
- try.deflate_correct = 0;
- else
- try.deflate_draft = 0;
- p += CILEN_DEFLATE;
- len -= CILEN_DEFLATE;
- if (go->deflate_correct && go->deflate_draft
- && len >= CILEN_DEFLATE && p[0] == CI_DEFLATE_DRAFT
- && p[1] == CILEN_DEFLATE) {
- if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
- || p[3] != DEFLATE_CHK_SEQUENCE)
- return 0; /* Rej is bad */
- try.deflate_draft = 0;
- p += CILEN_DEFLATE;
- len -= CILEN_DEFLATE;
- }
- if (!try.deflate_correct && !try.deflate_draft)
- try.deflate = 0;
- }
- if (go->bsd_compress && len >= CILEN_BSD_COMPRESS
- && p[0] == CI_BSD_COMPRESS && p[1] == CILEN_BSD_COMPRESS) {
- if (p[2] != BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits))
- return 0;
- try.bsd_compress = 0;
- p += CILEN_BSD_COMPRESS;
- len -= CILEN_BSD_COMPRESS;
- }
- if (go->predictor_1 && len >= CILEN_PREDICTOR_1
- && p[0] == CI_PREDICTOR_1 && p[1] == CILEN_PREDICTOR_1) {
- try.predictor_1 = 0;
- p += CILEN_PREDICTOR_1;
- len -= CILEN_PREDICTOR_1;
- }
- if (go->predictor_2 && len >= CILEN_PREDICTOR_2
- && p[0] == CI_PREDICTOR_2 && p[1] == CILEN_PREDICTOR_2) {
- try.predictor_2 = 0;
- p += CILEN_PREDICTOR_2;
- len -= CILEN_PREDICTOR_2;
- }
-
- if (len != 0)
- return 0;
-
- if (f->state != OPENED)
- *go = try;
-
- return 1;
-}
-
-/*
- * ccp_reqci - processed a received configure-request.
- * Returns CONFACK, CONFNAK or CONFREJ and the packet modified
- * appropriately.
- */
-static int
-ccp_reqci(f, p, lenp, dont_nak)
- fsm *f;
- u_char *p;
- int *lenp;
- int dont_nak;
-{
- int ret, newret, res;
- u_char *p0, *retp;
- int len, clen, type, nb;
- ccp_options *ho = &ccp_hisoptions[f->unit];
- ccp_options *ao = &ccp_allowoptions[f->unit];
-
- ret = CONFACK;
- retp = p0 = p;
- len = *lenp;
-
- memset(ho, 0, sizeof(ccp_options));
- ho->method = (len > 0)? p[0]: -1;
-
- while (len > 0) {
- newret = CONFACK;
- if (len < 2 || p[1] < 2 || p[1] > len) {
- /* length is bad */
- clen = len;
- newret = CONFREJ;
-
- } else {
- type = p[0];
- clen = p[1];
-
- switch (type) {
- case CI_DEFLATE:
- case CI_DEFLATE_DRAFT:
- if (!ao->deflate || clen != CILEN_DEFLATE
- || (!ao->deflate_correct && type == CI_DEFLATE)
- || (!ao->deflate_draft && type == CI_DEFLATE_DRAFT)) {
- newret = CONFREJ;
- break;
- }
-
- ho->deflate = 1;
- ho->deflate_size = nb = DEFLATE_SIZE(p[2]);
- if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL
- || p[3] != DEFLATE_CHK_SEQUENCE
- || nb > ao->deflate_size || nb < DEFLATE_MIN_WORKS) {
- newret = CONFNAK;
- if (!dont_nak) {
- p[2] = DEFLATE_MAKE_OPT(ao->deflate_size);
- p[3] = DEFLATE_CHK_SEQUENCE;
- /* fall through to test this #bits below */
- } else
- break;
- }
-
- /*
- * Check whether we can do Deflate with the window
- * size they want. If the window is too big, reduce
- * it until the kernel can cope and nak with that.
- * We only check this for the first option.
- */
- if (p == p0) {
- for (;;) {
- res = ccp_test(f->unit, p, CILEN_DEFLATE, 1);
- if (res > 0)
- break; /* it's OK now */
- if (res < 0 || nb == DEFLATE_MIN_WORKS || dont_nak) {
- newret = CONFREJ;
- p[2] = DEFLATE_MAKE_OPT(ho->deflate_size);
- break;
- }
- newret = CONFNAK;
- --nb;
- p[2] = DEFLATE_MAKE_OPT(nb);
- }
- }
- break;
-
- case CI_BSD_COMPRESS:
- if (!ao->bsd_compress || clen != CILEN_BSD_COMPRESS) {
- newret = CONFREJ;
- break;
- }
-
- ho->bsd_compress = 1;
- ho->bsd_bits = nb = BSD_NBITS(p[2]);
- if (BSD_VERSION(p[2]) != BSD_CURRENT_VERSION
- || nb > ao->bsd_bits || nb < BSD_MIN_BITS) {
- newret = CONFNAK;
- if (!dont_nak) {
- p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, ao->bsd_bits);
- /* fall through to test this #bits below */
- } else
- break;
- }
-
- /*
- * Check whether we can do BSD-Compress with the code
- * size they want. If the code size is too big, reduce
- * it until the kernel can cope and nak with that.
- * We only check this for the first option.
- */
- if (p == p0) {
- for (;;) {
- res = ccp_test(f->unit, p, CILEN_BSD_COMPRESS, 1);
- if (res > 0)
- break;
- if (res < 0 || nb == BSD_MIN_BITS || dont_nak) {
- newret = CONFREJ;
- p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION,
- ho->bsd_bits);
- break;
- }
- newret = CONFNAK;
- --nb;
- p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, nb);
- }
- }
- break;
-
- case CI_PREDICTOR_1:
- if (!ao->predictor_1 || clen != CILEN_PREDICTOR_1) {
- newret = CONFREJ;
- break;
- }
-
- ho->predictor_1 = 1;
- if (p == p0
- && ccp_test(f->unit, p, CILEN_PREDICTOR_1, 1) <= 0) {
- newret = CONFREJ;
- }
- break;
-
- case CI_PREDICTOR_2:
- if (!ao->predictor_2 || clen != CILEN_PREDICTOR_2) {
- newret = CONFREJ;
- break;
- }
-
- ho->predictor_2 = 1;
- if (p == p0
- && ccp_test(f->unit, p, CILEN_PREDICTOR_2, 1) <= 0) {
- newret = CONFREJ;
- }
- break;
-
- default:
- newret = CONFREJ;
- }
- }
-
- if (newret == CONFNAK && dont_nak)
- newret = CONFREJ;
- if (!(newret == CONFACK || (newret == CONFNAK && ret == CONFREJ))) {
- /* we're returning this option */
- if (newret == CONFREJ && ret == CONFNAK)
- retp = p0;
- ret = newret;
- if (p != retp)
- BCOPY(p, retp, clen);
- retp += clen;
- }
-
- p += clen;
- len -= clen;
- }
-
- if (ret != CONFACK) {
- if (ret == CONFREJ && *lenp == retp - p0)
- all_rejected[f->unit] = 1;
- else
- *lenp = retp - p0;
- }
- return ret;
-}
-
-/*
- * Make a string name for a compression method (or 2).
- */
-static char *
-method_name(opt, opt2)
- ccp_options *opt, *opt2;
-{
- static char result[64];
-
- if (!ANY_COMPRESS(*opt))
- return "(none)";
- switch (opt->method) {
- case CI_DEFLATE:
- case CI_DEFLATE_DRAFT:
- if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
- slprintf(result, sizeof(result), "Deflate%s (%d/%d)",
- (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
- opt->deflate_size, opt2->deflate_size);
- else
- slprintf(result, sizeof(result), "Deflate%s (%d)",
- (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
- opt->deflate_size);
- break;
- case CI_BSD_COMPRESS:
- if (opt2 != NULL && opt2->bsd_bits != opt->bsd_bits)
- slprintf(result, sizeof(result), "BSD-Compress (%d/%d)",
- opt->bsd_bits, opt2->bsd_bits);
- else
- slprintf(result, sizeof(result), "BSD-Compress (%d)",
- opt->bsd_bits);
- break;
- case CI_PREDICTOR_1:
- return "Predictor 1";
- case CI_PREDICTOR_2:
- return "Predictor 2";
- default:
- slprintf(result, sizeof(result), "Method %d", opt->method);
- }
- return result;
-}
-
-/*
- * CCP has come up - inform the kernel driver and log a message.
- */
-static void
-ccp_up(f)
- fsm *f;
-{
- ccp_options *go = &ccp_gotoptions[f->unit];
- ccp_options *ho = &ccp_hisoptions[f->unit];
- char method1[64];
-
- ccp_flags_set(f->unit, 1, 1);
- if (ANY_COMPRESS(*go)) {
- if (ANY_COMPRESS(*ho)) {
- if (go->method == ho->method) {
- notice("%s compression enabled", method_name(go, ho));
- } else {
- strlcpy(method1, method_name(go, NULL), sizeof(method1));
- notice("%s / %s compression enabled",
- method1, method_name(ho, NULL));
- }
- } else
- notice("%s receive compression enabled", method_name(go, NULL));
- } else if (ANY_COMPRESS(*ho))
- notice("%s transmit compression enabled", method_name(ho, NULL));
-}
-
-/*
- * CCP has gone down - inform the kernel driver.
- */
-static void
-ccp_down(f)
- fsm *f;
-{
- if (ccp_localstate[f->unit] & RACK_PENDING)
- UNTIMEOUT(ccp_rack_timeout, f);
- ccp_localstate[f->unit] = 0;
- ccp_flags_set(f->unit, 1, 0);
-}
-
-/*
- * Print the contents of a CCP packet.
- */
-static char *ccp_codenames[] = {
- "ConfReq", "ConfAck", "ConfNak", "ConfRej",
- "TermReq", "TermAck", "CodeRej",
- NULL, NULL, NULL, NULL, NULL, NULL,
- "ResetReq", "ResetAck",
-};
-
-static int
-ccp_printpkt(p, plen, printer, arg)
- u_char *p;
- int plen;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- u_char *p0, *optend;
- int code, id, len;
- int optlen;
-
- p0 = p;
- if (plen < HEADERLEN)
- return 0;
- code = p[0];
- id = p[1];
- len = (p[2] << 8) + p[3];
- if (len < HEADERLEN || len > plen)
- return 0;
-
- if (code >= 1 && code <= sizeof(ccp_codenames) / sizeof(char *)
- && ccp_codenames[code-1] != NULL)
- printer(arg, " %s", ccp_codenames[code-1]);
- else
- printer(arg, " code=0x%x", code);
- printer(arg, " id=0x%x", id);
- len -= HEADERLEN;
- p += HEADERLEN;
-
- switch (code) {
- case CONFREQ:
- case CONFACK:
- case CONFNAK:
- case CONFREJ:
- /* print list of possible compression methods */
- while (len >= 2) {
- code = p[0];
- optlen = p[1];
- if (optlen < 2 || optlen > len)
- break;
- printer(arg, " <");
- len -= optlen;
- optend = p + optlen;
- switch (code) {
- case CI_DEFLATE:
- case CI_DEFLATE_DRAFT:
- if (optlen >= CILEN_DEFLATE) {
- printer(arg, "deflate%s %d",
- (code == CI_DEFLATE_DRAFT? "(old#)": ""),
- DEFLATE_SIZE(p[2]));
- if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL)
- printer(arg, " method %d", DEFLATE_METHOD(p[2]));
- if (p[3] != DEFLATE_CHK_SEQUENCE)
- printer(arg, " check %d", p[3]);
- p += CILEN_DEFLATE;
- }
- break;
- case CI_BSD_COMPRESS:
- if (optlen >= CILEN_BSD_COMPRESS) {
- printer(arg, "bsd v%d %d", BSD_VERSION(p[2]),
- BSD_NBITS(p[2]));
- p += CILEN_BSD_COMPRESS;
- }
- break;
- case CI_PREDICTOR_1:
- if (optlen >= CILEN_PREDICTOR_1) {
- printer(arg, "predictor 1");
- p += CILEN_PREDICTOR_1;
- }
- break;
- case CI_PREDICTOR_2:
- if (optlen >= CILEN_PREDICTOR_2) {
- printer(arg, "predictor 2");
- p += CILEN_PREDICTOR_2;
- }
- break;
- }
- while (p < optend)
- printer(arg, " %.2x", *p++);
- printer(arg, ">");
- }
- break;
-
- case TERMACK:
- case TERMREQ:
- if (len > 0 && *p >= ' ' && *p < 0x7f) {
- print_string((char *)p, len, printer, arg);
- p += len;
- len = 0;
- }
- break;
- }
-
- /* dump out the rest of the packet in hex */
- while (--len >= 0)
- printer(arg, " %.2x", *p++);
-
- return p - p0;
-}
-
-/*
- * We have received a packet that the decompressor failed to
- * decompress. Here we would expect to issue a reset-request, but
- * Motorola has a patent on resetting the compressor as a result of
- * detecting an error in the decompressed data after decompression.
- * (See US patent 5,130,993; international patent publication number
- * WO 91/10289; Australian patent 73296/91.)
- *
- * So we ask the kernel whether the error was detected after
- * decompression; if it was, we take CCP down, thus disabling
- * compression :-(, otherwise we issue the reset-request.
- */
-static void
-ccp_datainput(unit, pkt, len)
- int unit;
- u_char *pkt;
- int len;
-{
- fsm *f;
-
- f = &ccp_fsm[unit];
- if (f->state == OPENED) {
- if (ccp_fatal_error(unit)) {
- /*
- * Disable compression by taking CCP down.
- */
- error("Lost compression sync: disabling compression");
- ccp_close(unit, "Lost compression sync");
- } else {
- /*
- * Send a reset-request to reset the peer's compressor.
- * We don't do that if we are still waiting for an
- * acknowledgement to a previous reset-request.
- */
- if (!(ccp_localstate[f->unit] & RACK_PENDING)) {
- fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
- TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
- ccp_localstate[f->unit] |= RACK_PENDING;
- } else
- ccp_localstate[f->unit] |= RREQ_REPEAT;
- }
- }
-}
-
-/*
- * Timeout waiting for reset-ack.
- */
-static void
-ccp_rack_timeout(arg)
- void *arg;
-{
- fsm *f = arg;
-
- if (f->state == OPENED && ccp_localstate[f->unit] & RREQ_REPEAT) {
- fsm_sdata(f, CCP_RESETREQ, f->reqid, NULL, 0);
- TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
- ccp_localstate[f->unit] &= ~RREQ_REPEAT;
- } else
- ccp_localstate[f->unit] &= ~RACK_PENDING;
-}
-
diff --git a/mdk-stage1/ppp/pppd/ccp.h b/mdk-stage1/ppp/pppd/ccp.h
deleted file mode 100644
index 609d858c5..000000000
--- a/mdk-stage1/ppp/pppd/ccp.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * ccp.h - Definitions for PPP Compression Control Protocol.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies. This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- *
- * $Id$
- */
-
-typedef struct ccp_options {
- bool bsd_compress; /* do BSD Compress? */
- bool deflate; /* do Deflate? */
- bool predictor_1; /* do Predictor-1? */
- bool predictor_2; /* do Predictor-2? */
- bool deflate_correct; /* use correct code for deflate? */
- bool deflate_draft; /* use draft RFC code for deflate? */
- u_short bsd_bits; /* # bits/code for BSD Compress */
- u_short deflate_size; /* lg(window size) for Deflate */
- short method; /* code for chosen compression method */
-} ccp_options;
-
-extern fsm ccp_fsm[];
-extern ccp_options ccp_wantoptions[];
-extern ccp_options ccp_gotoptions[];
-extern ccp_options ccp_allowoptions[];
-extern ccp_options ccp_hisoptions[];
-
-extern struct protent ccp_protent;
diff --git a/mdk-stage1/ppp/pppd/chap.c b/mdk-stage1/ppp/pppd/chap.c
deleted file mode 100644
index 54c0e0095..000000000
--- a/mdk-stage1/ppp/pppd/chap.c
+++ /dev/null
@@ -1,860 +0,0 @@
-/*
- * chap.c - Challenge Handshake Authentication Protocol.
- *
- * Copyright (c) 1993 The Australian National University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the Australian National University. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Copyright (c) 1991 Gregory M. Christy.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Gregory M. Christy. The name of the author may not be used to
- * endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-/*
- * TODO:
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include "pppd.h"
-#include "chap.h"
-#include "md5.h"
-#ifdef CHAPMS
-#include "chap_ms.h"
-#endif
-
-static const char rcsid[] = RCSID;
-
-/*
- * Command-line options.
- */
-static option_t chap_option_list[] = {
- { "chap-restart", o_int, &chap[0].timeouttime,
- "Set timeout for CHAP", OPT_PRIO },
- { "chap-max-challenge", o_int, &chap[0].max_transmits,
- "Set max #xmits for challenge", OPT_PRIO },
- { "chap-interval", o_int, &chap[0].chal_interval,
- "Set interval for rechallenge", OPT_PRIO },
-#ifdef MSLANMAN
- { "ms-lanman", o_bool, &ms_lanman,
- "Use LanMan passwd when using MS-CHAP", 1 },
-#endif
- { NULL }
-};
-
-/*
- * Protocol entry points.
- */
-static void ChapInit __P((int));
-static void ChapLowerUp __P((int));
-static void ChapLowerDown __P((int));
-static void ChapInput __P((int, u_char *, int));
-static void ChapProtocolReject __P((int));
-static int ChapPrintPkt __P((u_char *, int,
- void (*) __P((void *, char *, ...)), void *));
-
-struct protent chap_protent = {
- PPP_CHAP,
- ChapInit,
- ChapInput,
- ChapProtocolReject,
- ChapLowerUp,
- ChapLowerDown,
- NULL,
- NULL,
- ChapPrintPkt,
- NULL,
- 1,
- "CHAP",
- NULL,
- chap_option_list,
- NULL,
- NULL,
- NULL
-};
-
-chap_state chap[NUM_PPP]; /* CHAP state; one for each unit */
-
-static void ChapChallengeTimeout __P((void *));
-static void ChapResponseTimeout __P((void *));
-static void ChapReceiveChallenge __P((chap_state *, u_char *, int, int));
-static void ChapRechallenge __P((void *));
-static void ChapReceiveResponse __P((chap_state *, u_char *, int, int));
-static void ChapReceiveSuccess __P((chap_state *, u_char *, int, int));
-static void ChapReceiveFailure __P((chap_state *, u_char *, int, int));
-static void ChapSendStatus __P((chap_state *, int));
-static void ChapSendChallenge __P((chap_state *));
-static void ChapSendResponse __P((chap_state *));
-static void ChapGenChallenge __P((chap_state *));
-
-extern double drand48 __P((void));
-extern void srand48 __P((long));
-
-/*
- * ChapInit - Initialize a CHAP unit.
- */
-static void
-ChapInit(unit)
- int unit;
-{
- chap_state *cstate = &chap[unit];
-
- BZERO(cstate, sizeof(*cstate));
- cstate->unit = unit;
- cstate->clientstate = CHAPCS_INITIAL;
- cstate->serverstate = CHAPSS_INITIAL;
- cstate->timeouttime = CHAP_DEFTIMEOUT;
- cstate->max_transmits = CHAP_DEFTRANSMITS;
- /* random number generator is initialized in magic_init */
-}
-
-
-/*
- * ChapAuthWithPeer - Authenticate us with our peer (start client).
- *
- */
-void
-ChapAuthWithPeer(unit, our_name, digest)
- int unit;
- char *our_name;
- int digest;
-{
- chap_state *cstate = &chap[unit];
-
- cstate->resp_name = our_name;
- cstate->resp_type = digest;
-
- if (cstate->clientstate == CHAPCS_INITIAL ||
- cstate->clientstate == CHAPCS_PENDING) {
- /* lower layer isn't up - wait until later */
- cstate->clientstate = CHAPCS_PENDING;
- return;
- }
-
- /*
- * We get here as a result of LCP coming up.
- * So even if CHAP was open before, we will
- * have to re-authenticate ourselves.
- */
- cstate->clientstate = CHAPCS_LISTEN;
-}
-
-
-/*
- * ChapAuthPeer - Authenticate our peer (start server).
- */
-void
-ChapAuthPeer(unit, our_name, digest)
- int unit;
- char *our_name;
- int digest;
-{
- chap_state *cstate = &chap[unit];
-
- cstate->chal_name = our_name;
- cstate->chal_type = digest;
-
- if (cstate->serverstate == CHAPSS_INITIAL ||
- cstate->serverstate == CHAPSS_PENDING) {
- /* lower layer isn't up - wait until later */
- cstate->serverstate = CHAPSS_PENDING;
- return;
- }
-
- ChapGenChallenge(cstate);
- ChapSendChallenge(cstate); /* crank it up dude! */
- cstate->serverstate = CHAPSS_INITIAL_CHAL;
-}
-
-
-/*
- * ChapChallengeTimeout - Timeout expired on sending challenge.
- */
-static void
-ChapChallengeTimeout(arg)
- void *arg;
-{
- chap_state *cstate = (chap_state *) arg;
-
- /* if we aren't sending challenges, don't worry. then again we */
- /* probably shouldn't be here either */
- if (cstate->serverstate != CHAPSS_INITIAL_CHAL &&
- cstate->serverstate != CHAPSS_RECHALLENGE)
- return;
-
- if (cstate->chal_transmits >= cstate->max_transmits) {
- /* give up on peer */
- error("Peer failed to respond to CHAP challenge");
- cstate->serverstate = CHAPSS_BADAUTH;
- auth_peer_fail(cstate->unit, PPP_CHAP);
- return;
- }
-
- ChapSendChallenge(cstate); /* Re-send challenge */
-}
-
-
-/*
- * ChapResponseTimeout - Timeout expired on sending response.
- */
-static void
-ChapResponseTimeout(arg)
- void *arg;
-{
- chap_state *cstate = (chap_state *) arg;
-
- /* if we aren't sending a response, don't worry. */
- if (cstate->clientstate != CHAPCS_RESPONSE)
- return;
-
- ChapSendResponse(cstate); /* re-send response */
-}
-
-
-/*
- * ChapRechallenge - Time to challenge the peer again.
- */
-static void
-ChapRechallenge(arg)
- void *arg;
-{
- chap_state *cstate = (chap_state *) arg;
-
- /* if we aren't sending a response, don't worry. */
- if (cstate->serverstate != CHAPSS_OPEN)
- return;
-
- ChapGenChallenge(cstate);
- ChapSendChallenge(cstate);
- cstate->serverstate = CHAPSS_RECHALLENGE;
-}
-
-
-/*
- * ChapLowerUp - The lower layer is up.
- *
- * Start up if we have pending requests.
- */
-static void
-ChapLowerUp(unit)
- int unit;
-{
- chap_state *cstate = &chap[unit];
-
- if (cstate->clientstate == CHAPCS_INITIAL)
- cstate->clientstate = CHAPCS_CLOSED;
- else if (cstate->clientstate == CHAPCS_PENDING)
- cstate->clientstate = CHAPCS_LISTEN;
-
- if (cstate->serverstate == CHAPSS_INITIAL)
- cstate->serverstate = CHAPSS_CLOSED;
- else if (cstate->serverstate == CHAPSS_PENDING) {
- ChapGenChallenge(cstate);
- ChapSendChallenge(cstate);
- cstate->serverstate = CHAPSS_INITIAL_CHAL;
- }
-}
-
-
-/*
- * ChapLowerDown - The lower layer is down.
- *
- * Cancel all timeouts.
- */
-static void
-ChapLowerDown(unit)
- int unit;
-{
- chap_state *cstate = &chap[unit];
-
- /* Timeout(s) pending? Cancel if so. */
- if (cstate->serverstate == CHAPSS_INITIAL_CHAL ||
- cstate->serverstate == CHAPSS_RECHALLENGE)
- UNTIMEOUT(ChapChallengeTimeout, cstate);
- else if (cstate->serverstate == CHAPSS_OPEN
- && cstate->chal_interval != 0)
- UNTIMEOUT(ChapRechallenge, cstate);
- if (cstate->clientstate == CHAPCS_RESPONSE)
- UNTIMEOUT(ChapResponseTimeout, cstate);
-
- cstate->clientstate = CHAPCS_INITIAL;
- cstate->serverstate = CHAPSS_INITIAL;
-}
-
-
-/*
- * ChapProtocolReject - Peer doesn't grok CHAP.
- */
-static void
-ChapProtocolReject(unit)
- int unit;
-{
- chap_state *cstate = &chap[unit];
-
- if (cstate->serverstate != CHAPSS_INITIAL &&
- cstate->serverstate != CHAPSS_CLOSED)
- auth_peer_fail(unit, PPP_CHAP);
- if (cstate->clientstate != CHAPCS_INITIAL &&
- cstate->clientstate != CHAPCS_CLOSED)
- auth_withpeer_fail(unit, PPP_CHAP);
- ChapLowerDown(unit); /* shutdown chap */
-}
-
-
-/*
- * ChapInput - Input CHAP packet.
- */
-static void
-ChapInput(unit, inpacket, packet_len)
- int unit;
- u_char *inpacket;
- int packet_len;
-{
- chap_state *cstate = &chap[unit];
- u_char *inp;
- u_char code, id;
- int len;
-
- /*
- * Parse header (code, id and length).
- * If packet too short, drop it.
- */
- inp = inpacket;
- if (packet_len < CHAP_HEADERLEN) {
- CHAPDEBUG(("ChapInput: rcvd short header."));
- return;
- }
- GETCHAR(code, inp);
- GETCHAR(id, inp);
- GETSHORT(len, inp);
- if (len < CHAP_HEADERLEN) {
- CHAPDEBUG(("ChapInput: rcvd illegal length."));
- return;
- }
- if (len > packet_len) {
- CHAPDEBUG(("ChapInput: rcvd short packet."));
- return;
- }
- len -= CHAP_HEADERLEN;
-
- /*
- * Action depends on code (as in fact it usually does :-).
- */
- switch (code) {
- case CHAP_CHALLENGE:
- ChapReceiveChallenge(cstate, inp, id, len);
- break;
-
- case CHAP_RESPONSE:
- ChapReceiveResponse(cstate, inp, id, len);
- break;
-
- case CHAP_FAILURE:
- ChapReceiveFailure(cstate, inp, id, len);
- break;
-
- case CHAP_SUCCESS:
- ChapReceiveSuccess(cstate, inp, id, len);
- break;
-
- default: /* Need code reject? */
- warn("Unknown CHAP code (%d) received.", code);
- break;
- }
-}
-
-
-/*
- * ChapReceiveChallenge - Receive Challenge and send Response.
- */
-static void
-ChapReceiveChallenge(cstate, inp, id, len)
- chap_state *cstate;
- u_char *inp;
- int id;
- int len;
-{
- int rchallenge_len;
- u_char *rchallenge;
- int secret_len;
- char secret[MAXSECRETLEN];
- char rhostname[256];
- MD5_CTX mdContext;
- u_char hash[MD5_SIGNATURE_SIZE];
-
- if (cstate->clientstate == CHAPCS_CLOSED ||
- cstate->clientstate == CHAPCS_PENDING) {
- CHAPDEBUG(("ChapReceiveChallenge: in state %d", cstate->clientstate));
- return;
- }
-
- if (len < 2) {
- CHAPDEBUG(("ChapReceiveChallenge: rcvd short packet."));
- return;
- }
-
- GETCHAR(rchallenge_len, inp);
- len -= sizeof (u_char) + rchallenge_len; /* now name field length */
- if (len < 0) {
- CHAPDEBUG(("ChapReceiveChallenge: rcvd short packet."));
- return;
- }
- rchallenge = inp;
- INCPTR(rchallenge_len, inp);
-
- if (len >= sizeof(rhostname))
- len = sizeof(rhostname) - 1;
- BCOPY(inp, rhostname, len);
- rhostname[len] = '\000';
-
- /* Microsoft doesn't send their name back in the PPP packet */
- if (explicit_remote || (remote_name[0] != 0 && rhostname[0] == 0)) {
- strlcpy(rhostname, remote_name, sizeof(rhostname));
- CHAPDEBUG(("ChapReceiveChallenge: using '%q' as remote name",
- rhostname));
- }
-
- /* get secret for authenticating ourselves with the specified host */
- if (!get_secret(cstate->unit, cstate->resp_name, rhostname,
- secret, &secret_len, 0)) {
- secret_len = 0; /* assume null secret if can't find one */
- warn("No CHAP secret found for authenticating us to %q", rhostname);
- }
-
- /* cancel response send timeout if necessary */
- if (cstate->clientstate == CHAPCS_RESPONSE)
- UNTIMEOUT(ChapResponseTimeout, cstate);
-
- cstate->resp_id = id;
- cstate->resp_transmits = 0;
-
- /* generate MD based on negotiated type */
- switch (cstate->resp_type) {
-
- case CHAP_DIGEST_MD5:
- MD5Init(&mdContext);
- MD5Update(&mdContext, &cstate->resp_id, 1);
- MD5Update(&mdContext, secret, secret_len);
- MD5Update(&mdContext, rchallenge, rchallenge_len);
- MD5Final(hash, &mdContext);
- BCOPY(hash, cstate->response, MD5_SIGNATURE_SIZE);
- cstate->resp_length = MD5_SIGNATURE_SIZE;
- break;
-
-#ifdef CHAPMS
- case CHAP_MICROSOFT:
- ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len);
- break;
-#endif
-
- default:
- CHAPDEBUG(("unknown digest type %d", cstate->resp_type));
- return;
- }
-
- BZERO(secret, sizeof(secret));
- ChapSendResponse(cstate);
-}
-
-
-/*
- * ChapReceiveResponse - Receive and process response.
- */
-static void
-ChapReceiveResponse(cstate, inp, id, len)
- chap_state *cstate;
- u_char *inp;
- int id;
- int len;
-{
- u_char *remmd, remmd_len;
- int secret_len, old_state;
- int code;
- char rhostname[256];
- MD5_CTX mdContext;
- char secret[MAXSECRETLEN];
- u_char hash[MD5_SIGNATURE_SIZE];
-
- if (cstate->serverstate == CHAPSS_CLOSED ||
- cstate->serverstate == CHAPSS_PENDING) {
- CHAPDEBUG(("ChapReceiveResponse: in state %d", cstate->serverstate));
- return;
- }
-
- if (id != cstate->chal_id)
- return; /* doesn't match ID of last challenge */
-
- /*
- * If we have received a duplicate or bogus Response,
- * we have to send the same answer (Success/Failure)
- * as we did for the first Response we saw.
- */
- if (cstate->serverstate == CHAPSS_OPEN) {
- ChapSendStatus(cstate, CHAP_SUCCESS);
- return;
- }
- if (cstate->serverstate == CHAPSS_BADAUTH) {
- ChapSendStatus(cstate, CHAP_FAILURE);
- return;
- }
-
- if (len < 2) {
- CHAPDEBUG(("ChapReceiveResponse: rcvd short packet."));
- return;
- }
- GETCHAR(remmd_len, inp); /* get length of MD */
- remmd = inp; /* get pointer to MD */
- INCPTR(remmd_len, inp);
-
- len -= sizeof (u_char) + remmd_len;
- if (len < 0) {
- CHAPDEBUG(("ChapReceiveResponse: rcvd short packet."));
- return;
- }
-
- UNTIMEOUT(ChapChallengeTimeout, cstate);
-
- if (len >= sizeof(rhostname))
- len = sizeof(rhostname) - 1;
- BCOPY(inp, rhostname, len);
- rhostname[len] = '\000';
-
- /*
- * Get secret for authenticating them with us,
- * do the hash ourselves, and compare the result.
- */
- code = CHAP_FAILURE;
- if (!get_secret(cstate->unit, (explicit_remote? remote_name: rhostname),
- cstate->chal_name, secret, &secret_len, 1)) {
- warn("No CHAP secret found for authenticating %q", rhostname);
- } else {
-
- /* generate MD based on negotiated type */
- switch (cstate->chal_type) {
-
- case CHAP_DIGEST_MD5: /* only MD5 is defined for now */
- if (remmd_len != MD5_SIGNATURE_SIZE)
- break; /* it's not even the right length */
- MD5Init(&mdContext);
- MD5Update(&mdContext, &cstate->chal_id, 1);
- MD5Update(&mdContext, secret, secret_len);
- MD5Update(&mdContext, cstate->challenge, cstate->chal_len);
- MD5Final(hash, &mdContext);
-
- /* compare local and remote MDs and send the appropriate status */
- if (memcmp (hash, remmd, MD5_SIGNATURE_SIZE) == 0)
- code = CHAP_SUCCESS; /* they are the same! */
- break;
-
- default:
- CHAPDEBUG(("unknown digest type %d", cstate->chal_type));
- }
- }
-
- BZERO(secret, sizeof(secret));
- ChapSendStatus(cstate, code);
-
- if (code == CHAP_SUCCESS) {
- old_state = cstate->serverstate;
- cstate->serverstate = CHAPSS_OPEN;
- if (old_state == CHAPSS_INITIAL_CHAL) {
- auth_peer_success(cstate->unit, PPP_CHAP, rhostname, len);
- }
- if (cstate->chal_interval != 0)
- TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
- notice("CHAP peer authentication succeeded for %q", rhostname);
-
- } else {
- error("CHAP peer authentication failed for remote host %q", rhostname);
- cstate->serverstate = CHAPSS_BADAUTH;
- auth_peer_fail(cstate->unit, PPP_CHAP);
- }
-}
-
-/*
- * ChapReceiveSuccess - Receive Success
- */
-static void
-ChapReceiveSuccess(cstate, inp, id, len)
- chap_state *cstate;
- u_char *inp;
- u_char id;
- int len;
-{
-
- if (cstate->clientstate == CHAPCS_OPEN)
- /* presumably an answer to a duplicate response */
- return;
-
- if (cstate->clientstate != CHAPCS_RESPONSE) {
- /* don't know what this is */
- CHAPDEBUG(("ChapReceiveSuccess: in state %d\n", cstate->clientstate));
- return;
- }
-
- UNTIMEOUT(ChapResponseTimeout, cstate);
-
- /*
- * Print message.
- */
- if (len > 0)
- PRINTMSG(inp, len);
-
- cstate->clientstate = CHAPCS_OPEN;
-
- auth_withpeer_success(cstate->unit, PPP_CHAP);
-}
-
-
-/*
- * ChapReceiveFailure - Receive failure.
- */
-static void
-ChapReceiveFailure(cstate, inp, id, len)
- chap_state *cstate;
- u_char *inp;
- u_char id;
- int len;
-{
- if (cstate->clientstate != CHAPCS_RESPONSE) {
- /* don't know what this is */
- CHAPDEBUG(("ChapReceiveFailure: in state %d\n", cstate->clientstate));
- return;
- }
-
- UNTIMEOUT(ChapResponseTimeout, cstate);
-
- /*
- * Print message.
- */
- if (len > 0)
- PRINTMSG(inp, len);
-
- error("CHAP authentication failed");
- auth_withpeer_fail(cstate->unit, PPP_CHAP);
-}
-
-
-/*
- * ChapSendChallenge - Send an Authenticate challenge.
- */
-static void
-ChapSendChallenge(cstate)
- chap_state *cstate;
-{
- u_char *outp;
- int chal_len, name_len;
- int outlen;
-
- chal_len = cstate->chal_len;
- name_len = strlen(cstate->chal_name);
- outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len;
- outp = outpacket_buf;
-
- MAKEHEADER(outp, PPP_CHAP); /* paste in a CHAP header */
-
- PUTCHAR(CHAP_CHALLENGE, outp);
- PUTCHAR(cstate->chal_id, outp);
- PUTSHORT(outlen, outp);
-
- PUTCHAR(chal_len, outp); /* put length of challenge */
- BCOPY(cstate->challenge, outp, chal_len);
- INCPTR(chal_len, outp);
-
- BCOPY(cstate->chal_name, outp, name_len); /* append hostname */
-
- output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
-
- TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime);
- ++cstate->chal_transmits;
-}
-
-
-/*
- * ChapSendStatus - Send a status response (ack or nak).
- */
-static void
-ChapSendStatus(cstate, code)
- chap_state *cstate;
- int code;
-{
- u_char *outp;
- int outlen, msglen;
- char msg[256];
-
- if (code == CHAP_SUCCESS)
- slprintf(msg, sizeof(msg), "Welcome to %s.", hostname);
- else
- slprintf(msg, sizeof(msg), "I don't like you. Go 'way.");
- msglen = strlen(msg);
-
- outlen = CHAP_HEADERLEN + msglen;
- outp = outpacket_buf;
-
- MAKEHEADER(outp, PPP_CHAP); /* paste in a header */
-
- PUTCHAR(code, outp);
- PUTCHAR(cstate->chal_id, outp);
- PUTSHORT(outlen, outp);
- BCOPY(msg, outp, msglen);
- output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
-}
-
-/*
- * ChapGenChallenge is used to generate a pseudo-random challenge string of
- * a pseudo-random length between min_len and max_len. The challenge
- * string and its length are stored in *cstate, and various other fields of
- * *cstate are initialized.
- */
-
-static void
-ChapGenChallenge(cstate)
- chap_state *cstate;
-{
- int chal_len;
- u_char *ptr = cstate->challenge;
- int i;
-
- /* pick a random challenge length between MIN_CHALLENGE_LENGTH and
- MAX_CHALLENGE_LENGTH */
- chal_len = (unsigned) ((drand48() *
- (MAX_CHALLENGE_LENGTH - MIN_CHALLENGE_LENGTH)) +
- MIN_CHALLENGE_LENGTH);
- cstate->chal_len = chal_len;
- cstate->chal_id = ++cstate->id;
- cstate->chal_transmits = 0;
-
- /* generate a random string */
- for (i = 0; i < chal_len; i++)
- *ptr++ = (char) (drand48() * 0xff);
-}
-
-/*
- * ChapSendResponse - send a response packet with values as specified
- * in *cstate.
- */
-/* ARGSUSED */
-static void
-ChapSendResponse(cstate)
- chap_state *cstate;
-{
- u_char *outp;
- int outlen, md_len, name_len;
-
- md_len = cstate->resp_length;
- name_len = strlen(cstate->resp_name);
- outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len;
- outp = outpacket_buf;
-
- MAKEHEADER(outp, PPP_CHAP);
-
- PUTCHAR(CHAP_RESPONSE, outp); /* we are a response */
- PUTCHAR(cstate->resp_id, outp); /* copy id from challenge packet */
- PUTSHORT(outlen, outp); /* packet length */
-
- PUTCHAR(md_len, outp); /* length of MD */
- BCOPY(cstate->response, outp, md_len); /* copy MD to buffer */
- INCPTR(md_len, outp);
-
- BCOPY(cstate->resp_name, outp, name_len); /* append our name */
-
- /* send the packet */
- output(cstate->unit, outpacket_buf, outlen + PPP_HDRLEN);
-
- cstate->clientstate = CHAPCS_RESPONSE;
- TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime);
- ++cstate->resp_transmits;
-}
-
-/*
- * ChapPrintPkt - print the contents of a CHAP packet.
- */
-static char *ChapCodenames[] = {
- "Challenge", "Response", "Success", "Failure"
-};
-
-static int
-ChapPrintPkt(p, plen, printer, arg)
- u_char *p;
- int plen;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- int code, id, len;
- int clen, nlen;
- u_char x;
-
- if (plen < CHAP_HEADERLEN)
- return 0;
- GETCHAR(code, p);
- GETCHAR(id, p);
- GETSHORT(len, p);
- if (len < CHAP_HEADERLEN || len > plen)
- return 0;
-
- if (code >= 1 && code <= sizeof(ChapCodenames) / sizeof(char *))
- printer(arg, " %s", ChapCodenames[code-1]);
- else
- printer(arg, " code=0x%x", code);
- printer(arg, " id=0x%x", id);
- len -= CHAP_HEADERLEN;
- switch (code) {
- case CHAP_CHALLENGE:
- case CHAP_RESPONSE:
- if (len < 1)
- break;
- clen = p[0];
- if (len < clen + 1)
- break;
- ++p;
- nlen = len - clen - 1;
- printer(arg, " <");
- for (; clen > 0; --clen) {
- GETCHAR(x, p);
- printer(arg, "%.2x", x);
- }
- printer(arg, ">, name = ");
- print_string((char *)p, nlen, printer, arg);
- break;
- case CHAP_FAILURE:
- case CHAP_SUCCESS:
- printer(arg, " ");
- print_string((char *)p, len, printer, arg);
- break;
- default:
- for (clen = len; clen > 0; --clen) {
- GETCHAR(x, p);
- printer(arg, " %.2x", x);
- }
- }
-
- return len + CHAP_HEADERLEN;
-}
diff --git a/mdk-stage1/ppp/pppd/chap.h b/mdk-stage1/ppp/pppd/chap.h
deleted file mode 100644
index 945d051d0..000000000
--- a/mdk-stage1/ppp/pppd/chap.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * chap.h - Challenge Handshake Authentication Protocol definitions.
- *
- * Copyright (c) 1993 The Australian National University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the Australian National University. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Copyright (c) 1991 Gregory M. Christy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the author.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-#ifndef __CHAP_INCLUDE__
-
-/* Code + ID + length */
-#define CHAP_HEADERLEN 4
-
-/*
- * CHAP codes.
- */
-
-#define CHAP_DIGEST_MD5 5 /* use MD5 algorithm */
-#define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */
-#define CHAP_MICROSOFT 0x80 /* use Microsoft-compatible alg. */
-#define MS_CHAP_RESPONSE_LEN 49 /* Response length for MS-CHAP */
-
-#define CHAP_CHALLENGE 1
-#define CHAP_RESPONSE 2
-#define CHAP_SUCCESS 3
-#define CHAP_FAILURE 4
-
-/*
- * Challenge lengths (for challenges we send) and other limits.
- */
-#define MIN_CHALLENGE_LENGTH 16
-#define MAX_CHALLENGE_LENGTH 24
-#define MAX_RESPONSE_LENGTH 64 /* sufficient for MD5 or MS-CHAP */
-
-/*
- * Each interface is described by a chap structure.
- */
-
-typedef struct chap_state {
- int unit; /* Interface unit number */
- int clientstate; /* Client state */
- int serverstate; /* Server state */
- u_char challenge[MAX_CHALLENGE_LENGTH]; /* last challenge string sent */
- u_char chal_len; /* challenge length */
- u_char chal_id; /* ID of last challenge */
- u_char chal_type; /* hash algorithm for challenges */
- u_char id; /* Current id */
- char *chal_name; /* Our name to use with challenge */
- int chal_interval; /* Time until we challenge peer again */
- int timeouttime; /* Timeout time in seconds */
- int max_transmits; /* Maximum # of challenge transmissions */
- int chal_transmits; /* Number of transmissions of challenge */
- int resp_transmits; /* Number of transmissions of response */
- u_char response[MAX_RESPONSE_LENGTH]; /* Response to send */
- u_char resp_length; /* length of response */
- u_char resp_id; /* ID for response messages */
- u_char resp_type; /* hash algorithm for responses */
- char *resp_name; /* Our name to send with response */
-} chap_state;
-
-
-/*
- * Client (peer) states.
- */
-#define CHAPCS_INITIAL 0 /* Lower layer down, not opened */
-#define CHAPCS_CLOSED 1 /* Lower layer up, not opened */
-#define CHAPCS_PENDING 2 /* Auth us to peer when lower up */
-#define CHAPCS_LISTEN 3 /* Listening for a challenge */
-#define CHAPCS_RESPONSE 4 /* Sent response, waiting for status */
-#define CHAPCS_OPEN 5 /* We've received Success */
-
-/*
- * Server (authenticator) states.
- */
-#define CHAPSS_INITIAL 0 /* Lower layer down, not opened */
-#define CHAPSS_CLOSED 1 /* Lower layer up, not opened */
-#define CHAPSS_PENDING 2 /* Auth peer when lower up */
-#define CHAPSS_INITIAL_CHAL 3 /* We've sent the first challenge */
-#define CHAPSS_OPEN 4 /* We've sent a Success msg */
-#define CHAPSS_RECHALLENGE 5 /* We've sent another challenge */
-#define CHAPSS_BADAUTH 6 /* We've sent a Failure msg */
-
-/*
- * Timeouts.
- */
-#define CHAP_DEFTIMEOUT 3 /* Timeout time in seconds */
-#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */
-
-extern chap_state chap[];
-
-void ChapAuthWithPeer __P((int, char *, int));
-void ChapAuthPeer __P((int, char *, int));
-
-extern struct protent chap_protent;
-
-#define __CHAP_INCLUDE__
-#endif /* __CHAP_INCLUDE__ */
diff --git a/mdk-stage1/ppp/pppd/chap_ms.c b/mdk-stage1/ppp/pppd/chap_ms.c
deleted file mode 100644
index 81a57bb5a..000000000
--- a/mdk-stage1/ppp/pppd/chap_ms.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * chap_ms.c - Microsoft MS-CHAP compatible implementation.
- *
- * Copyright (c) 1995 Eric Rosenquist, Strata Software Limited.
- * http://www.strataware.com/
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Eric Rosenquist. The name of the author may not be used to
- * endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- * Modifications by Lauri Pesonen / lpesonen@clinet.fi, april 1997
- *
- * Implemented LANManager type password response to MS-CHAP challenges.
- * Now pppd provides both NT style and LANMan style blocks, and the
- * prefered is set by option "ms-lanman". Default is to use NT.
- * The hash text (StdText) was taken from Win95 RASAPI32.DLL.
- *
- * You should also use DOMAIN\\USERNAME as described in README.MSCHAP80
- */
-
-#define RCSID "$Id$"
-
-#ifdef CHAPMS
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#ifdef HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-#include "pppd.h"
-#include "chap.h"
-#include "chap_ms.h"
-#include "md4.h"
-
-#ifndef USE_CRYPT
-#include <des.h>
-#endif
-
-static const char rcsid[] = RCSID;
-
-typedef struct {
- u_char LANManResp[24];
- u_char NTResp[24];
- u_char UseNT; /* If 1, ignore the LANMan response field */
-} MS_ChapResponse;
-/* We use MS_CHAP_RESPONSE_LEN, rather than sizeof(MS_ChapResponse),
- in case this struct gets padded. */
-
-
-static void ChallengeResponse __P((u_char *, u_char *, u_char *));
-static void DesEncrypt __P((u_char *, u_char *, u_char *));
-static void MakeKey __P((u_char *, u_char *));
-static u_char Get7Bits __P((u_char *, int));
-static void ChapMS_NT __P((char *, int, char *, int, MS_ChapResponse *));
-#ifdef MSLANMAN
-static void ChapMS_LANMan __P((char *, int, char *, int, MS_ChapResponse *));
-#endif
-
-#ifdef USE_CRYPT
-static void Expand __P((u_char *, u_char *));
-static void Collapse __P((u_char *, u_char *));
-#endif
-
-#ifdef MSLANMAN
-bool ms_lanman = 0; /* Use LanMan password instead of NT */
- /* Has meaning only with MS-CHAP challenges */
-#endif
-
-static void
-ChallengeResponse(challenge, pwHash, response)
- u_char *challenge; /* IN 8 octets */
- u_char *pwHash; /* IN 16 octets */
- u_char *response; /* OUT 24 octets */
-{
- char ZPasswordHash[21];
-
- BZERO(ZPasswordHash, sizeof(ZPasswordHash));
- BCOPY(pwHash, ZPasswordHash, MD4_SIGNATURE_SIZE);
-
-#if 0
- dbglog("ChallengeResponse - ZPasswordHash %.*B",
- sizeof(ZPasswordHash), ZPasswordHash);
-#endif
-
- DesEncrypt(challenge, ZPasswordHash + 0, response + 0);
- DesEncrypt(challenge, ZPasswordHash + 7, response + 8);
- DesEncrypt(challenge, ZPasswordHash + 14, response + 16);
-
-#if 0
- dbglog("ChallengeResponse - response %.24B", response);
-#endif
-}
-
-
-#ifdef USE_CRYPT
-static void
-DesEncrypt(clear, key, cipher)
- u_char *clear; /* IN 8 octets */
- u_char *key; /* IN 7 octets */
- u_char *cipher; /* OUT 8 octets */
-{
- u_char des_key[8];
- u_char crypt_key[66];
- u_char des_input[66];
-
- MakeKey(key, des_key);
-
- Expand(des_key, crypt_key);
- setkey(crypt_key);
-
-#if 0
- CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %.8B", clear));
-#endif
-
- Expand(clear, des_input);
- encrypt(des_input, 0);
- Collapse(des_input, cipher);
-
-#if 0
- CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %.8B", cipher));
-#endif
-}
-
-#else /* USE_CRYPT */
-
-static void
-DesEncrypt(clear, key, cipher)
- u_char *clear; /* IN 8 octets */
- u_char *key; /* IN 7 octets */
- u_char *cipher; /* OUT 8 octets */
-{
- des_cblock des_key;
- des_key_schedule key_schedule;
-
- MakeKey(key, des_key);
-
- des_set_key(&des_key, key_schedule);
-
-#if 0
- CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %.8B", clear));
-#endif
-
- des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
-
-#if 0
- CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %.8B", cipher));
-#endif
-}
-
-#endif /* USE_CRYPT */
-
-
-static u_char Get7Bits(input, startBit)
- u_char *input;
- int startBit;
-{
- register unsigned int word;
-
- word = (unsigned)input[startBit / 8] << 8;
- word |= (unsigned)input[startBit / 8 + 1];
-
- word >>= 15 - (startBit % 8 + 7);
-
- return word & 0xFE;
-}
-
-#ifdef USE_CRYPT
-
-/* in == 8-byte string (expanded version of the 56-bit key)
- * out == 64-byte string where each byte is either 1 or 0
- * Note that the low-order "bit" is always ignored by by setkey()
- */
-static void Expand(in, out)
- u_char *in;
- u_char *out;
-{
- int j, c;
- int i;
-
- for(i = 0; i < 64; in++){
- c = *in;
- for(j = 7; j >= 0; j--)
- *out++ = (c >> j) & 01;
- i += 8;
- }
-}
-
-/* The inverse of Expand
- */
-static void Collapse(in, out)
- u_char *in;
- u_char *out;
-{
- int j;
- int i;
- unsigned int c;
-
- for (i = 0; i < 64; i += 8, out++) {
- c = 0;
- for (j = 7; j >= 0; j--, in++)
- c |= *in << j;
- *out = c & 0xff;
- }
-}
-#endif
-
-static void MakeKey(key, des_key)
- u_char *key; /* IN 56 bit DES key missing parity bits */
- u_char *des_key; /* OUT 64 bit DES key with parity bits added */
-{
- des_key[0] = Get7Bits(key, 0);
- des_key[1] = Get7Bits(key, 7);
- des_key[2] = Get7Bits(key, 14);
- des_key[3] = Get7Bits(key, 21);
- des_key[4] = Get7Bits(key, 28);
- des_key[5] = Get7Bits(key, 35);
- des_key[6] = Get7Bits(key, 42);
- des_key[7] = Get7Bits(key, 49);
-
-#ifndef USE_CRYPT
- des_set_odd_parity((des_cblock *)des_key);
-#endif
-
-#if 0
- CHAPDEBUG((LOG_INFO, "MakeKey: 56-bit input : %.7B", key));
- CHAPDEBUG((LOG_INFO, "MakeKey: 64-bit output: %.8B", des_key));
-#endif
-}
-
-static void
-ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response)
- char *rchallenge;
- int rchallenge_len;
- char *secret;
- int secret_len;
- MS_ChapResponse *response;
-{
- int i;
-#ifdef __NetBSD__
- /* NetBSD uses the libc md4 routines which take bytes instead of bits */
- int mdlen = secret_len * 2;
-#else
- int mdlen = secret_len * 2 * 8;
-#endif
- MD4_CTX md4Context;
- u_char hash[MD4_SIGNATURE_SIZE];
- u_char unicodePassword[MAX_NT_PASSWORD * 2];
-
- /* Initialize the Unicode version of the secret (== password). */
- /* This implicitly supports 8-bit ISO8859/1 characters. */
- BZERO(unicodePassword, sizeof(unicodePassword));
- for (i = 0; i < secret_len; i++)
- unicodePassword[i * 2] = (u_char)secret[i];
-
- MD4Init(&md4Context);
- MD4Update(&md4Context, unicodePassword, mdlen);
-
- MD4Final(hash, &md4Context); /* Tell MD4 we're done */
-
- ChallengeResponse(rchallenge, hash, response->NTResp);
-}
-
-#ifdef MSLANMAN
-static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
-
-static void
-ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response)
- char *rchallenge;
- int rchallenge_len;
- char *secret;
- int secret_len;
- MS_ChapResponse *response;
-{
- int i;
- u_char UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */
- u_char PasswordHash[MD4_SIGNATURE_SIZE];
-
- /* LANMan password is case insensitive */
- BZERO(UcasePassword, sizeof(UcasePassword));
- for (i = 0; i < secret_len; i++)
- UcasePassword[i] = (u_char)toupper(secret[i]);
- DesEncrypt( StdText, UcasePassword + 0, PasswordHash + 0 );
- DesEncrypt( StdText, UcasePassword + 7, PasswordHash + 8 );
- ChallengeResponse(rchallenge, PasswordHash, response->LANManResp);
-}
-#endif
-
-void
-ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len)
- chap_state *cstate;
- char *rchallenge;
- int rchallenge_len;
- char *secret;
- int secret_len;
-{
- MS_ChapResponse response;
-
-#if 0
- CHAPDEBUG((LOG_INFO, "ChapMS: secret is '%.*s'", secret_len, secret));
-#endif
- BZERO(&response, sizeof(response));
-
- /* Calculate both always */
- ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, &response);
-
-#ifdef MSLANMAN
- ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, &response);
-
- /* prefered method is set by option */
- response.UseNT = !ms_lanman;
-#else
- response.UseNT = 1;
-#endif
-
- BCOPY(&response, cstate->response, MS_CHAP_RESPONSE_LEN);
- cstate->resp_length = MS_CHAP_RESPONSE_LEN;
-}
-
-#endif /* CHAPMS */
diff --git a/mdk-stage1/ppp/pppd/chap_ms.h b/mdk-stage1/ppp/pppd/chap_ms.h
deleted file mode 100644
index fad2755c8..000000000
--- a/mdk-stage1/ppp/pppd/chap_ms.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * chap.h - Challenge Handshake Authentication Protocol definitions.
- *
- * Copyright (c) 1995 Eric Rosenquist, Strata Software Limited.
- * http://www.strataware.com/
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Eric Rosenquist. The name of the author may not be used to
- * endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-#ifndef __CHAPMS_INCLUDE__
-
-#define MD4_SIGNATURE_SIZE 16 /* 16 bytes in a MD4 message digest */
-#define MAX_NT_PASSWORD 256 /* Maximum number of (Unicode) chars in an NT password */
-
-void ChapMS __P((chap_state *, char *, int, char *, int));
-
-#define __CHAPMS_INCLUDE__
-#endif /* __CHAPMS_INCLUDE__ */
diff --git a/mdk-stage1/ppp/pppd/demand.c b/mdk-stage1/ppp/pppd/demand.c
deleted file mode 100644
index 9a740be8d..000000000
--- a/mdk-stage1/ppp/pppd/demand.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * demand.c - Support routines for demand-dialling.
- *
- * Copyright (c) 1993 The Australian National University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the Australian National University. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#ifdef PPP_FILTER
-#include <net/if.h>
-#include <net/bpf.h>
-#include <pcap.h>
-#endif
-
-#include "pppd.h"
-#include "fsm.h"
-#include "ipcp.h"
-#include "lcp.h"
-
-static const char rcsid[] = RCSID;
-
-char *frame;
-int framelen;
-int framemax;
-int escape_flag;
-int flush_flag;
-int fcs;
-
-struct packet {
- int length;
- struct packet *next;
- unsigned char data[1];
-};
-
-struct packet *pend_q;
-struct packet *pend_qtail;
-
-static int active_packet __P((unsigned char *, int));
-
-/*
- * demand_conf - configure the interface for doing dial-on-demand.
- */
-void
-demand_conf()
-{
- int i;
- struct protent *protp;
-
-/* framemax = lcp_allowoptions[0].mru;
- if (framemax < PPP_MRU) */
- framemax = PPP_MRU;
- framemax += PPP_HDRLEN + PPP_FCSLEN;
- frame = malloc(framemax);
- if (frame == NULL)
- novm("demand frame");
- framelen = 0;
- pend_q = NULL;
- escape_flag = 0;
- flush_flag = 0;
- fcs = PPP_INITFCS;
-
- netif_set_mtu(0, MIN(lcp_allowoptions[0].mru, PPP_MRU));
- ppp_send_config(0, PPP_MRU, (u_int32_t) 0, 0, 0);
- ppp_recv_config(0, PPP_MRU, (u_int32_t) 0, 0, 0);
-
-#ifdef PPP_FILTER
- set_filters(&pass_filter, &active_filter);
-#endif
-
- /*
- * Call the demand_conf procedure for each protocol that's got one.
- */
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->enabled_flag && protp->demand_conf != NULL)
- if (!((*protp->demand_conf)(0)))
- die(1);
-}
-
-
-/*
- * demand_block - set each network protocol to block further packets.
- */
-void
-demand_block()
-{
- int i;
- struct protent *protp;
-
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->enabled_flag && protp->demand_conf != NULL)
- sifnpmode(0, protp->protocol & ~0x8000, NPMODE_QUEUE);
- get_loop_output();
-}
-
-/*
- * demand_discard - set each network protocol to discard packets
- * with an error.
- */
-void
-demand_discard()
-{
- struct packet *pkt, *nextpkt;
- int i;
- struct protent *protp;
-
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->enabled_flag && protp->demand_conf != NULL)
- sifnpmode(0, protp->protocol & ~0x8000, NPMODE_ERROR);
- get_loop_output();
-
- /* discard all saved packets */
- for (pkt = pend_q; pkt != NULL; pkt = nextpkt) {
- nextpkt = pkt->next;
- free(pkt);
- }
- pend_q = NULL;
- framelen = 0;
- flush_flag = 0;
- escape_flag = 0;
- fcs = PPP_INITFCS;
-}
-
-/*
- * demand_unblock - set each enabled network protocol to pass packets.
- */
-void
-demand_unblock()
-{
- int i;
- struct protent *protp;
-
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->enabled_flag && protp->demand_conf != NULL)
- sifnpmode(0, protp->protocol & ~0x8000, NPMODE_PASS);
-}
-
-/*
- * FCS lookup table as calculated by genfcstab.
- */
-static u_short fcstab[256] = {
- 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
- 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
- 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
- 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
- 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
- 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
- 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
- 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
- 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
- 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
- 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
- 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
- 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
- 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
- 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
- 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
- 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
- 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
- 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
- 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
- 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
- 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
- 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
- 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
- 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
- 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
- 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
- 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
- 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
- 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
- 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
- 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
-};
-
-/*
- * loop_chars - process characters received from the loopback.
- * Calls loop_frame when a complete frame has been accumulated.
- * Return value is 1 if we need to bring up the link, 0 otherwise.
- */
-int
-loop_chars(p, n)
- unsigned char *p;
- int n;
-{
- int c, rv;
-
- rv = 0;
- for (; n > 0; --n) {
- c = *p++;
- if (c == PPP_FLAG) {
- if (!escape_flag && !flush_flag
- && framelen > 2 && fcs == PPP_GOODFCS) {
- framelen -= 2;
- if (loop_frame((unsigned char *)frame, framelen))
- rv = 1;
- }
- framelen = 0;
- flush_flag = 0;
- escape_flag = 0;
- fcs = PPP_INITFCS;
- continue;
- }
- if (flush_flag)
- continue;
- if (escape_flag) {
- c ^= PPP_TRANS;
- escape_flag = 0;
- } else if (c == PPP_ESCAPE) {
- escape_flag = 1;
- continue;
- }
- if (framelen >= framemax) {
- flush_flag = 1;
- continue;
- }
- frame[framelen++] = c;
- fcs = PPP_FCS(fcs, c);
- }
- return rv;
-}
-
-/*
- * loop_frame - given a frame obtained from the loopback,
- * decide whether to bring up the link or not, and, if we want
- * to transmit this frame later, put it on the pending queue.
- * Return value is 1 if we need to bring up the link, 0 otherwise.
- * We assume that the kernel driver has already applied the
- * pass_filter, so we won't get packets it rejected.
- * We apply the active_filter to see if we want this packet to
- * bring up the link.
- */
-int
-loop_frame(frame, len)
- unsigned char *frame;
- int len;
-{
- struct packet *pkt;
-
- /* dbglog("from loop: %P", frame, len); */
- if (len < PPP_HDRLEN)
- return 0;
- if ((PPP_PROTOCOL(frame) & 0x8000) != 0)
- return 0; /* shouldn't get any of these anyway */
- if (!active_packet(frame, len))
- return 0;
-
- pkt = (struct packet *) malloc(sizeof(struct packet) + len);
- if (pkt != NULL) {
- pkt->length = len;
- pkt->next = NULL;
- memcpy(pkt->data, frame, len);
- if (pend_q == NULL)
- pend_q = pkt;
- else
- pend_qtail->next = pkt;
- pend_qtail = pkt;
- }
- return 1;
-}
-
-/*
- * demand_rexmit - Resend all those frames which we got via the
- * loopback, now that the real serial link is up.
- */
-void
-demand_rexmit(proto)
- int proto;
-{
- struct packet *pkt, *prev, *nextpkt;
-
- prev = NULL;
- pkt = pend_q;
- pend_q = NULL;
- for (; pkt != NULL; pkt = nextpkt) {
- nextpkt = pkt->next;
- if (PPP_PROTOCOL(pkt->data) == proto) {
- output(0, pkt->data, pkt->length);
- free(pkt);
- } else {
- if (prev == NULL)
- pend_q = pkt;
- else
- prev->next = pkt;
- prev = pkt;
- }
- }
- pend_qtail = prev;
- if (prev != NULL)
- prev->next = NULL;
-}
-
-/*
- * Scan a packet to decide whether it is an "active" packet,
- * that is, whether it is worth bringing up the link for.
- */
-static int
-active_packet(p, len)
- unsigned char *p;
- int len;
-{
- int proto, i;
- struct protent *protp;
-
- if (len < PPP_HDRLEN)
- return 0;
- proto = PPP_PROTOCOL(p);
-#ifdef PPP_FILTER
- if (pass_filter.bf_len != 0
- && bpf_filter(pass_filter.bf_insns, p, len, len) == 0)
- return 0;
- if (active_filter.bf_len != 0
- && bpf_filter(active_filter.bf_insns, p, len, len) == 0)
- return 0;
-#endif
- for (i = 0; (protp = protocols[i]) != NULL; ++i) {
- if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
- if (!protp->enabled_flag)
- return 0;
- if (protp->active_pkt == NULL)
- return 1;
- return (*protp->active_pkt)(p, len);
- }
- }
- return 0; /* not a supported protocol !!?? */
-}
diff --git a/mdk-stage1/ppp/pppd/eui64.c b/mdk-stage1/ppp/pppd/eui64.c
deleted file mode 100644
index 7f3176035..000000000
--- a/mdk-stage1/ppp/pppd/eui64.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- eui64.c - EUI64 routines for IPv6CP.
- Copyright (C) 1999 Tommi Komulainen <Tommi.Komulainen@iki.fi>
-
- Redistribution and use in source and binary forms are permitted
- provided that the above copyright notice and this paragraph are
- duplicated in all such forms and that any documentation,
- advertising materials, and other materials related to such
- distribution and use acknowledge that the software was developed
- by Tommi Komulainen. The name of the author may not be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-
- $Id$
-*/
-
-#define RCSID "$Id$"
-
-#include "pppd.h"
-
-static const char rcsid[] = RCSID;
-
-/*
- * eui64_ntoa - Make an ascii representation of an interface identifier
- */
-char *
-eui64_ntoa(e)
- eui64_t e;
-{
- static char buf[32];
-
- snprintf(buf, 32, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
- e.e8[0], e.e8[1], e.e8[2], e.e8[3],
- e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
- return buf;
-}
diff --git a/mdk-stage1/ppp/pppd/eui64.h b/mdk-stage1/ppp/pppd/eui64.h
deleted file mode 100644
index ca4445345..000000000
--- a/mdk-stage1/ppp/pppd/eui64.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- eui64.h - EUI64 routines for IPv6CP.
- Copyright (C) 1999 Tommi Komulainen <Tommi.Komulainen@iki.fi>
-
- Redistribution and use in source and binary forms are permitted
- provided that the above copyright notice and this paragraph are
- duplicated in all such forms and that any documentation,
- advertising materials, and other materials related to such
- distribution and use acknowledge that the software was developed
- by Tommi Komulainen. The name of the author may not be used
- to endorse or promote products derived from this software without
- specific prior written permission.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-
- $Id$
-*/
-
-#ifndef __EUI64_H__
-#define __EUI64_H__
-
-#if !defined(INET6)
-#error "this file should only be included when INET6 is defined"
-#endif /* not defined(INET6) */
-
-#if defined(SOL2)
-#include <netinet/in.h>
-
-typedef union {
- uint8_t e8[8]; /* lower 64-bit IPv6 address */
- uint32_t e32[2]; /* lower 64-bit IPv6 address */
-} eui64_t;
-
-/*
- * Declare the two below, since in.h only defines them when _KERNEL
- * is declared - which shouldn't be true when dealing with user-land programs
- */
-#define s6_addr8 _S6_un._S6_u8
-#define s6_addr32 _S6_un._S6_u32
-
-#else /* else if not defined(SOL2) */
-
-/*
- * TODO:
- *
- * Maybe this should be done by processing struct in6_addr directly...
- */
-typedef union
-{
- u_int8_t e8[8];
- u_int16_t e16[4];
- u_int32_t e32[2];
-} eui64_t;
-
-#endif /* defined(SOL2) */
-
-#define eui64_iszero(e) (((e).e32[0] | (e).e32[1]) == 0)
-#define eui64_equals(e, o) (((e).e32[0] == (o).e32[0]) && \
- ((e).e32[1] == (o).e32[1]))
-#define eui64_zero(e) (e).e32[0] = (e).e32[1] = 0;
-
-#define eui64_copy(s, d) memcpy(&(d), &(s), sizeof(eui64_t))
-
-#define eui64_magic(e) do { \
- (e).e32[0] = magic(); \
- (e).e32[1] = magic(); \
- (e).e8[0] &= ~2; \
- } while (0)
-#define eui64_magic_nz(x) do { \
- eui64_magic(x); \
- } while (eui64_iszero(x))
-#define eui64_magic_ne(x, y) do { \
- eui64_magic(x); \
- } while (eui64_equals(x, y))
-
-#define eui64_get(ll, cp) do { \
- eui64_copy((*cp), (ll)); \
- (cp) += sizeof(eui64_t); \
- } while (0)
-
-#define eui64_put(ll, cp) do { \
- eui64_copy((ll), (*cp)); \
- (cp) += sizeof(eui64_t); \
- } while (0)
-
-#define eui64_set32(e, l) do { \
- (e).e32[0] = 0; \
- (e).e32[1] = htonl(l); \
- } while (0)
-#define eui64_setlo32(e, l) eui64_set32(e, l)
-
-char *eui64_ntoa __P((eui64_t)); /* Returns ascii representation of id */
-
-#endif /* __EUI64_H__ */
-
diff --git a/mdk-stage1/ppp/pppd/fsm.c b/mdk-stage1/ppp/pppd/fsm.c
deleted file mode 100644
index 07a8c11f1..000000000
--- a/mdk-stage1/ppp/pppd/fsm.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/*
- * fsm.c - {Link, IP} Control Protocol Finite State Machine.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-/*
- * TODO:
- * Randomize fsm id on link/init.
- * Deal with variable outgoing MTU.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "pppd.h"
-#include "fsm.h"
-
-static const char rcsid[] = RCSID;
-
-static void fsm_timeout __P((void *));
-static void fsm_rconfreq __P((fsm *, int, u_char *, int));
-static void fsm_rconfack __P((fsm *, int, u_char *, int));
-static void fsm_rconfnakrej __P((fsm *, int, int, u_char *, int));
-static void fsm_rtermreq __P((fsm *, int, u_char *, int));
-static void fsm_rtermack __P((fsm *));
-static void fsm_rcoderej __P((fsm *, u_char *, int));
-static void fsm_sconfreq __P((fsm *, int));
-
-#define PROTO_NAME(f) ((f)->callbacks->proto_name)
-
-int peer_mru[NUM_PPP];
-
-
-/*
- * fsm_init - Initialize fsm.
- *
- * Initialize fsm state.
- */
-void
-fsm_init(f)
- fsm *f;
-{
- f->state = INITIAL;
- f->flags = 0;
- f->id = 0; /* XXX Start with random id? */
- f->timeouttime = DEFTIMEOUT;
- f->maxconfreqtransmits = DEFMAXCONFREQS;
- f->maxtermtransmits = DEFMAXTERMREQS;
- f->maxnakloops = DEFMAXNAKLOOPS;
- f->term_reason_len = 0;
-}
-
-
-/*
- * fsm_lowerup - The lower layer is up.
- */
-void
-fsm_lowerup(f)
- fsm *f;
-{
- switch( f->state ){
- case INITIAL:
- f->state = CLOSED;
- break;
-
- case STARTING:
- if( f->flags & OPT_SILENT )
- f->state = STOPPED;
- else {
- /* Send an initial configure-request */
- fsm_sconfreq(f, 0);
- f->state = REQSENT;
- }
- break;
-
- default:
- FSMDEBUG(("%s: Up event in state %d!", PROTO_NAME(f), f->state));
- }
-}
-
-
-/*
- * fsm_lowerdown - The lower layer is down.
- *
- * Cancel all timeouts and inform upper layers.
- */
-void
-fsm_lowerdown(f)
- fsm *f;
-{
- switch( f->state ){
- case CLOSED:
- f->state = INITIAL;
- break;
-
- case STOPPED:
- f->state = STARTING;
- if( f->callbacks->starting )
- (*f->callbacks->starting)(f);
- break;
-
- case CLOSING:
- f->state = INITIAL;
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- break;
-
- case STOPPING:
- case REQSENT:
- case ACKRCVD:
- case ACKSENT:
- f->state = STARTING;
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- break;
-
- case OPENED:
- if( f->callbacks->down )
- (*f->callbacks->down)(f);
- f->state = STARTING;
- break;
-
- default:
- FSMDEBUG(("%s: Down event in state %d!", PROTO_NAME(f), f->state));
- }
-}
-
-
-/*
- * fsm_open - Link is allowed to come up.
- */
-void
-fsm_open(f)
- fsm *f;
-{
- switch( f->state ){
- case INITIAL:
- f->state = STARTING;
- if( f->callbacks->starting )
- (*f->callbacks->starting)(f);
- break;
-
- case CLOSED:
- if( f->flags & OPT_SILENT )
- f->state = STOPPED;
- else {
- /* Send an initial configure-request */
- fsm_sconfreq(f, 0);
- f->state = REQSENT;
- }
- break;
-
- case CLOSING:
- f->state = STOPPING;
- /* fall through */
- case STOPPED:
- case OPENED:
- if( f->flags & OPT_RESTART ){
- fsm_lowerdown(f);
- fsm_lowerup(f);
- }
- break;
- }
-}
-
-
-/*
- * fsm_close - Start closing connection.
- *
- * Cancel timeouts and either initiate close or possibly go directly to
- * the CLOSED state.
- */
-void
-fsm_close(f, reason)
- fsm *f;
- char *reason;
-{
- f->term_reason = reason;
- f->term_reason_len = (reason == NULL? 0: strlen(reason));
- switch( f->state ){
- case STARTING:
- f->state = INITIAL;
- break;
- case STOPPED:
- f->state = CLOSED;
- break;
- case STOPPING:
- f->state = CLOSING;
- break;
-
- case REQSENT:
- case ACKRCVD:
- case ACKSENT:
- case OPENED:
- if( f->state != OPENED )
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- else if( f->callbacks->down )
- (*f->callbacks->down)(f); /* Inform upper layers we're down */
-
- /* Init restart counter, send Terminate-Request */
- f->retransmits = f->maxtermtransmits;
- fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
- (u_char *) f->term_reason, f->term_reason_len);
- TIMEOUT(fsm_timeout, f, f->timeouttime);
- --f->retransmits;
-
- f->state = CLOSING;
- break;
- }
-}
-
-
-/*
- * fsm_timeout - Timeout expired.
- */
-static void
-fsm_timeout(arg)
- void *arg;
-{
- fsm *f = (fsm *) arg;
-
- switch (f->state) {
- case CLOSING:
- case STOPPING:
- if( f->retransmits <= 0 ){
- /*
- * We've waited for an ack long enough. Peer probably heard us.
- */
- f->state = (f->state == CLOSING)? CLOSED: STOPPED;
- if( f->callbacks->finished )
- (*f->callbacks->finished)(f);
- } else {
- /* Send Terminate-Request */
- fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
- (u_char *) f->term_reason, f->term_reason_len);
- TIMEOUT(fsm_timeout, f, f->timeouttime);
- --f->retransmits;
- }
- break;
-
- case REQSENT:
- case ACKRCVD:
- case ACKSENT:
- if (f->retransmits <= 0) {
- warn("%s: timeout sending Config-Requests\n", PROTO_NAME(f));
- f->state = STOPPED;
- if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished )
- (*f->callbacks->finished)(f);
-
- } else {
- /* Retransmit the configure-request */
- if (f->callbacks->retransmit)
- (*f->callbacks->retransmit)(f);
- fsm_sconfreq(f, 1); /* Re-send Configure-Request */
- if( f->state == ACKRCVD )
- f->state = REQSENT;
- }
- break;
-
- default:
- FSMDEBUG(("%s: Timeout event in state %d!", PROTO_NAME(f), f->state));
- }
-}
-
-
-/*
- * fsm_input - Input packet.
- */
-void
-fsm_input(f, inpacket, l)
- fsm *f;
- u_char *inpacket;
- int l;
-{
- u_char *inp;
- u_char code, id;
- int len;
-
- /*
- * Parse header (code, id and length).
- * If packet too short, drop it.
- */
- inp = inpacket;
- if (l < HEADERLEN) {
- FSMDEBUG(("fsm_input(%x): Rcvd short header.", f->protocol));
- return;
- }
- GETCHAR(code, inp);
- GETCHAR(id, inp);
- GETSHORT(len, inp);
- if (len < HEADERLEN) {
- FSMDEBUG(("fsm_input(%x): Rcvd illegal length.", f->protocol));
- return;
- }
- if (len > l) {
- FSMDEBUG(("fsm_input(%x): Rcvd short packet.", f->protocol));
- return;
- }
- len -= HEADERLEN; /* subtract header length */
-
- if( f->state == INITIAL || f->state == STARTING ){
- FSMDEBUG(("fsm_input(%x): Rcvd packet in state %d.",
- f->protocol, f->state));
- return;
- }
-
- /*
- * Action depends on code.
- */
- switch (code) {
- case CONFREQ:
- fsm_rconfreq(f, id, inp, len);
- break;
-
- case CONFACK:
- fsm_rconfack(f, id, inp, len);
- break;
-
- case CONFNAK:
- case CONFREJ:
- fsm_rconfnakrej(f, code, id, inp, len);
- break;
-
- case TERMREQ:
- fsm_rtermreq(f, id, inp, len);
- break;
-
- case TERMACK:
- fsm_rtermack(f);
- break;
-
- case CODEREJ:
- fsm_rcoderej(f, inp, len);
- break;
-
- default:
- if( !f->callbacks->extcode
- || !(*f->callbacks->extcode)(f, code, id, inp, len) )
- fsm_sdata(f, CODEREJ, ++f->id, inpacket, len + HEADERLEN);
- break;
- }
-}
-
-
-/*
- * fsm_rconfreq - Receive Configure-Request.
- */
-static void
-fsm_rconfreq(f, id, inp, len)
- fsm *f;
- u_char id;
- u_char *inp;
- int len;
-{
- int code, reject_if_disagree;
-
- switch( f->state ){
- case CLOSED:
- /* Go away, we're closed */
- fsm_sdata(f, TERMACK, id, NULL, 0);
- return;
- case CLOSING:
- case STOPPING:
- return;
-
- case OPENED:
- /* Go down and restart negotiation */
- if( f->callbacks->down )
- (*f->callbacks->down)(f); /* Inform upper layers */
- fsm_sconfreq(f, 0); /* Send initial Configure-Request */
- break;
-
- case STOPPED:
- /* Negotiation started by our peer */
- fsm_sconfreq(f, 0); /* Send initial Configure-Request */
- f->state = REQSENT;
- break;
- }
-
- /*
- * Pass the requested configuration options
- * to protocol-specific code for checking.
- */
- if (f->callbacks->reqci){ /* Check CI */
- reject_if_disagree = (f->nakloops >= f->maxnakloops);
- code = (*f->callbacks->reqci)(f, inp, &len, reject_if_disagree);
- } else if (len)
- code = CONFREJ; /* Reject all CI */
- else
- code = CONFACK;
-
- /* send the Ack, Nak or Rej to the peer */
- fsm_sdata(f, code, id, inp, len);
-
- if (code == CONFACK) {
- if (f->state == ACKRCVD) {
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- f->state = OPENED;
- if (f->callbacks->up)
- (*f->callbacks->up)(f); /* Inform upper layers */
- } else
- f->state = ACKSENT;
- f->nakloops = 0;
-
- } else {
- /* we sent CONFACK or CONFREJ */
- if (f->state != ACKRCVD)
- f->state = REQSENT;
- if( code == CONFNAK )
- ++f->nakloops;
- }
-}
-
-
-/*
- * fsm_rconfack - Receive Configure-Ack.
- */
-static void
-fsm_rconfack(f, id, inp, len)
- fsm *f;
- int id;
- u_char *inp;
- int len;
-{
- if (id != f->reqid || f->seen_ack) /* Expected id? */
- return; /* Nope, toss... */
- if( !(f->callbacks->ackci? (*f->callbacks->ackci)(f, inp, len):
- (len == 0)) ){
- /* Ack is bad - ignore it */
- error("Received bad configure-ack: %P", inp, len);
- return;
- }
- f->seen_ack = 1;
-
- switch (f->state) {
- case CLOSED:
- case STOPPED:
- fsm_sdata(f, TERMACK, id, NULL, 0);
- break;
-
- case REQSENT:
- f->state = ACKRCVD;
- f->retransmits = f->maxconfreqtransmits;
- break;
-
- case ACKRCVD:
- /* Huh? an extra valid Ack? oh well... */
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- fsm_sconfreq(f, 0);
- f->state = REQSENT;
- break;
-
- case ACKSENT:
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- f->state = OPENED;
- f->retransmits = f->maxconfreqtransmits;
- if (f->callbacks->up)
- (*f->callbacks->up)(f); /* Inform upper layers */
- break;
-
- case OPENED:
- /* Go down and restart negotiation */
- if (f->callbacks->down)
- (*f->callbacks->down)(f); /* Inform upper layers */
- fsm_sconfreq(f, 0); /* Send initial Configure-Request */
- f->state = REQSENT;
- break;
- }
-}
-
-
-/*
- * fsm_rconfnakrej - Receive Configure-Nak or Configure-Reject.
- */
-static void
-fsm_rconfnakrej(f, code, id, inp, len)
- fsm *f;
- int code, id;
- u_char *inp;
- int len;
-{
- int (*proc) __P((fsm *, u_char *, int));
- int ret;
-
- if (id != f->reqid || f->seen_ack) /* Expected id? */
- return; /* Nope, toss... */
- proc = (code == CONFNAK)? f->callbacks->nakci: f->callbacks->rejci;
- if (!proc || !(ret = proc(f, inp, len))) {
- /* Nak/reject is bad - ignore it */
- error("Received bad configure-nak/rej: %P", inp, len);
- return;
- }
- f->seen_ack = 1;
-
- switch (f->state) {
- case CLOSED:
- case STOPPED:
- fsm_sdata(f, TERMACK, id, NULL, 0);
- break;
-
- case REQSENT:
- case ACKSENT:
- /* They didn't agree to what we wanted - try another request */
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- if (ret < 0)
- f->state = STOPPED; /* kludge for stopping CCP */
- else
- fsm_sconfreq(f, 0); /* Send Configure-Request */
- break;
-
- case ACKRCVD:
- /* Got a Nak/reject when we had already had an Ack?? oh well... */
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- fsm_sconfreq(f, 0);
- f->state = REQSENT;
- break;
-
- case OPENED:
- /* Go down and restart negotiation */
- if (f->callbacks->down)
- (*f->callbacks->down)(f); /* Inform upper layers */
- fsm_sconfreq(f, 0); /* Send initial Configure-Request */
- f->state = REQSENT;
- break;
- }
-}
-
-
-/*
- * fsm_rtermreq - Receive Terminate-Req.
- */
-static void
-fsm_rtermreq(f, id, p, len)
- fsm *f;
- int id;
- u_char *p;
- int len;
-{
- switch (f->state) {
- case ACKRCVD:
- case ACKSENT:
- f->state = REQSENT; /* Start over but keep trying */
- break;
-
- case OPENED:
- if (len > 0) {
- info("%s terminated by peer (%0.*v)", PROTO_NAME(f), len, p);
- } else
- info("%s terminated by peer", PROTO_NAME(f));
- if (f->callbacks->down)
- (*f->callbacks->down)(f); /* Inform upper layers */
- f->retransmits = 0;
- f->state = STOPPING;
- TIMEOUT(fsm_timeout, f, f->timeouttime);
- break;
- }
-
- fsm_sdata(f, TERMACK, id, NULL, 0);
-}
-
-
-/*
- * fsm_rtermack - Receive Terminate-Ack.
- */
-static void
-fsm_rtermack(f)
- fsm *f;
-{
- switch (f->state) {
- case CLOSING:
- UNTIMEOUT(fsm_timeout, f);
- f->state = CLOSED;
- if( f->callbacks->finished )
- (*f->callbacks->finished)(f);
- break;
- case STOPPING:
- UNTIMEOUT(fsm_timeout, f);
- f->state = STOPPED;
- if( f->callbacks->finished )
- (*f->callbacks->finished)(f);
- break;
-
- case ACKRCVD:
- f->state = REQSENT;
- break;
-
- case OPENED:
- if (f->callbacks->down)
- (*f->callbacks->down)(f); /* Inform upper layers */
- fsm_sconfreq(f, 0);
- break;
- }
-}
-
-
-/*
- * fsm_rcoderej - Receive an Code-Reject.
- */
-static void
-fsm_rcoderej(f, inp, len)
- fsm *f;
- u_char *inp;
- int len;
-{
- u_char code, id;
-
- if (len < HEADERLEN) {
- FSMDEBUG(("fsm_rcoderej: Rcvd short Code-Reject packet!"));
- return;
- }
- GETCHAR(code, inp);
- GETCHAR(id, inp);
- warn("%s: Rcvd Code-Reject for code %d, id %d", PROTO_NAME(f), code, id);
-
- if( f->state == ACKRCVD )
- f->state = REQSENT;
-}
-
-
-/*
- * fsm_protreject - Peer doesn't speak this protocol.
- *
- * Treat this as a catastrophic error (RXJ-).
- */
-void
-fsm_protreject(f)
- fsm *f;
-{
- switch( f->state ){
- case CLOSING:
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- /* fall through */
- case CLOSED:
- f->state = CLOSED;
- if( f->callbacks->finished )
- (*f->callbacks->finished)(f);
- break;
-
- case STOPPING:
- case REQSENT:
- case ACKRCVD:
- case ACKSENT:
- UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */
- /* fall through */
- case STOPPED:
- f->state = STOPPED;
- if( f->callbacks->finished )
- (*f->callbacks->finished)(f);
- break;
-
- case OPENED:
- if( f->callbacks->down )
- (*f->callbacks->down)(f);
-
- /* Init restart counter, send Terminate-Request */
- f->retransmits = f->maxtermtransmits;
- fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
- (u_char *) f->term_reason, f->term_reason_len);
- TIMEOUT(fsm_timeout, f, f->timeouttime);
- --f->retransmits;
-
- f->state = STOPPING;
- break;
-
- default:
- FSMDEBUG(("%s: Protocol-reject event in state %d!",
- PROTO_NAME(f), f->state));
- }
-}
-
-
-/*
- * fsm_sconfreq - Send a Configure-Request.
- */
-static void
-fsm_sconfreq(f, retransmit)
- fsm *f;
- int retransmit;
-{
- u_char *outp;
- int cilen;
-
- if( f->state != REQSENT && f->state != ACKRCVD && f->state != ACKSENT ){
- /* Not currently negotiating - reset options */
- if( f->callbacks->resetci )
- (*f->callbacks->resetci)(f);
- f->nakloops = 0;
- }
-
- if( !retransmit ){
- /* New request - reset retransmission counter, use new ID */
- f->retransmits = f->maxconfreqtransmits;
- f->reqid = ++f->id;
- }
-
- f->seen_ack = 0;
-
- /*
- * Make up the request packet
- */
- outp = outpacket_buf + PPP_HDRLEN + HEADERLEN;
- if( f->callbacks->cilen && f->callbacks->addci ){
- cilen = (*f->callbacks->cilen)(f);
- if( cilen > peer_mru[f->unit] - HEADERLEN )
- cilen = peer_mru[f->unit] - HEADERLEN;
- if (f->callbacks->addci)
- (*f->callbacks->addci)(f, outp, &cilen);
- } else
- cilen = 0;
-
- /* send the request to our peer */
- fsm_sdata(f, CONFREQ, f->reqid, outp, cilen);
-
- /* start the retransmit timer */
- --f->retransmits;
- TIMEOUT(fsm_timeout, f, f->timeouttime);
-}
-
-
-/*
- * fsm_sdata - Send some data.
- *
- * Used for all packets sent to our peer by this module.
- */
-void
-fsm_sdata(f, code, id, data, datalen)
- fsm *f;
- u_char code, id;
- u_char *data;
- int datalen;
-{
- u_char *outp;
- int outlen;
-
- /* Adjust length to be smaller than MTU */
- outp = outpacket_buf;
- if (datalen > peer_mru[f->unit] - HEADERLEN)
- datalen = peer_mru[f->unit] - HEADERLEN;
- if (datalen && data != outp + PPP_HDRLEN + HEADERLEN)
- BCOPY(data, outp + PPP_HDRLEN + HEADERLEN, datalen);
- outlen = datalen + HEADERLEN;
- MAKEHEADER(outp, f->protocol);
- PUTCHAR(code, outp);
- PUTCHAR(id, outp);
- PUTSHORT(outlen, outp);
- output(f->unit, outpacket_buf, outlen + PPP_HDRLEN);
-}
diff --git a/mdk-stage1/ppp/pppd/fsm.h b/mdk-stage1/ppp/pppd/fsm.h
deleted file mode 100644
index c94a68e6c..000000000
--- a/mdk-stage1/ppp/pppd/fsm.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * fsm.h - {Link, IP} Control Protocol Finite State Machine definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-/*
- * Packet header = Code, id, length.
- */
-#define HEADERLEN 4
-
-
-/*
- * CP (LCP, IPCP, etc.) codes.
- */
-#define CONFREQ 1 /* Configuration Request */
-#define CONFACK 2 /* Configuration Ack */
-#define CONFNAK 3 /* Configuration Nak */
-#define CONFREJ 4 /* Configuration Reject */
-#define TERMREQ 5 /* Termination Request */
-#define TERMACK 6 /* Termination Ack */
-#define CODEREJ 7 /* Code Reject */
-
-
-/*
- * Each FSM is described by an fsm structure and fsm callbacks.
- */
-typedef struct fsm {
- int unit; /* Interface unit number */
- int protocol; /* Data Link Layer Protocol field value */
- int state; /* State */
- int flags; /* Contains option bits */
- u_char id; /* Current id */
- u_char reqid; /* Current request id */
- u_char seen_ack; /* Have received valid Ack/Nak/Rej to Req */
- int timeouttime; /* Timeout time in milliseconds */
- int maxconfreqtransmits; /* Maximum Configure-Request transmissions */
- int retransmits; /* Number of retransmissions left */
- int maxtermtransmits; /* Maximum Terminate-Request transmissions */
- int nakloops; /* Number of nak loops since last ack */
- int maxnakloops; /* Maximum number of nak loops tolerated */
- struct fsm_callbacks *callbacks; /* Callback routines */
- char *term_reason; /* Reason for closing protocol */
- int term_reason_len; /* Length of term_reason */
-} fsm;
-
-
-typedef struct fsm_callbacks {
- void (*resetci) /* Reset our Configuration Information */
- __P((fsm *));
- int (*cilen) /* Length of our Configuration Information */
- __P((fsm *));
- void (*addci) /* Add our Configuration Information */
- __P((fsm *, u_char *, int *));
- int (*ackci) /* ACK our Configuration Information */
- __P((fsm *, u_char *, int));
- int (*nakci) /* NAK our Configuration Information */
- __P((fsm *, u_char *, int));
- int (*rejci) /* Reject our Configuration Information */
- __P((fsm *, u_char *, int));
- int (*reqci) /* Request peer's Configuration Information */
- __P((fsm *, u_char *, int *, int));
- void (*up) /* Called when fsm reaches OPENED state */
- __P((fsm *));
- void (*down) /* Called when fsm leaves OPENED state */
- __P((fsm *));
- void (*starting) /* Called when we want the lower layer */
- __P((fsm *));
- void (*finished) /* Called when we don't want the lower layer */
- __P((fsm *));
- void (*protreject) /* Called when Protocol-Reject received */
- __P((int));
- void (*retransmit) /* Retransmission is necessary */
- __P((fsm *));
- int (*extcode) /* Called when unknown code received */
- __P((fsm *, int, int, u_char *, int));
- char *proto_name; /* String name for protocol (for messages) */
-} fsm_callbacks;
-
-
-/*
- * Link states.
- */
-#define INITIAL 0 /* Down, hasn't been opened */
-#define STARTING 1 /* Down, been opened */
-#define CLOSED 2 /* Up, hasn't been opened */
-#define STOPPED 3 /* Open, waiting for down event */
-#define CLOSING 4 /* Terminating the connection, not open */
-#define STOPPING 5 /* Terminating, but open */
-#define REQSENT 6 /* We've sent a Config Request */
-#define ACKRCVD 7 /* We've received a Config Ack */
-#define ACKSENT 8 /* We've sent a Config Ack */
-#define OPENED 9 /* Connection available */
-
-
-/*
- * Flags - indicate options controlling FSM operation
- */
-#define OPT_PASSIVE 1 /* Don't die if we don't get a response */
-#define OPT_RESTART 2 /* Treat 2nd OPEN as DOWN, UP */
-#define OPT_SILENT 4 /* Wait for peer to speak first */
-
-
-/*
- * Timeouts.
- */
-#define DEFTIMEOUT 3 /* Timeout time in seconds */
-#define DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
-#define DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
-#define DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
-
-
-/*
- * Prototypes
- */
-void fsm_init __P((fsm *));
-void fsm_lowerup __P((fsm *));
-void fsm_lowerdown __P((fsm *));
-void fsm_open __P((fsm *));
-void fsm_close __P((fsm *, char *));
-void fsm_input __P((fsm *, u_char *, int));
-void fsm_protreject __P((fsm *));
-void fsm_sdata __P((fsm *, int, int, u_char *, int));
-
-
-/*
- * Variables
- */
-extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */
diff --git a/mdk-stage1/ppp/pppd/ipcp.c b/mdk-stage1/ppp/pppd/ipcp.c
deleted file mode 100644
index 3f64357ed..000000000
--- a/mdk-stage1/ppp/pppd/ipcp.c
+++ /dev/null
@@ -1,2054 +0,0 @@
-/*
- * ipcp.c - PPP IP Control Protocol.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-/*
- * TODO:
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <netdb.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "pppd.h"
-#include "fsm.h"
-#include "ipcp.h"
-#include "pathnames.h"
-
-static const char rcsid[] = RCSID;
-
-/* global vars */
-ipcp_options ipcp_wantoptions[NUM_PPP]; /* Options that we want to request */
-ipcp_options ipcp_gotoptions[NUM_PPP]; /* Options that peer ack'd */
-ipcp_options ipcp_allowoptions[NUM_PPP]; /* Options we allow peer to request */
-ipcp_options ipcp_hisoptions[NUM_PPP]; /* Options that we ack'd */
-
-u_int32_t netmask = 0; /* IP netmask to set on interface */
-
-bool disable_defaultip = 0; /* Don't use hostname for default IP adrs */
-
-/* Hook for a plugin to know when IP protocol has come up */
-void (*ip_up_hook) __P((void)) = NULL;
-
-/* Hook for a plugin to know when IP protocol has come down */
-void (*ip_down_hook) __P((void)) = NULL;
-
-/* Hook for a plugin to choose the remote IP address */
-void (*ip_choose_hook) __P((u_int32_t *)) = NULL;
-
-/* local vars */
-static int default_route_set[NUM_PPP]; /* Have set up a default route */
-static int proxy_arp_set[NUM_PPP]; /* Have created proxy arp entry */
-static bool usepeerdns; /* Ask peer for DNS addrs */
-static int ipcp_is_up; /* have called np_up() */
-static bool ask_for_local; /* request our address from peer */
-static char vj_value[8]; /* string form of vj option value */
-static char netmask_str[20]; /* string form of netmask value */
-
-/*
- * Callbacks for fsm code. (CI = Configuration Information)
- */
-static void ipcp_resetci __P((fsm *)); /* Reset our CI */
-static int ipcp_cilen __P((fsm *)); /* Return length of our CI */
-static void ipcp_addci __P((fsm *, u_char *, int *)); /* Add our CI */
-static int ipcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */
-static int ipcp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */
-static int ipcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */
-static int ipcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */
-static void ipcp_up __P((fsm *)); /* We're UP */
-static void ipcp_down __P((fsm *)); /* We're DOWN */
-static void ipcp_finished __P((fsm *)); /* Don't need lower layer */
-
-fsm ipcp_fsm[NUM_PPP]; /* IPCP fsm structure */
-
-static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */
- ipcp_resetci, /* Reset our Configuration Information */
- ipcp_cilen, /* Length of our Configuration Information */
- ipcp_addci, /* Add our Configuration Information */
- ipcp_ackci, /* ACK our Configuration Information */
- ipcp_nakci, /* NAK our Configuration Information */
- ipcp_rejci, /* Reject our Configuration Information */
- ipcp_reqci, /* Request peer's Configuration Information */
- ipcp_up, /* Called when fsm reaches OPENED state */
- ipcp_down, /* Called when fsm leaves OPENED state */
- NULL, /* Called when we want the lower layer up */
- ipcp_finished, /* Called when we want the lower layer down */
- NULL, /* Called when Protocol-Reject received */
- NULL, /* Retransmission is necessary */
- NULL, /* Called to handle protocol-specific codes */
- "IPCP" /* String name of protocol */
-};
-
-/*
- * Command-line options.
- */
-static int setvjslots __P((char **));
-static int setdnsaddr __P((char **));
-static int setwinsaddr __P((char **));
-static int setnetmask __P((char **));
-static int setipaddr __P((char *, char **, int));
-static void printipaddr __P((option_t *, void (*)(void *, char *,...),void *));
-
-static option_t ipcp_option_list[] = {
- { "noip", o_bool, &ipcp_protent.enabled_flag,
- "Disable IP and IPCP" },
- { "-ip", o_bool, &ipcp_protent.enabled_flag,
- "Disable IP and IPCP", OPT_ALIAS },
-
- { "novj", o_bool, &ipcp_wantoptions[0].neg_vj,
- "Disable VJ compression", OPT_A2CLR, &ipcp_allowoptions[0].neg_vj },
- { "-vj", o_bool, &ipcp_wantoptions[0].neg_vj,
- "Disable VJ compression", OPT_ALIAS | OPT_A2CLR,
- &ipcp_allowoptions[0].neg_vj },
-
- { "novjccomp", o_bool, &ipcp_wantoptions[0].cflag,
- "Disable VJ connection-ID compression", OPT_A2CLR,
- &ipcp_allowoptions[0].cflag },
- { "-vjccomp", o_bool, &ipcp_wantoptions[0].cflag,
- "Disable VJ connection-ID compression", OPT_ALIAS | OPT_A2CLR,
- &ipcp_allowoptions[0].cflag },
-
- { "vj-max-slots", o_special, (void *)setvjslots,
- "Set maximum VJ header slots",
- OPT_PRIO | OPT_A2STRVAL | OPT_STATIC, vj_value },
-
- { "ipcp-accept-local", o_bool, &ipcp_wantoptions[0].accept_local,
- "Accept peer's address for us", 1 },
- { "ipcp-accept-remote", o_bool, &ipcp_wantoptions[0].accept_remote,
- "Accept peer's address for it", 1 },
-
- { "ipparam", o_string, &ipparam,
- "Set ip script parameter", OPT_PRIO },
-
- { "noipdefault", o_bool, &disable_defaultip,
- "Don't use name for default IP adrs", 1 },
-
- { "ms-dns", 1, (void *)setdnsaddr,
- "DNS address for the peer's use" },
- { "ms-wins", 1, (void *)setwinsaddr,
- "Nameserver for SMB over TCP/IP for peer" },
-
- { "ipcp-restart", o_int, &ipcp_fsm[0].timeouttime,
- "Set timeout for IPCP", OPT_PRIO },
- { "ipcp-max-terminate", o_int, &ipcp_fsm[0].maxtermtransmits,
- "Set max #xmits for term-reqs", OPT_PRIO },
- { "ipcp-max-configure", o_int, &ipcp_fsm[0].maxconfreqtransmits,
- "Set max #xmits for conf-reqs", OPT_PRIO },
- { "ipcp-max-failure", o_int, &ipcp_fsm[0].maxnakloops,
- "Set max #conf-naks for IPCP", OPT_PRIO },
-
- { "defaultroute", o_bool, &ipcp_wantoptions[0].default_route,
- "Add default route", OPT_ENABLE|1, &ipcp_allowoptions[0].default_route },
- { "nodefaultroute", o_bool, &ipcp_allowoptions[0].default_route,
- "disable defaultroute option", OPT_A2CLR,
- &ipcp_wantoptions[0].default_route },
- { "-defaultroute", o_bool, &ipcp_allowoptions[0].default_route,
- "disable defaultroute option", OPT_ALIAS | OPT_A2CLR,
- &ipcp_wantoptions[0].default_route },
-
- { "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp,
- "Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp },
- { "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp,
- "disable proxyarp option", OPT_A2CLR,
- &ipcp_wantoptions[0].proxy_arp },
- { "-proxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp,
- "disable proxyarp option", OPT_ALIAS | OPT_A2CLR,
- &ipcp_wantoptions[0].proxy_arp },
-
- { "usepeerdns", o_bool, &usepeerdns,
- "Ask peer for DNS address(es)", 1 },
-
- { "netmask", o_special, (void *)setnetmask,
- "set netmask", OPT_PRIO | OPT_A2STRVAL | OPT_STATIC, netmask_str },
-
- { "IP addresses", o_wild, (void *) &setipaddr,
- "set local and remote IP addresses",
- OPT_NOARG | OPT_A2PRINTER, (void *) &printipaddr },
-
- { NULL }
-};
-
-/*
- * Protocol entry points from main code.
- */
-static void ipcp_init __P((int));
-static void ipcp_open __P((int));
-static void ipcp_close __P((int, char *));
-static void ipcp_lowerup __P((int));
-static void ipcp_lowerdown __P((int));
-static void ipcp_input __P((int, u_char *, int));
-static void ipcp_protrej __P((int));
-static int ipcp_printpkt __P((u_char *, int,
- void (*) __P((void *, char *, ...)), void *));
-static void ip_check_options __P((void));
-static int ip_demand_conf __P((int));
-static int ip_active_pkt __P((u_char *, int));
-static void create_resolv __P((u_int32_t, u_int32_t));
-
-struct protent ipcp_protent = {
- PPP_IPCP,
- ipcp_init,
- ipcp_input,
- ipcp_protrej,
- ipcp_lowerup,
- ipcp_lowerdown,
- ipcp_open,
- ipcp_close,
- ipcp_printpkt,
- NULL,
- 1,
- "IPCP",
- "IP",
- ipcp_option_list,
- ip_check_options,
- ip_demand_conf,
- ip_active_pkt
-};
-
-static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t));
-static void ipcp_script __P((char *)); /* Run an up/down script */
-static void ipcp_script_done __P((void *));
-
-/*
- * Lengths of configuration options.
- */
-#define CILEN_VOID 2
-#define CILEN_COMPRESS 4 /* min length for compression protocol opt. */
-#define CILEN_VJ 6 /* length for RFC1332 Van-Jacobson opt. */
-#define CILEN_ADDR 6 /* new-style single address option */
-#define CILEN_ADDRS 10 /* old-style dual address option */
-
-
-#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
- (x) == CONFNAK ? "NAK" : "REJ")
-
-/*
- * This state variable is used to ensure that we don't
- * run an ipcp-up/down script while one is already running.
- */
-static enum script_state {
- s_down,
- s_up,
-} ipcp_script_state;
-static pid_t ipcp_script_pid;
-
-/*
- * Make a string representation of a network IP address.
- */
-char *
-ip_ntoa(ipaddr)
-u_int32_t ipaddr;
-{
- static char b[64];
-
- slprintf(b, sizeof(b), "%I", ipaddr);
- return b;
-}
-
-/*
- * Option parsing.
- */
-
-/*
- * setvjslots - set maximum number of connection slots for VJ compression
- */
-static int
-setvjslots(argv)
- char **argv;
-{
- int value;
-
- if (!int_option(*argv, &value))
- return 0;
- if (value < 2 || value > 16) {
- option_error("vj-max-slots value must be between 2 and 16");
- return 0;
- }
- ipcp_wantoptions [0].maxslotindex =
- ipcp_allowoptions[0].maxslotindex = value - 1;
- slprintf(vj_value, sizeof(vj_value), "%d", value);
- return 1;
-}
-
-/*
- * setdnsaddr - set the dns address(es)
- */
-static int
-setdnsaddr(argv)
- char **argv;
-{
- u_int32_t dns;
- struct hostent *hp;
-
- dns = inet_addr(*argv);
- if (dns == (u_int32_t) -1) {
- if ((hp = gethostbyname(*argv)) == NULL) {
- option_error("invalid address parameter '%s' for ms-dns option",
- *argv);
- return 0;
- }
- dns = *(u_int32_t *)hp->h_addr;
- }
-
- /* We take the last 2 values given, the 2nd-last as the primary
- and the last as the secondary. If only one is given it
- becomes both primary and secondary. */
- if (ipcp_allowoptions[0].dnsaddr[1] == 0)
- ipcp_allowoptions[0].dnsaddr[0] = dns;
- else
- ipcp_allowoptions[0].dnsaddr[0] = ipcp_allowoptions[0].dnsaddr[1];
-
- /* always set the secondary address value. */
- ipcp_allowoptions[0].dnsaddr[1] = dns;
-
- return (1);
-}
-
-/*
- * setwinsaddr - set the wins address(es)
- * This is primrarly used with the Samba package under UNIX or for pointing
- * the caller to the existing WINS server on a Windows NT platform.
- */
-static int
-setwinsaddr(argv)
- char **argv;
-{
- u_int32_t wins;
- struct hostent *hp;
-
- wins = inet_addr(*argv);
- if (wins == (u_int32_t) -1) {
- if ((hp = gethostbyname(*argv)) == NULL) {
- option_error("invalid address parameter '%s' for ms-wins option",
- *argv);
- return 0;
- }
- wins = *(u_int32_t *)hp->h_addr;
- }
-
- /* We take the last 2 values given, the 2nd-last as the primary
- and the last as the secondary. If only one is given it
- becomes both primary and secondary. */
- if (ipcp_allowoptions[0].winsaddr[1] == 0)
- ipcp_allowoptions[0].winsaddr[0] = wins;
- else
- ipcp_allowoptions[0].winsaddr[0] = ipcp_allowoptions[0].winsaddr[1];
-
- /* always set the secondary address value. */
- ipcp_allowoptions[0].winsaddr[1] = wins;
-
- return (1);
-}
-
-/*
- * setipaddr - Set the IP address
- * If doit is 0, the call is to check whether this option is
- * potentially an IP address specification.
- */
-static int
-setipaddr(arg, argv, doit)
- char *arg;
- char **argv;
- int doit;
-{
- struct hostent *hp;
- char *colon;
- u_int32_t local, remote;
- ipcp_options *wo = &ipcp_wantoptions[0];
- static int prio_local = 0, prio_remote = 0;
-
- /*
- * IP address pair separated by ":".
- */
- if ((colon = strchr(arg, ':')) == NULL)
- return 0;
- if (!doit)
- return 1;
-
- /*
- * If colon first character, then no local addr.
- */
- if (colon != arg && option_priority >= prio_local) {
- *colon = '\0';
- if ((local = inet_addr(arg)) == (u_int32_t) -1) {
- if ((hp = gethostbyname(arg)) == NULL) {
- option_error("unknown host: %s", arg);
- return 0;
- }
- local = *(u_int32_t *)hp->h_addr;
- }
- if (bad_ip_adrs(local)) {
- option_error("bad local IP address %s", ip_ntoa(local));
- return 0;
- }
- if (local != 0)
- wo->ouraddr = local;
- *colon = ':';
- prio_local = option_priority;
- }
-
- /*
- * If colon last character, then no remote addr.
- */
- if (*++colon != '\0' && option_priority >= prio_remote) {
- if ((remote = inet_addr(colon)) == (u_int32_t) -1) {
- if ((hp = gethostbyname(colon)) == NULL) {
- option_error("unknown host: %s", colon);
- return 0;
- }
- remote = *(u_int32_t *)hp->h_addr;
- if (remote_name[0] == 0)
- strlcpy(remote_name, colon, sizeof(remote_name));
- }
- if (bad_ip_adrs(remote)) {
- option_error("bad remote IP address %s", ip_ntoa(remote));
- return 0;
- }
- if (remote != 0)
- wo->hisaddr = remote;
- prio_remote = option_priority;
- }
-
- return 1;
-}
-
-static void
-printipaddr(opt, printer, arg)
- option_t *opt;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- ipcp_options *wo = &ipcp_wantoptions[0];
-
- if (wo->ouraddr != 0)
- printer(arg, "%I", wo->ouraddr);
- printer(arg, ":");
- if (wo->hisaddr != 0)
- printer(arg, "%I", wo->hisaddr);
-}
-
-/*
- * setnetmask - set the netmask to be used on the interface.
- */
-static int
-setnetmask(argv)
- char **argv;
-{
- u_int32_t mask;
- int n;
- char *p;
-
- /*
- * Unfortunately, if we use inet_addr, we can't tell whether
- * a result of all 1s is an error or a valid 255.255.255.255.
- */
- p = *argv;
- n = parse_dotted_ip(p, &mask);
-
- mask = htonl(mask);
-
- if (n == 0 || p[n] != 0 || (netmask & ~mask) != 0) {
- option_error("invalid netmask value '%s'", *argv);
- return 0;
- }
-
- netmask = mask;
- slprintf(netmask_str, sizeof(netmask_str), "%I", mask);
-
- return (1);
-}
-
-int
-parse_dotted_ip(p, vp)
- char *p;
- u_int32_t *vp;
-{
- int n;
- u_int32_t v, b;
- char *endp, *p0 = p;
-
- v = 0;
- for (n = 3;; --n) {
- b = strtoul(p, &endp, 0);
- if (endp == p)
- return 0;
- if (b > 255) {
- if (n < 3)
- return 0;
- /* accept e.g. 0xffffff00 */
- *vp = b;
- return endp - p0;
- }
- v |= b << (n * 8);
- p = endp;
- if (n == 0)
- break;
- if (*p != '.')
- return 0;
- ++p;
- }
- *vp = v;
- return p - p0;
-}
-
-
-/*
- * ipcp_init - Initialize IPCP.
- */
-static void
-ipcp_init(unit)
- int unit;
-{
- fsm *f = &ipcp_fsm[unit];
- ipcp_options *wo = &ipcp_wantoptions[unit];
- ipcp_options *ao = &ipcp_allowoptions[unit];
-
- f->unit = unit;
- f->protocol = PPP_IPCP;
- f->callbacks = &ipcp_callbacks;
- fsm_init(&ipcp_fsm[unit]);
-
- memset(wo, 0, sizeof(*wo));
- memset(ao, 0, sizeof(*ao));
-
- wo->neg_addr = 1;
- wo->neg_vj = 1;
- wo->vj_protocol = IPCP_VJ_COMP;
- wo->maxslotindex = MAX_STATES - 1; /* really max index */
- wo->cflag = 1;
-
-
- /* max slots and slot-id compression are currently hardwired in */
- /* ppp_if.c to 16 and 1, this needs to be changed (among other */
- /* things) gmc */
-
- ao->neg_addr = 1;
- ao->neg_vj = 1;
- ao->maxslotindex = MAX_STATES - 1;
- ao->cflag = 1;
-
- /*
- * XXX These control whether the user may use the proxyarp
- * and defaultroute options.
- */
- ao->proxy_arp = 1;
- ao->default_route = 1;
-}
-
-
-/*
- * ipcp_open - IPCP is allowed to come up.
- */
-static void
-ipcp_open(unit)
- int unit;
-{
- fsm_open(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_close - Take IPCP down.
- */
-static void
-ipcp_close(unit, reason)
- int unit;
- char *reason;
-{
- fsm_close(&ipcp_fsm[unit], reason);
-}
-
-
-/*
- * ipcp_lowerup - The lower layer is up.
- */
-static void
-ipcp_lowerup(unit)
- int unit;
-{
- fsm_lowerup(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_lowerdown - The lower layer is down.
- */
-static void
-ipcp_lowerdown(unit)
- int unit;
-{
- fsm_lowerdown(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_input - Input IPCP packet.
- */
-static void
-ipcp_input(unit, p, len)
- int unit;
- u_char *p;
- int len;
-{
- fsm_input(&ipcp_fsm[unit], p, len);
-}
-
-
-/*
- * ipcp_protrej - A Protocol-Reject was received for IPCP.
- *
- * Pretend the lower layer went down, so we shut up.
- */
-static void
-ipcp_protrej(unit)
- int unit;
-{
- fsm_lowerdown(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_resetci - Reset our CI.
- * Called by fsm_sconfreq, Send Configure Request.
- */
-static void
-ipcp_resetci(f)
- fsm *f;
-{
- ipcp_options *wo = &ipcp_wantoptions[f->unit];
- ipcp_options *go = &ipcp_gotoptions[f->unit];
-
- wo->req_addr = wo->neg_addr && ipcp_allowoptions[f->unit].neg_addr;
- if (wo->ouraddr == 0)
- wo->accept_local = 1;
- if (wo->hisaddr == 0)
- wo->accept_remote = 1;
- wo->req_dns1 = usepeerdns; /* Request DNS addresses from the peer */
- wo->req_dns2 = usepeerdns;
- *go = *wo;
- if (!ask_for_local)
- go->ouraddr = 0;
- if (ip_choose_hook)
- ip_choose_hook(&wo->hisaddr);
-}
-
-
-/*
- * ipcp_cilen - Return length of our CI.
- * Called by fsm_sconfreq, Send Configure Request.
- */
-static int
-ipcp_cilen(f)
- fsm *f;
-{
- ipcp_options *go = &ipcp_gotoptions[f->unit];
- ipcp_options *wo = &ipcp_wantoptions[f->unit];
- ipcp_options *ho = &ipcp_hisoptions[f->unit];
-
-#define LENCIVJ(neg, old) (neg ? (old? CILEN_COMPRESS : CILEN_VJ) : 0)
-#define LENCIADDR(neg, old) (neg ? (old? CILEN_ADDRS : CILEN_ADDR) : 0)
-#define LENCIDNS(neg) (neg ? (CILEN_ADDR) : 0)
-
- /*
- * First see if we want to change our options to the old
- * forms because we have received old forms from the peer.
- */
- if (wo->neg_addr && !go->neg_addr && !go->old_addrs) {
- /* use the old style of address negotiation */
- go->neg_addr = 1;
- go->old_addrs = 1;
- }
- if (wo->neg_vj && !go->neg_vj && !go->old_vj) {
- /* try an older style of VJ negotiation */
- /* use the old style only if the peer did */
- if (ho->neg_vj && ho->old_vj) {
- go->neg_vj = 1;
- go->old_vj = 1;
- go->vj_protocol = ho->vj_protocol;
- }
- }
-
- return (LENCIADDR(go->neg_addr, go->old_addrs) +
- LENCIVJ(go->neg_vj, go->old_vj) +
- LENCIDNS(go->req_dns1) +
- LENCIDNS(go->req_dns2)) ;
-}
-
-
-/*
- * ipcp_addci - Add our desired CIs to a packet.
- * Called by fsm_sconfreq, Send Configure Request.
- */
-static void
-ipcp_addci(f, ucp, lenp)
- fsm *f;
- u_char *ucp;
- int *lenp;
-{
- ipcp_options *go = &ipcp_gotoptions[f->unit];
- int len = *lenp;
-
-#define ADDCIVJ(opt, neg, val, old, maxslotindex, cflag) \
- if (neg) { \
- int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
- if (len >= vjlen) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(vjlen, ucp); \
- PUTSHORT(val, ucp); \
- if (!old) { \
- PUTCHAR(maxslotindex, ucp); \
- PUTCHAR(cflag, ucp); \
- } \
- len -= vjlen; \
- } else \
- neg = 0; \
- }
-
-#define ADDCIADDR(opt, neg, old, val1, val2) \
- if (neg) { \
- int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
- if (len >= addrlen) { \
- u_int32_t l; \
- PUTCHAR(opt, ucp); \
- PUTCHAR(addrlen, ucp); \
- l = ntohl(val1); \
- PUTLONG(l, ucp); \
- if (old) { \
- l = ntohl(val2); \
- PUTLONG(l, ucp); \
- } \
- len -= addrlen; \
- } else \
- neg = 0; \
- }
-
-#define ADDCIDNS(opt, neg, addr) \
- if (neg) { \
- if (len >= CILEN_ADDR) { \
- u_int32_t l; \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_ADDR, ucp); \
- l = ntohl(addr); \
- PUTLONG(l, ucp); \
- len -= CILEN_ADDR; \
- } else \
- neg = 0; \
- }
-
- ADDCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr,
- go->old_addrs, go->ouraddr, go->hisaddr);
-
- ADDCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
- go->maxslotindex, go->cflag);
-
- ADDCIDNS(CI_MS_DNS1, go->req_dns1, go->dnsaddr[0]);
-
- ADDCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]);
-
- *lenp -= len;
-}
-
-
-/*
- * ipcp_ackci - Ack our CIs.
- * Called by fsm_rconfack, Receive Configure ACK.
- *
- * Returns:
- * 0 - Ack was bad.
- * 1 - Ack was good.
- */
-static int
-ipcp_ackci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ipcp_options *go = &ipcp_gotoptions[f->unit];
- u_short cilen, citype, cishort;
- u_int32_t cilong;
- u_char cimaxslotindex, cicflag;
-
- /*
- * CIs must be in exactly the same order that we sent...
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-
-#define ACKCIVJ(opt, neg, val, old, maxslotindex, cflag) \
- if (neg) { \
- int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
- if ((len -= vjlen) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != vjlen || \
- citype != opt) \
- goto bad; \
- GETSHORT(cishort, p); \
- if (cishort != val) \
- goto bad; \
- if (!old) { \
- GETCHAR(cimaxslotindex, p); \
- if (cimaxslotindex != maxslotindex) \
- goto bad; \
- GETCHAR(cicflag, p); \
- if (cicflag != cflag) \
- goto bad; \
- } \
- }
-
-#define ACKCIADDR(opt, neg, old, val1, val2) \
- if (neg) { \
- int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
- u_int32_t l; \
- if ((len -= addrlen) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != addrlen || \
- citype != opt) \
- goto bad; \
- GETLONG(l, p); \
- cilong = htonl(l); \
- if (val1 != cilong) \
- goto bad; \
- if (old) { \
- GETLONG(l, p); \
- cilong = htonl(l); \
- if (val2 != cilong) \
- goto bad; \
- } \
- }
-
-#define ACKCIDNS(opt, neg, addr) \
- if (neg) { \
- u_int32_t l; \
- if ((len -= CILEN_ADDR) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_ADDR || citype != opt) \
- goto bad; \
- GETLONG(l, p); \
- cilong = htonl(l); \
- if (addr != cilong) \
- goto bad; \
- }
-
- ACKCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr,
- go->old_addrs, go->ouraddr, go->hisaddr);
-
- ACKCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
- go->maxslotindex, go->cflag);
-
- ACKCIDNS(CI_MS_DNS1, go->req_dns1, go->dnsaddr[0]);
-
- ACKCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]);
-
- /*
- * If there are any remaining CIs, then this packet is bad.
- */
- if (len != 0)
- goto bad;
- return (1);
-
-bad:
- IPCPDEBUG(("ipcp_ackci: received bad Ack!"));
- return (0);
-}
-
-/*
- * ipcp_nakci - Peer has sent a NAK for some of our CIs.
- * This should not modify any state if the Nak is bad
- * or if IPCP is in the OPENED state.
- * Calback from fsm_rconfnakrej - Receive Configure-Nak or Configure-Reject.
- *
- * Returns:
- * 0 - Nak was bad.
- * 1 - Nak was good.
- */
-static int
-ipcp_nakci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ipcp_options *go = &ipcp_gotoptions[f->unit];
- u_char cimaxslotindex, cicflag;
- u_char citype, cilen, *next;
- u_short cishort;
- u_int32_t ciaddr1, ciaddr2, l, cidnsaddr;
- ipcp_options no; /* options we've seen Naks for */
- ipcp_options try; /* options to request next time */
-
- BZERO(&no, sizeof(no));
- try = *go;
-
- /*
- * Any Nak'd CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-#define NAKCIADDR(opt, neg, old, code) \
- if (go->neg && \
- len >= (cilen = (old? CILEN_ADDRS: CILEN_ADDR)) && \
- p[1] == cilen && \
- p[0] == opt) { \
- len -= cilen; \
- INCPTR(2, p); \
- GETLONG(l, p); \
- ciaddr1 = htonl(l); \
- if (old) { \
- GETLONG(l, p); \
- ciaddr2 = htonl(l); \
- no.old_addrs = 1; \
- } else \
- ciaddr2 = 0; \
- no.neg = 1; \
- code \
- }
-
-#define NAKCIVJ(opt, neg, code) \
- if (go->neg && \
- ((cilen = p[1]) == CILEN_COMPRESS || cilen == CILEN_VJ) && \
- len >= cilen && \
- p[0] == opt) { \
- len -= cilen; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- no.neg = 1; \
- code \
- }
-
-#define NAKCIDNS(opt, neg, code) \
- if (go->neg && \
- ((cilen = p[1]) == CILEN_ADDR) && \
- len >= cilen && \
- p[0] == opt) { \
- len -= cilen; \
- INCPTR(2, p); \
- GETLONG(l, p); \
- cidnsaddr = htonl(l); \
- no.neg = 1; \
- code \
- }
-
- /*
- * Accept the peer's idea of {our,his} address, if different
- * from our idea, only if the accept_{local,remote} flag is set.
- */
- NAKCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), neg_addr, go->old_addrs,
- if (go->accept_local && ciaddr1) { /* Do we know our address? */
- try.ouraddr = ciaddr1;
- }
- if (go->accept_remote && ciaddr2) { /* Does he know his? */
- try.hisaddr = ciaddr2;
- }
- );
-
- /*
- * Accept the peer's value of maxslotindex provided that it
- * is less than what we asked for. Turn off slot-ID compression
- * if the peer wants. Send old-style compress-type option if
- * the peer wants.
- */
- NAKCIVJ(CI_COMPRESSTYPE, neg_vj,
- if (cilen == CILEN_VJ) {
- GETCHAR(cimaxslotindex, p);
- GETCHAR(cicflag, p);
- if (cishort == IPCP_VJ_COMP) {
- try.old_vj = 0;
- if (cimaxslotindex < go->maxslotindex)
- try.maxslotindex = cimaxslotindex;
- if (!cicflag)
- try.cflag = 0;
- } else {
- try.neg_vj = 0;
- }
- } else {
- if (cishort == IPCP_VJ_COMP || cishort == IPCP_VJ_COMP_OLD) {
- try.old_vj = 1;
- try.vj_protocol = cishort;
- } else {
- try.neg_vj = 0;
- }
- }
- );
-
- NAKCIDNS(CI_MS_DNS1, req_dns1,
- try.dnsaddr[0] = cidnsaddr;
- );
-
- NAKCIDNS(CI_MS_DNS2, req_dns2,
- try.dnsaddr[1] = cidnsaddr;
- );
-
- /*
- * There may be remaining CIs, if the peer is requesting negotiation
- * on an option that we didn't include in our request packet.
- * If they want to negotiate about IP addresses, we comply.
- * If they want us to ask for compression, we refuse.
- */
- while (len > CILEN_VOID) {
- GETCHAR(citype, p);
- GETCHAR(cilen, p);
- if( (len -= cilen) < 0 )
- goto bad;
- next = p + cilen - 2;
-
- switch (citype) {
- case CI_COMPRESSTYPE:
- if (go->neg_vj || no.neg_vj ||
- (cilen != CILEN_VJ && cilen != CILEN_COMPRESS))
- goto bad;
- no.neg_vj = 1;
- break;
- case CI_ADDRS:
- if ((go->neg_addr && go->old_addrs) || no.old_addrs
- || cilen != CILEN_ADDRS)
- goto bad;
- try.neg_addr = 1;
- try.old_addrs = 1;
- GETLONG(l, p);
- ciaddr1 = htonl(l);
- if (ciaddr1 && go->accept_local)
- try.ouraddr = ciaddr1;
- GETLONG(l, p);
- ciaddr2 = htonl(l);
- if (ciaddr2 && go->accept_remote)
- try.hisaddr = ciaddr2;
- no.old_addrs = 1;
- break;
- case CI_ADDR:
- if (go->neg_addr || no.neg_addr || cilen != CILEN_ADDR)
- goto bad;
- try.old_addrs = 0;
- GETLONG(l, p);
- ciaddr1 = htonl(l);
- if (ciaddr1 && go->accept_local)
- try.ouraddr = ciaddr1;
- if (try.ouraddr != 0)
- try.neg_addr = 1;
- no.neg_addr = 1;
- break;
- }
- p = next;
- }
-
- /*
- * OK, the Nak is good. Now we can update state.
- * If there are any remaining options, we ignore them.
- */
- if (f->state != OPENED)
- *go = try;
-
- return 1;
-
-bad:
- IPCPDEBUG(("ipcp_nakci: received bad Nak!"));
- return 0;
-}
-
-
-/*
- * ipcp_rejci - Reject some of our CIs.
- * Callback from fsm_rconfnakrej.
- */
-static int
-ipcp_rejci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ipcp_options *go = &ipcp_gotoptions[f->unit];
- u_char cimaxslotindex, ciflag, cilen;
- u_short cishort;
- u_int32_t cilong;
- ipcp_options try; /* options to request next time */
-
- try = *go;
- /*
- * Any Rejected CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-#define REJCIADDR(opt, neg, old, val1, val2) \
- if (go->neg && \
- len >= (cilen = old? CILEN_ADDRS: CILEN_ADDR) && \
- p[1] == cilen && \
- p[0] == opt) { \
- u_int32_t l; \
- len -= cilen; \
- INCPTR(2, p); \
- GETLONG(l, p); \
- cilong = htonl(l); \
- /* Check rejected value. */ \
- if (cilong != val1) \
- goto bad; \
- if (old) { \
- GETLONG(l, p); \
- cilong = htonl(l); \
- /* Check rejected value. */ \
- if (cilong != val2) \
- goto bad; \
- } \
- try.neg = 0; \
- }
-
-#define REJCIVJ(opt, neg, val, old, maxslot, cflag) \
- if (go->neg && \
- p[1] == (old? CILEN_COMPRESS : CILEN_VJ) && \
- len >= p[1] && \
- p[0] == opt) { \
- len -= p[1]; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- /* Check rejected value. */ \
- if (cishort != val) \
- goto bad; \
- if (!old) { \
- GETCHAR(cimaxslotindex, p); \
- if (cimaxslotindex != maxslot) \
- goto bad; \
- GETCHAR(ciflag, p); \
- if (ciflag != cflag) \
- goto bad; \
- } \
- try.neg = 0; \
- }
-
-#define REJCIDNS(opt, neg, dnsaddr) \
- if (go->neg && \
- ((cilen = p[1]) == CILEN_ADDR) && \
- len >= cilen && \
- p[0] == opt) { \
- u_int32_t l; \
- len -= cilen; \
- INCPTR(2, p); \
- GETLONG(l, p); \
- cilong = htonl(l); \
- /* Check rejected value. */ \
- if (cilong != dnsaddr) \
- goto bad; \
- try.neg = 0; \
- }
-
-
- REJCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), neg_addr,
- go->old_addrs, go->ouraddr, go->hisaddr);
-
- REJCIVJ(CI_COMPRESSTYPE, neg_vj, go->vj_protocol, go->old_vj,
- go->maxslotindex, go->cflag);
-
- REJCIDNS(CI_MS_DNS1, req_dns1, go->dnsaddr[0]);
-
- REJCIDNS(CI_MS_DNS2, req_dns2, go->dnsaddr[1]);
-
- /*
- * If there are any remaining CIs, then this packet is bad.
- */
- if (len != 0)
- goto bad;
- /*
- * Now we can update state.
- */
- if (f->state != OPENED)
- *go = try;
- return 1;
-
-bad:
- IPCPDEBUG(("ipcp_rejci: received bad Reject!"));
- return 0;
-}
-
-
-/*
- * ipcp_reqci - Check the peer's requested CIs and send appropriate response.
- * Callback from fsm_rconfreq, Receive Configure Request
- *
- * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified
- * appropriately. If reject_if_disagree is non-zero, doesn't return
- * CONFNAK; returns CONFREJ if it can't return CONFACK.
- */
-static int
-ipcp_reqci(f, inp, len, reject_if_disagree)
- fsm *f;
- u_char *inp; /* Requested CIs */
- int *len; /* Length of requested CIs */
- int reject_if_disagree;
-{
- ipcp_options *wo = &ipcp_wantoptions[f->unit];
- ipcp_options *ho = &ipcp_hisoptions[f->unit];
- ipcp_options *ao = &ipcp_allowoptions[f->unit];
- ipcp_options *go = &ipcp_gotoptions[f->unit];
- u_char *cip, *next; /* Pointer to current and next CIs */
- u_short cilen, citype; /* Parsed len, type */
- u_short cishort; /* Parsed short value */
- u_int32_t tl, ciaddr1, ciaddr2;/* Parsed address values */
- int rc = CONFACK; /* Final packet return code */
- int orc; /* Individual option return code */
- u_char *p; /* Pointer to next char to parse */
- u_char *ucp = inp; /* Pointer to current output char */
- int l = *len; /* Length left */
- u_char maxslotindex, cflag;
- int d;
-
- /*
- * Reset all his options.
- */
- BZERO(ho, sizeof(*ho));
-
- /*
- * Process all his options.
- */
- next = inp;
- while (l) {
- orc = CONFACK; /* Assume success */
- cip = p = next; /* Remember begining of CI */
- if (l < 2 || /* Not enough data for CI header or */
- p[1] < 2 || /* CI length too small or */
- p[1] > l) { /* CI length too big? */
- IPCPDEBUG(("ipcp_reqci: bad CI length!"));
- orc = CONFREJ; /* Reject bad CI */
- cilen = l; /* Reject till end of packet */
- l = 0; /* Don't loop again */
- goto endswitch;
- }
- GETCHAR(citype, p); /* Parse CI type */
- GETCHAR(cilen, p); /* Parse CI length */
- l -= cilen; /* Adjust remaining length */
- next += cilen; /* Step to next CI */
-
- switch (citype) { /* Check CI type */
- case CI_ADDRS:
- if (!ao->neg_addr ||
- cilen != CILEN_ADDRS) { /* Check CI length */
- orc = CONFREJ; /* Reject CI */
- break;
- }
-
- /*
- * If he has no address, or if we both have his address but
- * disagree about it, then NAK it with our idea.
- * In particular, if we don't know his address, but he does,
- * then accept it.
- */
- GETLONG(tl, p); /* Parse source address (his) */
- ciaddr1 = htonl(tl);
- if (ciaddr1 != wo->hisaddr
- && (ciaddr1 == 0 || !wo->accept_remote)) {
- orc = CONFNAK;
- if (!reject_if_disagree) {
- DECPTR(sizeof(u_int32_t), p);
- tl = ntohl(wo->hisaddr);
- PUTLONG(tl, p);
- }
- } else if (ciaddr1 == 0 && wo->hisaddr == 0) {
- /*
- * If neither we nor he knows his address, reject the option.
- */
- orc = CONFREJ;
- wo->req_addr = 0; /* don't NAK with 0.0.0.0 later */
- break;
- }
-
- /*
- * If he doesn't know our address, or if we both have our address
- * but disagree about it, then NAK it with our idea.
- */
- GETLONG(tl, p); /* Parse desination address (ours) */
- ciaddr2 = htonl(tl);
- if (ciaddr2 != wo->ouraddr) {
- if (ciaddr2 == 0 || !wo->accept_local) {
- orc = CONFNAK;
- if (!reject_if_disagree) {
- DECPTR(sizeof(u_int32_t), p);
- tl = ntohl(wo->ouraddr);
- PUTLONG(tl, p);
- }
- } else {
- go->ouraddr = ciaddr2; /* accept peer's idea */
- }
- }
-
- ho->neg_addr = 1;
- ho->old_addrs = 1;
- ho->hisaddr = ciaddr1;
- ho->ouraddr = ciaddr2;
- break;
-
- case CI_ADDR:
- if (!ao->neg_addr ||
- cilen != CILEN_ADDR) { /* Check CI length */
- orc = CONFREJ; /* Reject CI */
- break;
- }
-
- /*
- * If he has no address, or if we both have his address but
- * disagree about it, then NAK it with our idea.
- * In particular, if we don't know his address, but he does,
- * then accept it.
- */
- GETLONG(tl, p); /* Parse source address (his) */
- ciaddr1 = htonl(tl);
- if (ciaddr1 != wo->hisaddr
- && (ciaddr1 == 0 || !wo->accept_remote)) {
- orc = CONFNAK;
- if (!reject_if_disagree) {
- DECPTR(sizeof(u_int32_t), p);
- tl = ntohl(wo->hisaddr);
- PUTLONG(tl, p);
- }
- } else if (ciaddr1 == 0 && wo->hisaddr == 0) {
- /*
- * Don't ACK an address of 0.0.0.0 - reject it instead.
- */
- orc = CONFREJ;
- wo->req_addr = 0; /* don't NAK with 0.0.0.0 later */
- break;
- }
-
- ho->neg_addr = 1;
- ho->hisaddr = ciaddr1;
- break;
-
- case CI_MS_DNS1:
- case CI_MS_DNS2:
- /* Microsoft primary or secondary DNS request */
- d = citype == CI_MS_DNS2;
-
- /* If we do not have a DNS address then we cannot send it */
- if (ao->dnsaddr[d] == 0 ||
- cilen != CILEN_ADDR) { /* Check CI length */
- orc = CONFREJ; /* Reject CI */
- break;
- }
- GETLONG(tl, p);
- if (htonl(tl) != ao->dnsaddr[d]) {
- DECPTR(sizeof(u_int32_t), p);
- tl = ntohl(ao->dnsaddr[d]);
- PUTLONG(tl, p);
- orc = CONFNAK;
- }
- break;
-
- case CI_MS_WINS1:
- case CI_MS_WINS2:
- /* Microsoft primary or secondary WINS request */
- d = citype == CI_MS_WINS2;
-
- /* If we do not have a DNS address then we cannot send it */
- if (ao->winsaddr[d] == 0 ||
- cilen != CILEN_ADDR) { /* Check CI length */
- orc = CONFREJ; /* Reject CI */
- break;
- }
- GETLONG(tl, p);
- if (htonl(tl) != ao->winsaddr[d]) {
- DECPTR(sizeof(u_int32_t), p);
- tl = ntohl(ao->winsaddr[d]);
- PUTLONG(tl, p);
- orc = CONFNAK;
- }
- break;
-
- case CI_COMPRESSTYPE:
- if (!ao->neg_vj ||
- (cilen != CILEN_VJ && cilen != CILEN_COMPRESS)) {
- orc = CONFREJ;
- break;
- }
- GETSHORT(cishort, p);
-
- if (!(cishort == IPCP_VJ_COMP ||
- (cishort == IPCP_VJ_COMP_OLD && cilen == CILEN_COMPRESS))) {
- orc = CONFREJ;
- break;
- }
-
- ho->neg_vj = 1;
- ho->vj_protocol = cishort;
- if (cilen == CILEN_VJ) {
- GETCHAR(maxslotindex, p);
- if (maxslotindex > ao->maxslotindex) {
- orc = CONFNAK;
- if (!reject_if_disagree){
- DECPTR(1, p);
- PUTCHAR(ao->maxslotindex, p);
- }
- }
- GETCHAR(cflag, p);
- if (cflag && !ao->cflag) {
- orc = CONFNAK;
- if (!reject_if_disagree){
- DECPTR(1, p);
- PUTCHAR(wo->cflag, p);
- }
- }
- ho->maxslotindex = maxslotindex;
- ho->cflag = cflag;
- } else {
- ho->old_vj = 1;
- ho->maxslotindex = MAX_STATES - 1;
- ho->cflag = 1;
- }
- break;
-
- default:
- orc = CONFREJ;
- break;
- }
-endswitch:
- if (orc == CONFACK && /* Good CI */
- rc != CONFACK) /* but prior CI wasnt? */
- continue; /* Don't send this one */
-
- if (orc == CONFNAK) { /* Nak this CI? */
- if (reject_if_disagree) /* Getting fed up with sending NAKs? */
- orc = CONFREJ; /* Get tough if so */
- else {
- if (rc == CONFREJ) /* Rejecting prior CI? */
- continue; /* Don't send this one */
- if (rc == CONFACK) { /* Ack'd all prior CIs? */
- rc = CONFNAK; /* Not anymore... */
- ucp = inp; /* Backup */
- }
- }
- }
-
- if (orc == CONFREJ && /* Reject this CI */
- rc != CONFREJ) { /* but no prior ones? */
- rc = CONFREJ;
- ucp = inp; /* Backup */
- }
-
- /* Need to move CI? */
- if (ucp != cip)
- BCOPY(cip, ucp, cilen); /* Move it */
-
- /* Update output pointer */
- INCPTR(cilen, ucp);
- }
-
- /*
- * If we aren't rejecting this packet, and we want to negotiate
- * their address, and they didn't send their address, then we
- * send a NAK with a CI_ADDR option appended. We assume the
- * input buffer is long enough that we can append the extra
- * option safely.
- */
- if (rc != CONFREJ && !ho->neg_addr &&
- wo->req_addr && !reject_if_disagree) {
- if (rc == CONFACK) {
- rc = CONFNAK;
- ucp = inp; /* reset pointer */
- wo->req_addr = 0; /* don't ask again */
- }
- PUTCHAR(CI_ADDR, ucp);
- PUTCHAR(CILEN_ADDR, ucp);
- tl = ntohl(wo->hisaddr);
- PUTLONG(tl, ucp);
- }
-
- *len = ucp - inp; /* Compute output length */
- IPCPDEBUG(("ipcp: returning Configure-%s", CODENAME(rc)));
- return (rc); /* Return final code */
-}
-
-
-/*
- * ip_check_options - check that any IP-related options are OK,
- * and assign appropriate defaults.
- */
-static void
-ip_check_options()
-{
- struct hostent *hp;
- u_int32_t local;
- ipcp_options *wo = &ipcp_wantoptions[0];
-
- /*
- * Default our local IP address based on our hostname.
- * If local IP address already given, don't bother.
- */
- if (wo->ouraddr == 0 && !disable_defaultip) {
- /*
- * Look up our hostname (possibly with domain name appended)
- * and take the first IP address as our local IP address.
- * If there isn't an IP address for our hostname, too bad.
- */
- wo->accept_local = 1; /* don't insist on this default value */
- if ((hp = gethostbyname(hostname)) != NULL) {
- local = *(u_int32_t *)hp->h_addr;
- if (local != 0 && !bad_ip_adrs(local))
- wo->ouraddr = local;
- }
- }
- ask_for_local = wo->ouraddr != 0 || !disable_defaultip;
-}
-
-
-/*
- * ip_demand_conf - configure the interface as though
- * IPCP were up, for use with dial-on-demand.
- */
-static int
-ip_demand_conf(u)
- int u;
-{
- ipcp_options *wo = &ipcp_wantoptions[u];
-
- if (wo->hisaddr == 0) {
- /* make up an arbitrary address for the peer */
- wo->hisaddr = htonl(0x0a707070 + ifunit);
- wo->accept_remote = 1;
- }
- if (wo->ouraddr == 0) {
- /* make up an arbitrary address for us */
- wo->ouraddr = htonl(0x0a404040 + ifunit);
- wo->accept_local = 1;
- ask_for_local = 0; /* don't tell the peer this address */
- }
- if (!sifaddr(u, wo->ouraddr, wo->hisaddr, GetMask(wo->ouraddr)))
- return 0;
- if (!sifup(u))
- return 0;
- if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
- return 0;
- if (wo->default_route)
- if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr))
- default_route_set[u] = 1;
- if (wo->proxy_arp)
- if (sifproxyarp(u, wo->hisaddr))
- proxy_arp_set[u] = 1;
-
- notice("local IP address %I", wo->ouraddr);
- notice("remote IP address %I", wo->hisaddr);
-
- return 1;
-}
-
-
-/*
- * ipcp_up - IPCP has come UP.
- *
- * Configure the IP network interface appropriately and bring it up.
- */
-static void
-ipcp_up(f)
- fsm *f;
-{
- u_int32_t mask;
- ipcp_options *ho = &ipcp_hisoptions[f->unit];
- ipcp_options *go = &ipcp_gotoptions[f->unit];
- ipcp_options *wo = &ipcp_wantoptions[f->unit];
-
- IPCPDEBUG(("ipcp: up"));
-
- /*
- * We must have a non-zero IP address for both ends of the link.
- */
- if (!ho->neg_addr)
- ho->hisaddr = wo->hisaddr;
-
- if (go->ouraddr == 0) {
- error("Could not determine local IP address");
- ipcp_close(f->unit, "Could not determine local IP address");
- return;
- }
- if (ho->hisaddr == 0) {
- ho->hisaddr = htonl(0x0a404040 + ifunit);
- warn("Could not determine remote IP address: defaulting to %I",
- ho->hisaddr);
- }
- script_setenv("IPLOCAL", ip_ntoa(go->ouraddr), 0);
- script_setenv("IPREMOTE", ip_ntoa(ho->hisaddr), 1);
-
- if (usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
- script_setenv("USEPEERDNS", "1", 0);
- if (go->dnsaddr[0])
- script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0);
- if (go->dnsaddr[1])
- script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
- create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
- }
-
- /*
- * Check that the peer is allowed to use the IP address it wants.
- */
- if (!auth_ip_addr(f->unit, ho->hisaddr)) {
- error("Peer is not authorized to use remote address %I", ho->hisaddr);
- ipcp_close(f->unit, "Unauthorized remote IP address");
- return;
- }
-
- /* set tcp compression */
- sifvjcomp(f->unit, ho->neg_vj, ho->cflag, ho->maxslotindex);
-
- /*
- * If we are doing dial-on-demand, the interface is already
- * configured, so we put out any saved-up packets, then set the
- * interface to pass IP packets.
- */
- if (demand) {
- if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
- ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr);
- if (go->ouraddr != wo->ouraddr) {
- warn("Local IP address changed to %I", go->ouraddr);
- script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
- wo->ouraddr = go->ouraddr;
- } else
- script_unsetenv("OLDIPLOCAL");
- if (ho->hisaddr != wo->hisaddr) {
- warn("Remote IP address changed to %I", ho->hisaddr);
- script_setenv("OLDIPREMOTE", ip_ntoa(wo->hisaddr), 0);
- wo->hisaddr = ho->hisaddr;
- } else
- script_unsetenv("OLDIPREMOTE");
-
- /* Set the interface to the new addresses */
- mask = GetMask(go->ouraddr);
- if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
- if (debug)
- warn("Interface configuration failed");
- ipcp_close(f->unit, "Interface configuration failed");
- return;
- }
-
- /* assign a default route through the interface if required */
- if (ipcp_wantoptions[f->unit].default_route)
- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
- default_route_set[f->unit] = 1;
-
- /* Make a proxy ARP entry if requested. */
- if (ipcp_wantoptions[f->unit].proxy_arp)
- if (sifproxyarp(f->unit, ho->hisaddr))
- proxy_arp_set[f->unit] = 1;
-
- }
- demand_rexmit(PPP_IP);
- sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
-
- } else {
- /*
- * Set IP addresses and (if specified) netmask.
- */
- mask = GetMask(go->ouraddr);
-
-#if !(defined(SVR4) && (defined(SNI) || defined(__USLC__)))
- if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
- if (debug)
- warn("Interface configuration failed");
- ipcp_close(f->unit, "Interface configuration failed");
- return;
- }
-#endif
-
- /* bring the interface up for IP */
- if (!sifup(f->unit)) {
- if (debug)
- warn("Interface failed to come up");
- ipcp_close(f->unit, "Interface configuration failed");
- return;
- }
-
-#if (defined(SVR4) && (defined(SNI) || defined(__USLC__)))
- if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask)) {
- if (debug)
- warn("Interface configuration failed");
- ipcp_close(f->unit, "Interface configuration failed");
- return;
- }
-#endif
- sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
-
- /* assign a default route through the interface if required */
- if (ipcp_wantoptions[f->unit].default_route)
- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
- default_route_set[f->unit] = 1;
-
- /* Make a proxy ARP entry if requested. */
- if (ipcp_wantoptions[f->unit].proxy_arp)
- if (sifproxyarp(f->unit, ho->hisaddr))
- proxy_arp_set[f->unit] = 1;
-
- ipcp_wantoptions[0].ouraddr = go->ouraddr;
-
- notice("local IP address %I", go->ouraddr);
- notice("remote IP address %I", ho->hisaddr);
- if (go->dnsaddr[0])
- notice("primary DNS address %I", go->dnsaddr[0]);
- if (go->dnsaddr[1])
- notice("secondary DNS address %I", go->dnsaddr[1]);
- }
-
- np_up(f->unit, PPP_IP);
- ipcp_is_up = 1;
-
- if (ip_up_hook)
- ip_up_hook();
-
- /*
- * Execute the ip-up script, like this:
- * /etc/ppp/ip-up interface tty speed local-IP remote-IP
- */
- if (ipcp_script_state == s_down && ipcp_script_pid == 0) {
- ipcp_script_state = s_up;
- ipcp_script(_PATH_IPUP);
- }
-}
-
-
-/*
- * ipcp_down - IPCP has gone DOWN.
- *
- * Take the IP network interface down, clear its addresses
- * and delete routes through it.
- */
-static void
-ipcp_down(f)
- fsm *f;
-{
- IPCPDEBUG(("ipcp: down"));
- /* XXX a bit IPv4-centric here, we only need to get the stats
- * before the interface is marked down. */
- update_link_stats(f->unit);
- if (ip_down_hook)
- ip_down_hook();
- if (ipcp_is_up) {
- ipcp_is_up = 0;
- np_down(f->unit, PPP_IP);
- }
- sifvjcomp(f->unit, 0, 0, 0);
-
- /*
- * If we are doing dial-on-demand, set the interface
- * to queue up outgoing packets (for now).
- */
- if (demand) {
- sifnpmode(f->unit, PPP_IP, NPMODE_QUEUE);
- } else {
- sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
- sifdown(f->unit);
- ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
- ipcp_hisoptions[f->unit].hisaddr);
- }
-
- /* Execute the ip-down script */
- if (ipcp_script_state == s_up && ipcp_script_pid == 0) {
- ipcp_script_state = s_down;
- ipcp_script(_PATH_IPDOWN);
- }
-}
-
-
-/*
- * ipcp_clear_addrs() - clear the interface addresses, routes,
- * proxy arp entries, etc.
- */
-static void
-ipcp_clear_addrs(unit, ouraddr, hisaddr)
- int unit;
- u_int32_t ouraddr; /* local address */
- u_int32_t hisaddr; /* remote address */
-{
- if (proxy_arp_set[unit]) {
- cifproxyarp(unit, hisaddr);
- proxy_arp_set[unit] = 0;
- }
- if (default_route_set[unit]) {
- cifdefaultroute(unit, ouraddr, hisaddr);
- default_route_set[unit] = 0;
- }
- cifaddr(unit, ouraddr, hisaddr);
-}
-
-
-/*
- * ipcp_finished - possibly shut down the lower layers.
- */
-static void
-ipcp_finished(f)
- fsm *f;
-{
- np_finished(f->unit, PPP_IP);
-}
-
-
-/*
- * ipcp_script_done - called when the ip-up or ip-down script
- * has finished.
- */
-static void
-ipcp_script_done(arg)
- void *arg;
-{
- ipcp_script_pid = 0;
- switch (ipcp_script_state) {
- case s_up:
- if (ipcp_fsm[0].state != OPENED) {
- ipcp_script_state = s_down;
- ipcp_script(_PATH_IPDOWN);
- }
- break;
- case s_down:
- if (ipcp_fsm[0].state == OPENED) {
- ipcp_script_state = s_up;
- ipcp_script(_PATH_IPUP);
- }
- break;
- }
-}
-
-
-/*
- * ipcp_script - Execute a script with arguments
- * interface-name tty-name speed local-IP remote-IP.
- */
-static void
-ipcp_script(script)
- char *script;
-{
- char strspeed[32], strlocal[32], strremote[32];
- char *argv[8];
-
- slprintf(strspeed, sizeof(strspeed), "%d", baud_rate);
- slprintf(strlocal, sizeof(strlocal), "%I", ipcp_gotoptions[0].ouraddr);
- slprintf(strremote, sizeof(strremote), "%I", ipcp_hisoptions[0].hisaddr);
-
- argv[0] = script;
- argv[1] = ifname;
- argv[2] = devnam;
- argv[3] = strspeed;
- argv[4] = strlocal;
- argv[5] = strremote;
- argv[6] = ipparam;
- argv[7] = NULL;
- ipcp_script_pid = run_program(script, argv, 0, ipcp_script_done, NULL);
-}
-
-/*
- * create_resolv - create the replacement resolv.conf file
- */
-static void
-create_resolv(peerdns1, peerdns2)
- u_int32_t peerdns1, peerdns2;
-{
- FILE *f;
-
- f = fopen(_PATH_RESOLV, "w");
- if (f == NULL) {
- error("Failed to create %s: %m", _PATH_RESOLV);
- return;
- }
-
- if (peerdns1)
- fprintf(f, "nameserver %s\n", ip_ntoa(peerdns1));
-
- if (peerdns2)
- fprintf(f, "nameserver %s\n", ip_ntoa(peerdns2));
-
- if (ferror(f))
- error("Write failed to %s: %m", _PATH_RESOLV);
-
- fclose(f);
-}
-
-/*
- * ipcp_printpkt - print the contents of an IPCP packet.
- */
-static char *ipcp_codenames[] = {
- "ConfReq", "ConfAck", "ConfNak", "ConfRej",
- "TermReq", "TermAck", "CodeRej"
-};
-
-static int
-ipcp_printpkt(p, plen, printer, arg)
- u_char *p;
- int plen;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- int code, id, len, olen;
- u_char *pstart, *optend;
- u_short cishort;
- u_int32_t cilong;
-
- if (plen < HEADERLEN)
- return 0;
- pstart = p;
- GETCHAR(code, p);
- GETCHAR(id, p);
- GETSHORT(len, p);
- if (len < HEADERLEN || len > plen)
- return 0;
-
- if (code >= 1 && code <= sizeof(ipcp_codenames) / sizeof(char *))
- printer(arg, " %s", ipcp_codenames[code-1]);
- else
- printer(arg, " code=0x%x", code);
- printer(arg, " id=0x%x", id);
- len -= HEADERLEN;
- switch (code) {
- case CONFREQ:
- case CONFACK:
- case CONFNAK:
- case CONFREJ:
- /* print option list */
- while (len >= 2) {
- GETCHAR(code, p);
- GETCHAR(olen, p);
- p -= 2;
- if (olen < 2 || olen > len) {
- break;
- }
- printer(arg, " <");
- len -= olen;
- optend = p + olen;
- switch (code) {
- case CI_ADDRS:
- if (olen == CILEN_ADDRS) {
- p += 2;
- GETLONG(cilong, p);
- printer(arg, "addrs %I", htonl(cilong));
- GETLONG(cilong, p);
- printer(arg, " %I", htonl(cilong));
- }
- break;
- case CI_COMPRESSTYPE:
- if (olen >= CILEN_COMPRESS) {
- p += 2;
- GETSHORT(cishort, p);
- printer(arg, "compress ");
- switch (cishort) {
- case IPCP_VJ_COMP:
- printer(arg, "VJ");
- break;
- case IPCP_VJ_COMP_OLD:
- printer(arg, "old-VJ");
- break;
- default:
- printer(arg, "0x%x", cishort);
- }
- }
- break;
- case CI_ADDR:
- if (olen == CILEN_ADDR) {
- p += 2;
- GETLONG(cilong, p);
- printer(arg, "addr %I", htonl(cilong));
- }
- break;
- case CI_MS_DNS1:
- case CI_MS_DNS2:
- p += 2;
- GETLONG(cilong, p);
- printer(arg, "ms-dns%d %I", code - CI_MS_DNS1 + 1,
- htonl(cilong));
- break;
- case CI_MS_WINS1:
- case CI_MS_WINS2:
- p += 2;
- GETLONG(cilong, p);
- printer(arg, "ms-wins %I", htonl(cilong));
- break;
- }
- while (p < optend) {
- GETCHAR(code, p);
- printer(arg, " %.2x", code);
- }
- printer(arg, ">");
- }
- break;
-
- case TERMACK:
- case TERMREQ:
- if (len > 0 && *p >= ' ' && *p < 0x7f) {
- printer(arg, " ");
- print_string((char *)p, len, printer, arg);
- p += len;
- len = 0;
- }
- break;
- }
-
- /* print the rest of the bytes in the packet */
- for (; len > 0; --len) {
- GETCHAR(code, p);
- printer(arg, " %.2x", code);
- }
-
- return p - pstart;
-}
-
-/*
- * ip_active_pkt - see if this IP packet is worth bringing the link up for.
- * We don't bring the link up for IP fragments or for TCP FIN packets
- * with no data.
- */
-#define IP_HDRLEN 20 /* bytes */
-#define IP_OFFMASK 0x1fff
-// #define IPPROTO_TCP 6
-#define TCP_HDRLEN 20
-#define TH_FIN 0x01
-
-/*
- * We use these macros because the IP header may be at an odd address,
- * and some compilers might use word loads to get th_off or ip_hl.
- */
-
-#define net_short(x) (((x)[0] << 8) + (x)[1])
-#define get_iphl(x) (((unsigned char *)(x))[0] & 0xF)
-#define get_ipoff(x) net_short((unsigned char *)(x) + 6)
-#define get_ipproto(x) (((unsigned char *)(x))[9])
-#define get_tcpoff(x) (((unsigned char *)(x))[12] >> 4)
-#define get_tcpflags(x) (((unsigned char *)(x))[13])
-
-static int
-ip_active_pkt(pkt, len)
- u_char *pkt;
- int len;
-{
- u_char *tcp;
- int hlen;
-
- len -= PPP_HDRLEN;
- pkt += PPP_HDRLEN;
- if (len < IP_HDRLEN)
- return 0;
- if ((get_ipoff(pkt) & IP_OFFMASK) != 0)
- return 0;
- if (get_ipproto(pkt) != IPPROTO_TCP)
- return 1;
- hlen = get_iphl(pkt) * 4;
- if (len < hlen + TCP_HDRLEN)
- return 0;
- tcp = pkt + hlen;
- if ((get_tcpflags(tcp) & TH_FIN) != 0 && len == hlen + get_tcpoff(tcp) * 4)
- return 0;
- return 1;
-}
diff --git a/mdk-stage1/ppp/pppd/ipcp.h b/mdk-stage1/ppp/pppd/ipcp.h
deleted file mode 100644
index 8c5aca861..000000000
--- a/mdk-stage1/ppp/pppd/ipcp.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * ipcp.h - IP Control Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-/*
- * Options.
- */
-#define CI_ADDRS 1 /* IP Addresses */
-#define CI_COMPRESSTYPE 2 /* Compression Type */
-#define CI_ADDR 3
-
-#define CI_MS_DNS1 129 /* Primary DNS value */
-#define CI_MS_WINS1 130 /* Primary WINS value */
-#define CI_MS_DNS2 131 /* Secondary DNS value */
-#define CI_MS_WINS2 132 /* Secondary WINS value */
-
-#define MAX_STATES 16 /* from slcompress.h */
-
-#define IPCP_VJMODE_OLD 1 /* "old" mode (option # = 0x0037) */
-#define IPCP_VJMODE_RFC1172 2 /* "old-rfc"mode (option # = 0x002d) */
-#define IPCP_VJMODE_RFC1332 3 /* "new-rfc"mode (option # = 0x002d, */
- /* maxslot and slot number compression) */
-
-#define IPCP_VJ_COMP 0x002d /* current value for VJ compression option*/
-#define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */
- /* compression option*/
-
-typedef struct ipcp_options {
- bool neg_addr; /* Negotiate IP Address? */
- bool old_addrs; /* Use old (IP-Addresses) option? */
- bool req_addr; /* Ask peer to send IP address? */
- bool default_route; /* Assign default route through interface? */
- bool proxy_arp; /* Make proxy ARP entry for peer? */
- bool neg_vj; /* Van Jacobson Compression? */
- bool old_vj; /* use old (short) form of VJ option? */
- bool accept_local; /* accept peer's value for ouraddr */
- bool accept_remote; /* accept peer's value for hisaddr */
- bool req_dns1; /* Ask peer to send primary DNS address? */
- bool req_dns2; /* Ask peer to send secondary DNS address? */
- int vj_protocol; /* protocol value to use in VJ option */
- int maxslotindex; /* values for RFC1332 VJ compression neg. */
- bool cflag;
- u_int32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */
- u_int32_t dnsaddr[2]; /* Primary and secondary MS DNS entries */
- u_int32_t winsaddr[2]; /* Primary and secondary MS WINS entries */
-} ipcp_options;
-
-extern fsm ipcp_fsm[];
-extern ipcp_options ipcp_wantoptions[];
-extern ipcp_options ipcp_gotoptions[];
-extern ipcp_options ipcp_allowoptions[];
-extern ipcp_options ipcp_hisoptions[];
-
-char *ip_ntoa __P((u_int32_t));
-
-extern struct protent ipcp_protent;
diff --git a/mdk-stage1/ppp/pppd/ipv6cp.c b/mdk-stage1/ppp/pppd/ipv6cp.c
deleted file mode 100644
index 54ff7d7d8..000000000
--- a/mdk-stage1/ppp/pppd/ipv6cp.c
+++ /dev/null
@@ -1,1512 +0,0 @@
-/*
- ipv6cp.c - PPP IPV6 Control Protocol.
- Copyright (C) 1999 Tommi Komulainen <Tommi.Komulainen@iki.fi>
-
- Redistribution and use in source and binary forms are permitted
- provided that the above copyright notice and this paragraph are
- duplicated in all such forms. The name of the author may not be
- used to endorse or promote products derived from this software
- without specific prior written permission.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
-/* Original version, based on RFC2023 :
-
- Copyright (c) 1995, 1996, 1997 Francis.Dupont@inria.fr, INRIA Rocquencourt,
- Alain.Durand@imag.fr, IMAG,
- Jean-Luc.Richier@imag.fr, IMAG-LSR.
-
- Copyright (c) 1998, 1999 Francis.Dupont@inria.fr, GIE DYADE,
- Alain.Durand@imag.fr, IMAG,
- Jean-Luc.Richier@imag.fr, IMAG-LSR.
-
- Ce travail a été fait au sein du GIE DYADE (Groupement d'Intérêt
- Économique ayant pour membres BULL S.A. et l'INRIA).
-
- Ce logiciel informatique est disponible aux conditions
- usuelles dans la recherche, c'est-à-dire qu'il peut
- être utilisé, copié, modifié, distribué à l'unique
- condition que ce texte soit conservé afin que
- l'origine de ce logiciel soit reconnue.
-
- Le nom de l'Institut National de Recherche en Informatique
- et en Automatique (INRIA), de l'IMAG, ou d'une personne morale
- ou physique ayant participé à l'élaboration de ce logiciel ne peut
- être utilisé sans son accord préalable explicite.
-
- Ce logiciel est fourni tel quel sans aucune garantie,
- support ou responsabilité d'aucune sorte.
- Ce logiciel est dérivé de sources d'origine
- "University of California at Berkeley" et
- "Digital Equipment Corporation" couvertes par des copyrights.
-
- L'Institut d'Informatique et de Mathématiques Appliquées de Grenoble (IMAG)
- est une fédération d'unités mixtes de recherche du CNRS, de l'Institut National
- Polytechnique de Grenoble et de l'Université Joseph Fourier regroupant
- sept laboratoires dont le laboratoire Logiciels, Systèmes, Réseaux (LSR).
-
- This work has been done in the context of GIE DYADE (joint R & D venture
- between BULL S.A. and INRIA).
-
- This software is available with usual "research" terms
- with the aim of retain credits of the software.
- Permission to use, copy, modify and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies,
- and the name of INRIA, IMAG, or any contributor not be used in advertising
- or publicity pertaining to this material without the prior explicit
- permission. The software is provided "as is" without any
- warranties, support or liabilities of any kind.
- This software is derived from source code from
- "University of California at Berkeley" and
- "Digital Equipment Corporation" protected by copyrights.
-
- Grenoble's Institute of Computer Science and Applied Mathematics (IMAG)
- is a federation of seven research units funded by the CNRS, National
- Polytechnic Institute of Grenoble and University Joseph Fourier.
- The research unit in Software, Systems, Networks (LSR) is member of IMAG.
-*/
-
-/*
- * Derived from :
- *
- *
- * ipcp.c - PPP IP Control Protocol.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-#define RCSID "$Id$"
-
-/*
- * TODO:
- *
- * Proxy Neighbour Discovery.
- *
- * Better defines for selecting the ordering of
- * interface up / set address. (currently checks for __linux__,
- * since SVR4 && (SNI || __USLC__) didn't work properly)
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <netdb.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "pppd.h"
-#include "fsm.h"
-#include "ipcp.h"
-#include "ipv6cp.h"
-#include "magic.h"
-#include "pathnames.h"
-
-static const char rcsid[] = RCSID;
-
-/* global vars */
-ipv6cp_options ipv6cp_wantoptions[NUM_PPP]; /* Options that we want to request */
-ipv6cp_options ipv6cp_gotoptions[NUM_PPP]; /* Options that peer ack'd */
-ipv6cp_options ipv6cp_allowoptions[NUM_PPP]; /* Options we allow peer to request */
-ipv6cp_options ipv6cp_hisoptions[NUM_PPP]; /* Options that we ack'd */
-int no_ifaceid_neg = 0;
-
-/* local vars */
-static int ipv6cp_is_up;
-
-/*
- * Callbacks for fsm code. (CI = Configuration Information)
- */
-static void ipv6cp_resetci __P((fsm *)); /* Reset our CI */
-static int ipv6cp_cilen __P((fsm *)); /* Return length of our CI */
-static void ipv6cp_addci __P((fsm *, u_char *, int *)); /* Add our CI */
-static int ipv6cp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */
-static int ipv6cp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */
-static int ipv6cp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */
-static int ipv6cp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */
-static void ipv6cp_up __P((fsm *)); /* We're UP */
-static void ipv6cp_down __P((fsm *)); /* We're DOWN */
-static void ipv6cp_finished __P((fsm *)); /* Don't need lower layer */
-
-fsm ipv6cp_fsm[NUM_PPP]; /* IPV6CP fsm structure */
-
-static fsm_callbacks ipv6cp_callbacks = { /* IPV6CP callback routines */
- ipv6cp_resetci, /* Reset our Configuration Information */
- ipv6cp_cilen, /* Length of our Configuration Information */
- ipv6cp_addci, /* Add our Configuration Information */
- ipv6cp_ackci, /* ACK our Configuration Information */
- ipv6cp_nakci, /* NAK our Configuration Information */
- ipv6cp_rejci, /* Reject our Configuration Information */
- ipv6cp_reqci, /* Request peer's Configuration Information */
- ipv6cp_up, /* Called when fsm reaches OPENED state */
- ipv6cp_down, /* Called when fsm leaves OPENED state */
- NULL, /* Called when we want the lower layer up */
- ipv6cp_finished, /* Called when we want the lower layer down */
- NULL, /* Called when Protocol-Reject received */
- NULL, /* Retransmission is necessary */
- NULL, /* Called to handle protocol-specific codes */
- "IPV6CP" /* String name of protocol */
-};
-
-/*
- * Command-line options.
- */
-static int setifaceid __P((char **arg));
-static void printifaceid __P((option_t *,
- void (*)(void *, char *, ...), void *));
-
-static option_t ipv6cp_option_list[] = {
- { "ipv6", o_special, (void *)setifaceid,
- "Set interface identifiers for IPV6",
- OPT_A2PRINTER, (void *)printifaceid },
-
- { "+ipv6", o_bool, &ipv6cp_protent.enabled_flag,
- "Enable IPv6 and IPv6CP", OPT_PRIO | 1 },
- { "noipv6", o_bool, &ipv6cp_protent.enabled_flag,
- "Disable IPv6 and IPv6CP", OPT_PRIOSUB },
- { "-ipv6", o_bool, &ipv6cp_protent.enabled_flag,
- "Disable IPv6 and IPv6CP", OPT_PRIOSUB | OPT_ALIAS },
-
- { "ipv6cp-accept-local", o_bool, &ipv6cp_allowoptions[0].accept_local,
- "Accept peer's interface identifier for us", 1 },
-
- { "ipv6cp-use-ipaddr", o_bool, &ipv6cp_allowoptions[0].use_ip,
- "Use (default) IPv4 address as interface identifier", 1 },
-
-#if defined(SOL2)
- { "ipv6cp-use-persistent", o_bool, &ipv6cp_wantoptions[0].use_persistent,
- "Use uniquely-available persistent value for link local address", 1 },
-#endif /* defined(SOL2) */
-
- { "ipv6cp-restart", o_int, &ipv6cp_fsm[0].timeouttime,
- "Set timeout for IPv6CP", OPT_PRIO },
- { "ipv6cp-max-terminate", o_int, &ipv6cp_fsm[0].maxtermtransmits,
- "Set max #xmits for term-reqs", OPT_PRIO },
- { "ipv6cp-max-configure", o_int, &ipv6cp_fsm[0].maxconfreqtransmits,
- "Set max #xmits for conf-reqs", OPT_PRIO },
- { "ipv6cp-max-failure", o_int, &ipv6cp_fsm[0].maxnakloops,
- "Set max #conf-naks for IPv6CP", OPT_PRIO },
-
- { NULL }
-};
-
-
-/*
- * Protocol entry points from main code.
- */
-static void ipv6cp_init __P((int));
-static void ipv6cp_open __P((int));
-static void ipv6cp_close __P((int, char *));
-static void ipv6cp_lowerup __P((int));
-static void ipv6cp_lowerdown __P((int));
-static void ipv6cp_input __P((int, u_char *, int));
-static void ipv6cp_protrej __P((int));
-static int ipv6cp_printpkt __P((u_char *, int,
- void (*) __P((void *, char *, ...)), void *));
-static void ipv6_check_options __P((void));
-static int ipv6_demand_conf __P((int));
-static int ipv6_active_pkt __P((u_char *, int));
-
-struct protent ipv6cp_protent = {
- PPP_IPV6CP,
- ipv6cp_init,
- ipv6cp_input,
- ipv6cp_protrej,
- ipv6cp_lowerup,
- ipv6cp_lowerdown,
- ipv6cp_open,
- ipv6cp_close,
- ipv6cp_printpkt,
- NULL,
- 0,
- "IPV6CP",
- "IPV6",
- ipv6cp_option_list,
- ipv6_check_options,
- ipv6_demand_conf,
- ipv6_active_pkt
-};
-
-static void ipv6cp_clear_addrs __P((int, eui64_t, eui64_t));
-static void ipv6cp_script __P((char *));
-static void ipv6cp_script_done __P((void *));
-
-/*
- * Lengths of configuration options.
- */
-#define CILEN_VOID 2
-#define CILEN_COMPRESS 4 /* length for RFC2023 compress opt. */
-#define CILEN_IFACEID 10 /* RFC2472, interface identifier */
-
-#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
- (x) == CONFNAK ? "NAK" : "REJ")
-
-/*
- * This state variable is used to ensure that we don't
- * run an ipcp-up/down script while one is already running.
- */
-static enum script_state {
- s_down,
- s_up,
-} ipv6cp_script_state;
-static pid_t ipv6cp_script_pid;
-
-/*
- * setifaceid - set the interface identifiers manually
- */
-static int
-setifaceid(argv)
- char **argv;
-{
- char *comma, *arg, c;
- ipv6cp_options *wo = &ipv6cp_wantoptions[0];
- struct in6_addr addr;
- static int prio_local, prio_remote;
-
-#define VALIDID(a) ( (((a).s6_addr32[0] == 0) && ((a).s6_addr32[1] == 0)) && \
- (((a).s6_addr32[2] != 0) || ((a).s6_addr32[3] != 0)) )
-
- arg = *argv;
- if ((comma = strchr(arg, ',')) == NULL)
- comma = arg + strlen(arg);
-
- /*
- * If comma first character, then no local identifier
- */
- if (comma != arg) {
- c = *comma;
- *comma = '\0';
-
- if (inet_pton(AF_INET6, arg, &addr) == 0 || !VALIDID(addr)) {
- option_error("Illegal interface identifier (local): %s", arg);
- return 0;
- }
-
- if (option_priority >= prio_local) {
- eui64_copy(addr.s6_addr32[2], wo->ourid);
- wo->opt_local = 1;
- prio_local = option_priority;
- }
- *comma = c;
- }
-
- /*
- * If comma last character, the no remote identifier
- */
- if (*comma != 0 && *++comma != '\0') {
- if (inet_pton(AF_INET6, comma, &addr) == 0 || !VALIDID(addr)) {
- option_error("Illegal interface identifier (remote): %s", comma);
- return 0;
- }
- if (option_priority >= prio_remote) {
- eui64_copy(addr.s6_addr32[2], wo->hisid);
- wo->opt_remote = 1;
- prio_remote = option_priority;
- }
- }
-
- if (override_value("+ipv6", option_priority, option_source))
- ipv6cp_protent.enabled_flag = 1;
- return 1;
-}
-
-static void
-printifaceid(opt, printer, arg)
- option_t *opt;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- ipv6cp_options *wo = &ipv6cp_wantoptions[0];
-
- if (wo->opt_local)
- printer(arg, "%s", llv6_ntoa(wo->ourid));
- printer(arg, ",");
- if (wo->opt_remote)
- printer(arg, "%s", llv6_ntoa(wo->hisid));
-}
-
-/*
- * Make a string representation of a network address.
- */
-char *
-llv6_ntoa(ifaceid)
- eui64_t ifaceid;
-{
- static char b[64];
-
- sprintf(b, "fe80::%s", eui64_ntoa(ifaceid));
- return b;
-}
-
-
-/*
- * ipv6cp_init - Initialize IPV6CP.
- */
-static void
-ipv6cp_init(unit)
- int unit;
-{
- fsm *f = &ipv6cp_fsm[unit];
- ipv6cp_options *wo = &ipv6cp_wantoptions[unit];
- ipv6cp_options *ao = &ipv6cp_allowoptions[unit];
-
- f->unit = unit;
- f->protocol = PPP_IPV6CP;
- f->callbacks = &ipv6cp_callbacks;
- fsm_init(&ipv6cp_fsm[unit]);
-
- memset(wo, 0, sizeof(*wo));
- memset(ao, 0, sizeof(*ao));
-
- wo->accept_local = 1;
- wo->neg_ifaceid = 1;
- ao->neg_ifaceid = 1;
-
-#ifdef IPV6CP_COMP
- wo->neg_vj = 1;
- ao->neg_vj = 1;
- wo->vj_protocol = IPV6CP_COMP;
-#endif
-
-}
-
-
-/*
- * ipv6cp_open - IPV6CP is allowed to come up.
- */
-static void
-ipv6cp_open(unit)
- int unit;
-{
- fsm_open(&ipv6cp_fsm[unit]);
-}
-
-
-/*
- * ipv6cp_close - Take IPV6CP down.
- */
-static void
-ipv6cp_close(unit, reason)
- int unit;
- char *reason;
-{
- fsm_close(&ipv6cp_fsm[unit], reason);
-}
-
-
-/*
- * ipv6cp_lowerup - The lower layer is up.
- */
-static void
-ipv6cp_lowerup(unit)
- int unit;
-{
- fsm_lowerup(&ipv6cp_fsm[unit]);
-}
-
-
-/*
- * ipv6cp_lowerdown - The lower layer is down.
- */
-static void
-ipv6cp_lowerdown(unit)
- int unit;
-{
- fsm_lowerdown(&ipv6cp_fsm[unit]);
-}
-
-
-/*
- * ipv6cp_input - Input IPV6CP packet.
- */
-static void
-ipv6cp_input(unit, p, len)
- int unit;
- u_char *p;
- int len;
-{
- fsm_input(&ipv6cp_fsm[unit], p, len);
-}
-
-
-/*
- * ipv6cp_protrej - A Protocol-Reject was received for IPV6CP.
- *
- * Pretend the lower layer went down, so we shut up.
- */
-static void
-ipv6cp_protrej(unit)
- int unit;
-{
- fsm_lowerdown(&ipv6cp_fsm[unit]);
-}
-
-
-/*
- * ipv6cp_resetci - Reset our CI.
- */
-static void
-ipv6cp_resetci(f)
- fsm *f;
-{
- ipv6cp_options *wo = &ipv6cp_wantoptions[f->unit];
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
-
- wo->req_ifaceid = wo->neg_ifaceid && ipv6cp_allowoptions[f->unit].neg_ifaceid;
-
- if (!wo->opt_local) {
- eui64_magic_nz(wo->ourid);
- }
-
- *go = *wo;
- eui64_zero(go->hisid); /* last proposed interface identifier */
-}
-
-
-/*
- * ipv6cp_cilen - Return length of our CI.
- */
-static int
-ipv6cp_cilen(f)
- fsm *f;
-{
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
-
-#define LENCIVJ(neg) (neg ? CILEN_COMPRESS : 0)
-#define LENCIIFACEID(neg) (neg ? CILEN_IFACEID : 0)
-
- return (LENCIIFACEID(go->neg_ifaceid) +
- LENCIVJ(go->neg_vj));
-}
-
-
-/*
- * ipv6cp_addci - Add our desired CIs to a packet.
- */
-static void
-ipv6cp_addci(f, ucp, lenp)
- fsm *f;
- u_char *ucp;
- int *lenp;
-{
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
- int len = *lenp;
-
-#define ADDCIVJ(opt, neg, val) \
- if (neg) { \
- int vjlen = CILEN_COMPRESS; \
- if (len >= vjlen) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(vjlen, ucp); \
- PUTSHORT(val, ucp); \
- len -= vjlen; \
- } else \
- neg = 0; \
- }
-
-#define ADDCIIFACEID(opt, neg, val1) \
- if (neg) { \
- int idlen = CILEN_IFACEID; \
- if (len >= idlen) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(idlen, ucp); \
- eui64_put(val1, ucp); \
- len -= idlen; \
- } else \
- neg = 0; \
- }
-
- ADDCIIFACEID(CI_IFACEID, go->neg_ifaceid, go->ourid);
-
- ADDCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol);
-
- *lenp -= len;
-}
-
-
-/*
- * ipv6cp_ackci - Ack our CIs.
- *
- * Returns:
- * 0 - Ack was bad.
- * 1 - Ack was good.
- */
-static int
-ipv6cp_ackci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
- u_short cilen, citype, cishort;
- eui64_t ifaceid;
-
- /*
- * CIs must be in exactly the same order that we sent...
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-
-#define ACKCIVJ(opt, neg, val) \
- if (neg) { \
- int vjlen = CILEN_COMPRESS; \
- if ((len -= vjlen) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != vjlen || \
- citype != opt) \
- goto bad; \
- GETSHORT(cishort, p); \
- if (cishort != val) \
- goto bad; \
- }
-
-#define ACKCIIFACEID(opt, neg, val1) \
- if (neg) { \
- int idlen = CILEN_IFACEID; \
- if ((len -= idlen) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != idlen || \
- citype != opt) \
- goto bad; \
- eui64_get(ifaceid, p); \
- if (! eui64_equals(val1, ifaceid)) \
- goto bad; \
- }
-
- ACKCIIFACEID(CI_IFACEID, go->neg_ifaceid, go->ourid);
-
- ACKCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol);
-
- /*
- * If there are any remaining CIs, then this packet is bad.
- */
- if (len != 0)
- goto bad;
- return (1);
-
-bad:
- IPV6CPDEBUG(("ipv6cp_ackci: received bad Ack!"));
- return (0);
-}
-
-/*
- * ipv6cp_nakci - Peer has sent a NAK for some of our CIs.
- * This should not modify any state if the Nak is bad
- * or if IPV6CP is in the OPENED state.
- *
- * Returns:
- * 0 - Nak was bad.
- * 1 - Nak was good.
- */
-static int
-ipv6cp_nakci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
- u_char citype, cilen, *next;
- u_short cishort;
- eui64_t ifaceid;
- ipv6cp_options no; /* options we've seen Naks for */
- ipv6cp_options try; /* options to request next time */
-
- BZERO(&no, sizeof(no));
- try = *go;
-
- /*
- * Any Nak'd CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-#define NAKCIIFACEID(opt, neg, code) \
- if (go->neg && \
- len >= (cilen = CILEN_IFACEID) && \
- p[1] == cilen && \
- p[0] == opt) { \
- len -= cilen; \
- INCPTR(2, p); \
- eui64_get(ifaceid, p); \
- no.neg = 1; \
- code \
- }
-
-#define NAKCIVJ(opt, neg, code) \
- if (go->neg && \
- ((cilen = p[1]) == CILEN_COMPRESS) && \
- len >= cilen && \
- p[0] == opt) { \
- len -= cilen; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- no.neg = 1; \
- code \
- }
-
- /*
- * Accept the peer's idea of {our,his} interface identifier, if different
- * from our idea, only if the accept_{local,remote} flag is set.
- */
- NAKCIIFACEID(CI_IFACEID, neg_ifaceid,
- if (go->accept_local) {
- while (eui64_iszero(ifaceid) ||
- eui64_equals(ifaceid, go->hisid)) /* bad luck */
- eui64_magic(ifaceid);
- try.ourid = ifaceid;
- IPV6CPDEBUG(("local LL address %s", llv6_ntoa(ifaceid)));
- }
- );
-
-#ifdef IPV6CP_COMP
- NAKCIVJ(CI_COMPRESSTYPE, neg_vj,
- {
- if (cishort == IPV6CP_COMP) {
- try.vj_protocol = cishort;
- } else {
- try.neg_vj = 0;
- }
- }
- );
-#else
- NAKCIVJ(CI_COMPRESSTYPE, neg_vj,
- {
- try.neg_vj = 0;
- }
- );
-#endif
-
- /*
- * There may be remaining CIs, if the peer is requesting negotiation
- * on an option that we didn't include in our request packet.
- * If they want to negotiate about interface identifier, we comply.
- * If they want us to ask for compression, we refuse.
- */
- while (len > CILEN_VOID) {
- GETCHAR(citype, p);
- GETCHAR(cilen, p);
- if( (len -= cilen) < 0 )
- goto bad;
- next = p + cilen - 2;
-
- switch (citype) {
- case CI_COMPRESSTYPE:
- if (go->neg_vj || no.neg_vj ||
- (cilen != CILEN_COMPRESS))
- goto bad;
- no.neg_vj = 1;
- break;
- case CI_IFACEID:
- if (go->neg_ifaceid || no.neg_ifaceid || cilen != CILEN_IFACEID)
- goto bad;
- try.neg_ifaceid = 1;
- eui64_get(ifaceid, p);
- if (go->accept_local) {
- while (eui64_iszero(ifaceid) ||
- eui64_equals(ifaceid, go->hisid)) /* bad luck */
- eui64_magic(ifaceid);
- try.ourid = ifaceid;
- }
- no.neg_ifaceid = 1;
- break;
- }
- p = next;
- }
-
- /* If there is still anything left, this packet is bad. */
- if (len != 0)
- goto bad;
-
- /*
- * OK, the Nak is good. Now we can update state.
- */
- if (f->state != OPENED)
- *go = try;
-
- return 1;
-
-bad:
- IPV6CPDEBUG(("ipv6cp_nakci: received bad Nak!"));
- return 0;
-}
-
-
-/*
- * ipv6cp_rejci - Reject some of our CIs.
- */
-static int
-ipv6cp_rejci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
- u_char cilen;
- u_short cishort;
- eui64_t ifaceid;
- ipv6cp_options try; /* options to request next time */
-
- try = *go;
- /*
- * Any Rejected CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-#define REJCIIFACEID(opt, neg, val1) \
- if (go->neg && \
- len >= (cilen = CILEN_IFACEID) && \
- p[1] == cilen && \
- p[0] == opt) { \
- len -= cilen; \
- INCPTR(2, p); \
- eui64_get(ifaceid, p); \
- /* Check rejected value. */ \
- if (! eui64_equals(ifaceid, val1)) \
- goto bad; \
- try.neg = 0; \
- }
-
-#define REJCIVJ(opt, neg, val) \
- if (go->neg && \
- p[1] == CILEN_COMPRESS && \
- len >= p[1] && \
- p[0] == opt) { \
- len -= p[1]; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- /* Check rejected value. */ \
- if (cishort != val) \
- goto bad; \
- try.neg = 0; \
- }
-
- REJCIIFACEID(CI_IFACEID, neg_ifaceid, go->ourid);
-
- REJCIVJ(CI_COMPRESSTYPE, neg_vj, go->vj_protocol);
-
- /*
- * If there are any remaining CIs, then this packet is bad.
- */
- if (len != 0)
- goto bad;
- /*
- * Now we can update state.
- */
- if (f->state != OPENED)
- *go = try;
- return 1;
-
-bad:
- IPV6CPDEBUG(("ipv6cp_rejci: received bad Reject!"));
- return 0;
-}
-
-
-/*
- * ipv6cp_reqci - Check the peer's requested CIs and send appropriate response.
- *
- * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified
- * appropriately. If reject_if_disagree is non-zero, doesn't return
- * CONFNAK; returns CONFREJ if it can't return CONFACK.
- */
-static int
-ipv6cp_reqci(f, inp, len, reject_if_disagree)
- fsm *f;
- u_char *inp; /* Requested CIs */
- int *len; /* Length of requested CIs */
- int reject_if_disagree;
-{
- ipv6cp_options *wo = &ipv6cp_wantoptions[f->unit];
- ipv6cp_options *ho = &ipv6cp_hisoptions[f->unit];
- ipv6cp_options *ao = &ipv6cp_allowoptions[f->unit];
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
- u_char *cip, *next; /* Pointer to current and next CIs */
- u_short cilen, citype; /* Parsed len, type */
- u_short cishort; /* Parsed short value */
- eui64_t ifaceid; /* Parsed interface identifier */
- int rc = CONFACK; /* Final packet return code */
- int orc; /* Individual option return code */
- u_char *p; /* Pointer to next char to parse */
- u_char *ucp = inp; /* Pointer to current output char */
- int l = *len; /* Length left */
-
- /*
- * Reset all his options.
- */
- BZERO(ho, sizeof(*ho));
-
- /*
- * Process all his options.
- */
- next = inp;
- while (l) {
- orc = CONFACK; /* Assume success */
- cip = p = next; /* Remember begining of CI */
- if (l < 2 || /* Not enough data for CI header or */
- p[1] < 2 || /* CI length too small or */
- p[1] > l) { /* CI length too big? */
- IPV6CPDEBUG(("ipv6cp_reqci: bad CI length!"));
- orc = CONFREJ; /* Reject bad CI */
- cilen = l; /* Reject till end of packet */
- l = 0; /* Don't loop again */
- goto endswitch;
- }
- GETCHAR(citype, p); /* Parse CI type */
- GETCHAR(cilen, p); /* Parse CI length */
- l -= cilen; /* Adjust remaining length */
- next += cilen; /* Step to next CI */
-
- switch (citype) { /* Check CI type */
- case CI_IFACEID:
- IPV6CPDEBUG(("ipv6cp: received interface identifier "));
-
- if (!ao->neg_ifaceid ||
- cilen != CILEN_IFACEID) { /* Check CI length */
- orc = CONFREJ; /* Reject CI */
- break;
- }
-
- /*
- * If he has no interface identifier, or if we both have same
- * identifier then NAK it with new idea.
- * In particular, if we don't know his identifier, but he does,
- * then accept it.
- */
- eui64_get(ifaceid, p);
- IPV6CPDEBUG(("(%s)", llv6_ntoa(ifaceid)));
- if (eui64_iszero(ifaceid) && eui64_iszero(go->ourid)) {
- orc = CONFREJ; /* Reject CI */
- break;
- }
- if (!eui64_iszero(wo->hisid) &&
- !eui64_equals(ifaceid, wo->hisid) &&
- eui64_iszero(go->hisid)) {
-
- orc = CONFNAK;
- ifaceid = wo->hisid;
- go->hisid = ifaceid;
- DECPTR(sizeof(ifaceid), p);
- eui64_put(ifaceid, p);
- } else
- if (eui64_iszero(ifaceid) || eui64_equals(ifaceid, go->ourid)) {
- orc = CONFNAK;
- if (eui64_iszero(go->hisid)) /* first time, try option */
- ifaceid = wo->hisid;
- while (eui64_iszero(ifaceid) ||
- eui64_equals(ifaceid, go->ourid)) /* bad luck */
- eui64_magic(ifaceid);
- go->hisid = ifaceid;
- DECPTR(sizeof(ifaceid), p);
- eui64_put(ifaceid, p);
- }
-
- ho->neg_ifaceid = 1;
- ho->hisid = ifaceid;
- break;
-
- case CI_COMPRESSTYPE:
- IPV6CPDEBUG(("ipv6cp: received COMPRESSTYPE "));
- if (!ao->neg_vj ||
- (cilen != CILEN_COMPRESS)) {
- orc = CONFREJ;
- break;
- }
- GETSHORT(cishort, p);
- IPV6CPDEBUG(("(%d)", cishort));
-
-#ifdef IPV6CP_COMP
- if (!(cishort == IPV6CP_COMP)) {
- orc = CONFREJ;
- break;
- }
-
- ho->neg_vj = 1;
- ho->vj_protocol = cishort;
- break;
-#else
- orc = CONFREJ;
- break;
-#endif
-
- default:
- orc = CONFREJ;
- break;
- }
-
-endswitch:
- IPV6CPDEBUG((" (%s)\n", CODENAME(orc)));
-
- if (orc == CONFACK && /* Good CI */
- rc != CONFACK) /* but prior CI wasnt? */
- continue; /* Don't send this one */
-
- if (orc == CONFNAK) { /* Nak this CI? */
- if (reject_if_disagree) /* Getting fed up with sending NAKs? */
- orc = CONFREJ; /* Get tough if so */
- else {
- if (rc == CONFREJ) /* Rejecting prior CI? */
- continue; /* Don't send this one */
- if (rc == CONFACK) { /* Ack'd all prior CIs? */
- rc = CONFNAK; /* Not anymore... */
- ucp = inp; /* Backup */
- }
- }
- }
-
- if (orc == CONFREJ && /* Reject this CI */
- rc != CONFREJ) { /* but no prior ones? */
- rc = CONFREJ;
- ucp = inp; /* Backup */
- }
-
- /* Need to move CI? */
- if (ucp != cip)
- BCOPY(cip, ucp, cilen); /* Move it */
-
- /* Update output pointer */
- INCPTR(cilen, ucp);
- }
-
- /*
- * If we aren't rejecting this packet, and we want to negotiate
- * their identifier and they didn't send their identifier, then we
- * send a NAK with a CI_IFACEID option appended. We assume the
- * input buffer is long enough that we can append the extra
- * option safely.
- */
- if (rc != CONFREJ && !ho->neg_ifaceid &&
- wo->req_ifaceid && !reject_if_disagree) {
- if (rc == CONFACK) {
- rc = CONFNAK;
- ucp = inp; /* reset pointer */
- wo->req_ifaceid = 0; /* don't ask again */
- }
- PUTCHAR(CI_IFACEID, ucp);
- PUTCHAR(CILEN_IFACEID, ucp);
- eui64_put(wo->hisid, ucp);
- }
-
- *len = ucp - inp; /* Compute output length */
- IPV6CPDEBUG(("ipv6cp: returning Configure-%s", CODENAME(rc)));
- return (rc); /* Return final code */
-}
-
-
-/*
- * ipv6_check_options - check that any IP-related options are OK,
- * and assign appropriate defaults.
- */
-static void
-ipv6_check_options()
-{
- ipv6cp_options *wo = &ipv6cp_wantoptions[0];
-
- if (!ipv6cp_protent.enabled_flag)
- return;
-
-#if defined(SOL2)
- /*
- * Persistent link-local id is only used when user has not explicitly
- * configure/hard-code the id
- */
- if ((wo->use_persistent) && (!wo->opt_local) && (!wo->opt_remote)) {
-
- /*
- * On systems where there are no Ethernet interfaces used, there
- * may be other ways to obtain a persistent id. Right now, it
- * will fall back to using magic [see eui64_magic] below when
- * an EUI-48 from MAC address can't be obtained. Other possibilities
- * include obtaining EEPROM serial numbers, or some other unique
- * yet persistent number. On Sparc platforms, this is possible,
- * but too bad there's no standards yet for x86 machines.
- */
- if (ether_to_eui64(&wo->ourid)) {
- wo->opt_local = 1;
- }
- }
-#endif
-
- if (!wo->opt_local) { /* init interface identifier */
- if (wo->use_ip && eui64_iszero(wo->ourid)) {
- eui64_setlo32(wo->ourid, ntohl(ipcp_wantoptions[0].ouraddr));
- if (!eui64_iszero(wo->ourid))
- wo->opt_local = 1;
- }
-
- while (eui64_iszero(wo->ourid))
- eui64_magic(wo->ourid);
- }
-
- if (!wo->opt_remote) {
- if (wo->use_ip && eui64_iszero(wo->hisid)) {
- eui64_setlo32(wo->hisid, ntohl(ipcp_wantoptions[0].hisaddr));
- if (!eui64_iszero(wo->hisid))
- wo->opt_remote = 1;
- }
- }
-
- if (demand && (eui64_iszero(wo->ourid) || eui64_iszero(wo->hisid))) {
- option_error("local/remote LL address required for demand-dialling\n");
- exit(1);
- }
-}
-
-
-/*
- * ipv6_demand_conf - configure the interface as though
- * IPV6CP were up, for use with dial-on-demand.
- */
-static int
-ipv6_demand_conf(u)
- int u;
-{
- ipv6cp_options *wo = &ipv6cp_wantoptions[u];
-
-#if defined(__linux__) || defined(SOL2) || (defined(SVR4) && (defined(SNI) || defined(__USLC__)))
-#if defined(SOL2)
- if (!sif6up(u))
- return 0;
-#else
- if (!sifup(u))
- return 0;
-#endif /* defined(SOL2) */
-#endif
- if (!sif6addr(u, wo->ourid, wo->hisid))
- return 0;
-#if !defined(__linux__) && !(defined(SVR4) && (defined(SNI) || defined(__USLC__)))
- if (!sifup(u))
- return 0;
-#endif
- if (!sifnpmode(u, PPP_IPV6, NPMODE_QUEUE))
- return 0;
-
- notice("ipv6_demand_conf");
- notice("local LL address %s", llv6_ntoa(wo->ourid));
- notice("remote LL address %s", llv6_ntoa(wo->hisid));
-
- return 1;
-}
-
-
-/*
- * ipv6cp_up - IPV6CP has come UP.
- *
- * Configure the IPv6 network interface appropriately and bring it up.
- */
-static void
-ipv6cp_up(f)
- fsm *f;
-{
- ipv6cp_options *ho = &ipv6cp_hisoptions[f->unit];
- ipv6cp_options *go = &ipv6cp_gotoptions[f->unit];
- ipv6cp_options *wo = &ipv6cp_wantoptions[f->unit];
-
- IPV6CPDEBUG(("ipv6cp: up"));
-
- /*
- * We must have a non-zero LL address for both ends of the link.
- */
- if (!ho->neg_ifaceid)
- ho->hisid = wo->hisid;
-
- if(!no_ifaceid_neg) {
- if (eui64_iszero(ho->hisid)) {
- error("Could not determine remote LL address");
- ipv6cp_close(f->unit, "Could not determine remote LL address");
- return;
- }
- if (eui64_iszero(go->ourid)) {
- error("Could not determine local LL address");
- ipv6cp_close(f->unit, "Could not determine local LL address");
- return;
- }
- if (eui64_equals(go->ourid, ho->hisid)) {
- error("local and remote LL addresses are equal");
- ipv6cp_close(f->unit, "local and remote LL addresses are equal");
- return;
- }
- }
- script_setenv("LLLOCAL", llv6_ntoa(go->ourid), 0);
- script_setenv("LLREMOTE", llv6_ntoa(ho->hisid), 0);
-
-#ifdef IPV6CP_COMP
- /* set tcp compression */
- sif6comp(f->unit, ho->neg_vj);
-#endif
-
- /*
- * If we are doing dial-on-demand, the interface is already
- * configured, so we put out any saved-up packets, then set the
- * interface to pass IPv6 packets.
- */
- if (demand) {
- if (! eui64_equals(go->ourid, wo->ourid) ||
- ! eui64_equals(ho->hisid, wo->hisid)) {
- if (! eui64_equals(go->ourid, wo->ourid))
- warn("Local LL address changed to %s",
- llv6_ntoa(go->ourid));
- if (! eui64_equals(ho->hisid, wo->hisid))
- warn("Remote LL address changed to %s",
- llv6_ntoa(ho->hisid));
- ipv6cp_clear_addrs(f->unit, go->ourid, ho->hisid);
-
- /* Set the interface to the new addresses */
- if (!sif6addr(f->unit, go->ourid, ho->hisid)) {
- if (debug)
- warn("sif6addr failed");
- ipv6cp_close(f->unit, "Interface configuration failed");
- return;
- }
-
- }
- demand_rexmit(PPP_IPV6);
- sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
-
- } else {
- /*
- * Set LL addresses
- */
-#if !defined(__linux__) && !defined(SOL2) && !(defined(SVR4) && (defined(SNI) || defined(__USLC__)))
- if (!sif6addr(f->unit, go->ourid, ho->hisid)) {
- if (debug)
- warn("sif6addr failed");
- ipv6cp_close(f->unit, "Interface configuration failed");
- return;
- }
-#endif
-
- /* bring the interface up for IPv6 */
-#if defined(SOL2)
- if (!sif6up(f->unit)) {
- if (debug)
- warn("sifup failed (IPV6)");
- ipv6cp_close(f->unit, "Interface configuration failed");
- return;
- }
-#else
- if (!sifup(f->unit)) {
- if (debug)
- warn("sifup failed (IPV6)");
- ipv6cp_close(f->unit, "Interface configuration failed");
- return;
- }
-#endif /* defined(SOL2) */
-
-#if defined(__linux__) || defined(SOL2) || (defined(SVR4) && (defined(SNI) || defined(__USLC__)))
- if (!sif6addr(f->unit, go->ourid, ho->hisid)) {
- if (debug)
- warn("sif6addr failed");
- ipv6cp_close(f->unit, "Interface configuration failed");
- return;
- }
-#endif
- sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
-
- notice("local LL address %s", llv6_ntoa(go->ourid));
- notice("remote LL address %s", llv6_ntoa(ho->hisid));
- }
-
- np_up(f->unit, PPP_IPV6);
- ipv6cp_is_up = 1;
-
- /*
- * Execute the ipv6-up script, like this:
- * /etc/ppp/ipv6-up interface tty speed local-LL remote-LL
- */
- if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) {
- ipv6cp_script_state = s_up;
- ipv6cp_script(_PATH_IPV6UP);
- }
-}
-
-
-/*
- * ipv6cp_down - IPV6CP has gone DOWN.
- *
- * Take the IPv6 network interface down, clear its addresses
- * and delete routes through it.
- */
-static void
-ipv6cp_down(f)
- fsm *f;
-{
- IPV6CPDEBUG(("ipv6cp: down"));
- update_link_stats(f->unit);
- if (ipv6cp_is_up) {
- ipv6cp_is_up = 0;
- np_down(f->unit, PPP_IPV6);
- }
-#ifdef IPV6CP_COMP
- sif6comp(f->unit, 0);
-#endif
-
- /*
- * If we are doing dial-on-demand, set the interface
- * to queue up outgoing packets (for now).
- */
- if (demand) {
- sifnpmode(f->unit, PPP_IPV6, NPMODE_QUEUE);
- } else {
- sifnpmode(f->unit, PPP_IPV6, NPMODE_DROP);
-#if !defined(__linux__) && !(defined(SVR4) && (defined(SNI) || defined(__USLC)))
-#if defined(SOL2)
- sif6down(f->unit);
-#else
- sifdown(f->unit);
-#endif /* defined(SOL2) */
-#endif
- ipv6cp_clear_addrs(f->unit,
- ipv6cp_gotoptions[f->unit].ourid,
- ipv6cp_hisoptions[f->unit].hisid);
-#if defined(__linux__) || (defined(SVR4) && (defined(SNI) || defined(__USLC)))
- sifdown(f->unit);
-#endif
- }
-
- /* Execute the ipv6-down script */
- if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) {
- ipv6cp_script_state = s_down;
- ipv6cp_script(_PATH_IPV6DOWN);
- }
-}
-
-
-/*
- * ipv6cp_clear_addrs() - clear the interface addresses, routes,
- * proxy neighbour discovery entries, etc.
- */
-static void
-ipv6cp_clear_addrs(unit, ourid, hisid)
- int unit;
- eui64_t ourid;
- eui64_t hisid;
-{
- cif6addr(unit, ourid, hisid);
-}
-
-
-/*
- * ipv6cp_finished - possibly shut down the lower layers.
- */
-static void
-ipv6cp_finished(f)
- fsm *f;
-{
- np_finished(f->unit, PPP_IPV6);
-}
-
-
-/*
- * ipv6cp_script_done - called when the ipv6-up or ipv6-down script
- * has finished.
- */
-static void
-ipv6cp_script_done(arg)
- void *arg;
-{
- ipv6cp_script_pid = 0;
- switch (ipv6cp_script_state) {
- case s_up:
- if (ipv6cp_fsm[0].state != OPENED) {
- ipv6cp_script_state = s_down;
- ipv6cp_script(_PATH_IPV6DOWN);
- }
- break;
- case s_down:
- if (ipv6cp_fsm[0].state == OPENED) {
- ipv6cp_script_state = s_up;
- ipv6cp_script(_PATH_IPV6UP);
- }
- break;
- }
-}
-
-
-/*
- * ipv6cp_script - Execute a script with arguments
- * interface-name tty-name speed local-LL remote-LL.
- */
-static void
-ipv6cp_script(script)
- char *script;
-{
- char strspeed[32], strlocal[32], strremote[32];
- char *argv[8];
-
- sprintf(strspeed, "%d", baud_rate);
- strcpy(strlocal, llv6_ntoa(ipv6cp_gotoptions[0].ourid));
- strcpy(strremote, llv6_ntoa(ipv6cp_hisoptions[0].hisid));
-
- argv[0] = script;
- argv[1] = ifname;
- argv[2] = devnam;
- argv[3] = strspeed;
- argv[4] = strlocal;
- argv[5] = strremote;
- argv[6] = ipparam;
- argv[7] = NULL;
-
- ipv6cp_script_pid = run_program(script, argv, 0, ipv6cp_script_done, NULL);
-}
-
-/*
- * ipv6cp_printpkt - print the contents of an IPV6CP packet.
- */
-static char *ipv6cp_codenames[] = {
- "ConfReq", "ConfAck", "ConfNak", "ConfRej",
- "TermReq", "TermAck", "CodeRej"
-};
-
-static int
-ipv6cp_printpkt(p, plen, printer, arg)
- u_char *p;
- int plen;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- int code, id, len, olen;
- u_char *pstart, *optend;
- u_short cishort;
- eui64_t ifaceid;
-
- if (plen < HEADERLEN)
- return 0;
- pstart = p;
- GETCHAR(code, p);
- GETCHAR(id, p);
- GETSHORT(len, p);
- if (len < HEADERLEN || len > plen)
- return 0;
-
- if (code >= 1 && code <= sizeof(ipv6cp_codenames) / sizeof(char *))
- printer(arg, " %s", ipv6cp_codenames[code-1]);
- else
- printer(arg, " code=0x%x", code);
- printer(arg, " id=0x%x", id);
- len -= HEADERLEN;
- switch (code) {
- case CONFREQ:
- case CONFACK:
- case CONFNAK:
- case CONFREJ:
- /* print option list */
- while (len >= 2) {
- GETCHAR(code, p);
- GETCHAR(olen, p);
- p -= 2;
- if (olen < 2 || olen > len) {
- break;
- }
- printer(arg, " <");
- len -= olen;
- optend = p + olen;
- switch (code) {
- case CI_COMPRESSTYPE:
- if (olen >= CILEN_COMPRESS) {
- p += 2;
- GETSHORT(cishort, p);
- printer(arg, "compress ");
- printer(arg, "0x%x", cishort);
- }
- break;
- case CI_IFACEID:
- if (olen == CILEN_IFACEID) {
- p += 2;
- eui64_get(ifaceid, p);
- printer(arg, "addr %s", llv6_ntoa(ifaceid));
- }
- break;
- }
- while (p < optend) {
- GETCHAR(code, p);
- printer(arg, " %.2x", code);
- }
- printer(arg, ">");
- }
- break;
-
- case TERMACK:
- case TERMREQ:
- if (len > 0 && *p >= ' ' && *p < 0x7f) {
- printer(arg, " ");
- print_string((char *)p, len, printer, arg);
- p += len;
- len = 0;
- }
- break;
- }
-
- /* print the rest of the bytes in the packet */
- for (; len > 0; --len) {
- GETCHAR(code, p);
- printer(arg, " %.2x", code);
- }
-
- return p - pstart;
-}
-
-/*
- * ipv6_active_pkt - see if this IP packet is worth bringing the link up for.
- * We don't bring the link up for IP fragments or for TCP FIN packets
- * with no data.
- */
-#define IP6_HDRLEN 40 /* bytes */
-#define IP6_NHDR_FRAG 44 /* fragment IPv6 header */
-#define IPPROTO_TCP 6
-#define TCP_HDRLEN 20
-#define TH_FIN 0x01
-
-/*
- * We use these macros because the IP header may be at an odd address,
- * and some compilers might use word loads to get th_off or ip_hl.
- */
-
-#define get_ip6nh(x) (((unsigned char *)(x))[6])
-#define get_tcpoff(x) (((unsigned char *)(x))[12] >> 4)
-#define get_tcpflags(x) (((unsigned char *)(x))[13])
-
-static int
-ipv6_active_pkt(pkt, len)
- u_char *pkt;
- int len;
-{
- u_char *tcp;
-
- len -= PPP_HDRLEN;
- pkt += PPP_HDRLEN;
- if (len < IP6_HDRLEN)
- return 0;
- if (get_ip6nh(pkt) == IP6_NHDR_FRAG)
- return 0;
- if (get_ip6nh(pkt) != IPPROTO_TCP)
- return 1;
- if (len < IP6_HDRLEN + TCP_HDRLEN)
- return 0;
- tcp = pkt + IP6_HDRLEN;
- if ((get_tcpflags(tcp) & TH_FIN) != 0 && len == IP6_HDRLEN + get_tcpoff(tcp) * 4)
- return 0;
- return 1;
-}
diff --git a/mdk-stage1/ppp/pppd/ipv6cp.h b/mdk-stage1/ppp/pppd/ipv6cp.h
deleted file mode 100644
index 60d366eb3..000000000
--- a/mdk-stage1/ppp/pppd/ipv6cp.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- ipv6cp.h - PPP IPV6 Control Protocol.
- Copyright (C) 1999 Tommi Komulainen <Tommi.Komulainen@iki.fi>
-
- Redistribution and use in source and binary forms are permitted
- provided that the above copyright notice and this paragraph are
- duplicated in all such forms. The name of the author may not be
- used to endorse or promote products derived from this software
- without specific prior written permission.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
-/* Original version, based on RFC2023 :
-
- Copyright (c) 1995, 1996, 1997 Francis.Dupont@inria.fr, INRIA Rocquencourt,
- Alain.Durand@imag.fr, IMAG,
- Jean-Luc.Richier@imag.fr, IMAG-LSR.
-
- Copyright (c) 1998, 1999 Francis.Dupont@inria.fr, GIE DYADE,
- Alain.Durand@imag.fr, IMAG,
- Jean-Luc.Richier@imag.fr, IMAG-LSR.
-
- Ce travail a été fait au sein du GIE DYADE (Groupement d'Intérêt
- Économique ayant pour membres BULL S.A. et l'INRIA).
-
- Ce logiciel informatique est disponible aux conditions
- usuelles dans la recherche, c'est-à-dire qu'il peut
- être utilisé, copié, modifié, distribué à l'unique
- condition que ce texte soit conservé afin que
- l'origine de ce logiciel soit reconnue.
-
- Le nom de l'Institut National de Recherche en Informatique
- et en Automatique (INRIA), de l'IMAG, ou d'une personne morale
- ou physique ayant participé à l'élaboration de ce logiciel ne peut
- être utilisé sans son accord préalable explicite.
-
- Ce logiciel est fourni tel quel sans aucune garantie,
- support ou responsabilité d'aucune sorte.
- Ce logiciel est dérivé de sources d'origine
- "University of California at Berkeley" et
- "Digital Equipment Corporation" couvertes par des copyrights.
-
- L'Institut d'Informatique et de Mathématiques Appliquées de Grenoble (IMAG)
- est une fédération d'unités mixtes de recherche du CNRS, de l'Institut National
- Polytechnique de Grenoble et de l'Université Joseph Fourier regroupant
- sept laboratoires dont le laboratoire Logiciels, Systèmes, Réseaux (LSR).
-
- This work has been done in the context of GIE DYADE (joint R & D venture
- between BULL S.A. and INRIA).
-
- This software is available with usual "research" terms
- with the aim of retain credits of the software.
- Permission to use, copy, modify and distribute this software for any
- purpose and without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies,
- and the name of INRIA, IMAG, or any contributor not be used in advertising
- or publicity pertaining to this material without the prior explicit
- permission. The software is provided "as is" without any
- warranties, support or liabilities of any kind.
- This software is derived from source code from
- "University of California at Berkeley" and
- "Digital Equipment Corporation" protected by copyrights.
-
- Grenoble's Institute of Computer Science and Applied Mathematics (IMAG)
- is a federation of seven research units funded by the CNRS, National
- Polytechnic Institute of Grenoble and University Joseph Fourier.
- The research unit in Software, Systems, Networks (LSR) is member of IMAG.
-*/
-
-/*
- * Derived from :
- *
- *
- * ipcp.h - IP Control Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-/*
- * Options.
- */
-#define CI_IFACEID 1 /* Interface Identifier */
-#define CI_COMPRESSTYPE 2 /* Compression Type */
-
-/* No compression types yet defined.
- *#define IPV6CP_COMP 0x004f
- */
-typedef struct ipv6cp_options {
- int neg_ifaceid; /* Negotiate interface identifier? */
- int req_ifaceid; /* Ask peer to send interface identifier? */
- int accept_local; /* accept peer's value for iface id? */
- int opt_local; /* ourtoken set by option */
- int opt_remote; /* histoken set by option */
- int use_ip; /* use IP as interface identifier */
-#if defined(SOL2)
- int use_persistent; /* use uniquely persistent value for address */
-#endif /* defined(SOL2) */
- int neg_vj; /* Van Jacobson Compression? */
- u_short vj_protocol; /* protocol value to use in VJ option */
- eui64_t ourid, hisid; /* Interface identifiers */
-} ipv6cp_options;
-
-extern fsm ipv6cp_fsm[];
-extern ipv6cp_options ipv6cp_wantoptions[];
-extern ipv6cp_options ipv6cp_gotoptions[];
-extern ipv6cp_options ipv6cp_allowoptions[];
-extern ipv6cp_options ipv6cp_hisoptions[];
-
-extern struct protent ipv6cp_protent;
diff --git a/mdk-stage1/ppp/pppd/ipxcp.c b/mdk-stage1/ppp/pppd/ipxcp.c
deleted file mode 100644
index f9a12b934..000000000
--- a/mdk-stage1/ppp/pppd/ipxcp.c
+++ /dev/null
@@ -1,1570 +0,0 @@
-/*
- * ipxcp.c - PPP IPX Control Protocol.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifdef IPX_CHANGE
-
-#define RCSID "$Id$"
-
-/*
- * TODO:
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include "pppd.h"
-#include "fsm.h"
-#include "ipxcp.h"
-#include "pathnames.h"
-#include "magic.h"
-
-static const char rcsid[] = RCSID;
-
-/* global vars */
-ipxcp_options ipxcp_wantoptions[NUM_PPP]; /* Options that we want to request */
-ipxcp_options ipxcp_gotoptions[NUM_PPP]; /* Options that peer ack'd */
-ipxcp_options ipxcp_allowoptions[NUM_PPP]; /* Options we allow peer to request */
-ipxcp_options ipxcp_hisoptions[NUM_PPP]; /* Options that we ack'd */
-
-#define wo (&ipxcp_wantoptions[0])
-#define ao (&ipxcp_allowoptions[0])
-#define go (&ipxcp_gotoptions[0])
-#define ho (&ipxcp_hisoptions[0])
-
-/*
- * Callbacks for fsm code. (CI = Configuration Information)
- */
-static void ipxcp_resetci __P((fsm *)); /* Reset our CI */
-static int ipxcp_cilen __P((fsm *)); /* Return length of our CI */
-static void ipxcp_addci __P((fsm *, u_char *, int *)); /* Add our CI */
-static int ipxcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */
-static int ipxcp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */
-static int ipxcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */
-static int ipxcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv CI */
-static void ipxcp_up __P((fsm *)); /* We're UP */
-static void ipxcp_down __P((fsm *)); /* We're DOWN */
-static void ipxcp_finished __P((fsm *)); /* Don't need lower layer */
-static void ipxcp_script __P((fsm *, char *)); /* Run an up/down script */
-
-fsm ipxcp_fsm[NUM_PPP]; /* IPXCP fsm structure */
-
-static fsm_callbacks ipxcp_callbacks = { /* IPXCP callback routines */
- ipxcp_resetci, /* Reset our Configuration Information */
- ipxcp_cilen, /* Length of our Configuration Information */
- ipxcp_addci, /* Add our Configuration Information */
- ipxcp_ackci, /* ACK our Configuration Information */
- ipxcp_nakci, /* NAK our Configuration Information */
- ipxcp_rejci, /* Reject our Configuration Information */
- ipxcp_reqci, /* Request peer's Configuration Information */
- ipxcp_up, /* Called when fsm reaches OPENED state */
- ipxcp_down, /* Called when fsm leaves OPENED state */
- NULL, /* Called when we want the lower layer up */
- ipxcp_finished, /* Called when we want the lower layer down */
- NULL, /* Called when Protocol-Reject received */
- NULL, /* Retransmission is necessary */
- NULL, /* Called to handle protocol-specific codes */
- "IPXCP" /* String name of protocol */
-};
-
-/*
- * Command-line options.
- */
-static int setipxnode __P((char **));
-static void printipxnode __P((option_t *,
- void (*)(void *, char *, ...), void *));
-static int setipxname __P((char **));
-
-static option_t ipxcp_option_list[] = {
- { "ipx", o_bool, &ipxcp_protent.enabled_flag,
- "Enable IPXCP (and IPX)", OPT_PRIO | 1 },
- { "+ipx", o_bool, &ipxcp_protent.enabled_flag,
- "Enable IPXCP (and IPX)", OPT_PRIOSUB | OPT_ALIAS | 1 },
- { "noipx", o_bool, &ipxcp_protent.enabled_flag,
- "Disable IPXCP (and IPX)", OPT_PRIOSUB },
- { "-ipx", o_bool, &ipxcp_protent.enabled_flag,
- "Disable IPXCP (and IPX)", OPT_PRIOSUB | OPT_ALIAS },
-
- { "ipx-network", o_uint32, &ipxcp_wantoptions[0].our_network,
- "Set our IPX network number", OPT_PRIO, &ipxcp_wantoptions[0].neg_nn },
-
- { "ipxcp-accept-network", o_bool, &ipxcp_wantoptions[0].accept_network,
- "Accept peer IPX network number", 1,
- &ipxcp_allowoptions[0].accept_network },
-
- { "ipx-node", o_special, (void *)setipxnode,
- "Set IPX node number", OPT_A2PRINTER, (void *)printipxnode },
-
- { "ipxcp-accept-local", o_bool, &ipxcp_wantoptions[0].accept_local,
- "Accept our IPX address", 1,
- &ipxcp_allowoptions[0].accept_local },
-
- { "ipxcp-accept-remote", o_bool, &ipxcp_wantoptions[0].accept_remote,
- "Accept peer's IPX address", 1,
- &ipxcp_allowoptions[0].accept_remote },
-
- { "ipx-routing", o_int, &ipxcp_wantoptions[0].router,
- "Set IPX routing proto number", OPT_PRIO,
- &ipxcp_wantoptions[0].neg_router },
-
- { "ipx-router-name", o_special, setipxname,
- "Set IPX router name", OPT_PRIO | OPT_A2STRVAL | OPT_STATIC,
- &ipxcp_wantoptions[0].name },
-
- { "ipxcp-restart", o_int, &ipxcp_fsm[0].timeouttime,
- "Set timeout for IPXCP", OPT_PRIO },
- { "ipxcp-max-terminate", o_int, &ipxcp_fsm[0].maxtermtransmits,
- "Set max #xmits for IPXCP term-reqs", OPT_PRIO },
- { "ipxcp-max-configure", o_int, &ipxcp_fsm[0].maxconfreqtransmits,
- "Set max #xmits for IPXCP conf-reqs", OPT_PRIO },
- { "ipxcp-max-failure", o_int, &ipxcp_fsm[0].maxnakloops,
- "Set max #conf-naks for IPXCP", OPT_PRIO },
-
- { NULL }
-};
-
-/*
- * Protocol entry points.
- */
-
-static void ipxcp_init __P((int));
-static void ipxcp_open __P((int));
-static void ipxcp_close __P((int, char *));
-static void ipxcp_lowerup __P((int));
-static void ipxcp_lowerdown __P((int));
-static void ipxcp_input __P((int, u_char *, int));
-static void ipxcp_protrej __P((int));
-static int ipxcp_printpkt __P((u_char *, int,
- void (*) __P((void *, char *, ...)), void *));
-
-struct protent ipxcp_protent = {
- PPP_IPXCP,
- ipxcp_init,
- ipxcp_input,
- ipxcp_protrej,
- ipxcp_lowerup,
- ipxcp_lowerdown,
- ipxcp_open,
- ipxcp_close,
- ipxcp_printpkt,
- NULL,
- 0,
- "IPXCP",
- "IPX",
- ipxcp_option_list,
- NULL,
- NULL,
- NULL
-};
-
-/*
- * Lengths of configuration options.
- */
-
-#define CILEN_VOID 2
-#define CILEN_COMPLETE 2 /* length of complete option */
-#define CILEN_NETN 6 /* network number length option */
-#define CILEN_NODEN 8 /* node number length option */
-#define CILEN_PROTOCOL 4 /* Minimum length of routing protocol */
-#define CILEN_NAME 3 /* Minimum length of router name */
-#define CILEN_COMPRESS 4 /* Minimum length of compression protocol */
-
-#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
- (x) == CONFNAK ? "NAK" : "REJ")
-
-static int ipxcp_is_up;
-
-static char *ipx_ntoa __P((u_int32_t));
-
-/* Used in printing the node number */
-#define NODE(base) base[0], base[1], base[2], base[3], base[4], base[5]
-
-/* Used to generate the proper bit mask */
-#define BIT(num) (1 << (num))
-
-/*
- * Convert from internal to external notation
- */
-
-static short int
-to_external(internal)
-short int internal;
-{
- short int external;
-
- if (internal & BIT(IPX_NONE) )
- external = IPX_NONE;
- else
- external = RIP_SAP;
-
- return external;
-}
-
-/*
- * Make a string representation of a network IP address.
- */
-
-static char *
-ipx_ntoa(ipxaddr)
-u_int32_t ipxaddr;
-{
- static char b[64];
- slprintf(b, sizeof(b), "%x", ipxaddr);
- return b;
-}
-
-
-static u_char *
-setipxnodevalue(src,dst)
-u_char *src, *dst;
-{
- int indx;
- int item;
-
- for (;;) {
- if (!isxdigit (*src))
- break;
-
- for (indx = 0; indx < 5; ++indx) {
- dst[indx] <<= 4;
- dst[indx] |= (dst[indx + 1] >> 4) & 0x0F;
- }
-
- item = toupper (*src) - '0';
- if (item > 9)
- item -= 7;
-
- dst[5] = (dst[5] << 4) | item;
- ++src;
- }
- return src;
-}
-
-static int ipx_prio_our, ipx_prio_his;
-
-static int
-setipxnode(argv)
- char **argv;
-{
- char *end;
- int have_his = 0;
- u_char our_node[6];
- u_char his_node[6];
-
- memset (our_node, 0, 6);
- memset (his_node, 0, 6);
-
- end = setipxnodevalue (*argv, our_node);
- if (*end == ':') {
- have_his = 1;
- end = setipxnodevalue (++end, his_node);
- }
-
- if (*end == '\0') {
- ipxcp_wantoptions[0].neg_node = 1;
- if (option_priority >= ipx_prio_our) {
- memcpy(&ipxcp_wantoptions[0].our_node[0], our_node, 6);
- ipx_prio_our = option_priority;
- }
- if (have_his && option_priority >= ipx_prio_his) {
- memcpy(&ipxcp_wantoptions[0].his_node[0], his_node, 6);
- ipx_prio_his = option_priority;
- }
- return 1;
- }
-
- option_error("invalid parameter '%s' for ipx-node option", *argv);
- return 0;
-}
-
-static void
-printipxnode(opt, printer, arg)
- option_t *opt;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- unsigned char *p;
-
- p = ipxcp_wantoptions[0].our_node;
- if (ipx_prio_our)
- printer(arg, "%.2x%.2x%.2x%.2x%.2x%.2x",
- p[0], p[1], p[2], p[3], p[4], p[5]);
- printer(arg, ":");
- p = ipxcp_wantoptions[0].his_node;
- if (ipx_prio_his)
- printer(arg, "%.2x%.2x%.2x%.2x%.2x%.2x",
- p[0], p[1], p[2], p[3], p[4], p[5]);
-}
-
-static int
-setipxname (argv)
- char **argv;
-{
- char *dest = ipxcp_wantoptions[0].name;
- char *src = *argv;
- int count;
- char ch;
-
- ipxcp_wantoptions[0].neg_name = 1;
- ipxcp_allowoptions[0].neg_name = 1;
- memset (dest, '\0', sizeof (ipxcp_wantoptions[0].name));
-
- count = 0;
- while (*src) {
- ch = *src++;
- if (! isalnum (ch) && ch != '_') {
- option_error("IPX router name must be alphanumeric or _");
- return 0;
- }
-
- if (count >= sizeof (ipxcp_wantoptions[0].name) - 1) {
- option_error("IPX router name is limited to %d characters",
- sizeof (ipxcp_wantoptions[0].name) - 1);
- return 0;
- }
-
- dest[count++] = toupper (ch);
- }
- dest[count] = 0;
-
- return 1;
-}
-
-/*
- * ipxcp_init - Initialize IPXCP.
- */
-static void
-ipxcp_init(unit)
- int unit;
-{
- fsm *f = &ipxcp_fsm[unit];
-
- f->unit = unit;
- f->protocol = PPP_IPXCP;
- f->callbacks = &ipxcp_callbacks;
- fsm_init(&ipxcp_fsm[unit]);
-
- memset (wo->name, 0, sizeof (wo->name));
- memset (wo->our_node, 0, sizeof (wo->our_node));
- memset (wo->his_node, 0, sizeof (wo->his_node));
-
- wo->neg_nn = 1;
- wo->neg_complete = 1;
- wo->network = 0;
-
- ao->neg_node = 1;
- ao->neg_nn = 1;
- ao->neg_name = 1;
- ao->neg_complete = 1;
- ao->neg_router = 1;
-
- ao->accept_local = 0;
- ao->accept_remote = 0;
- ao->accept_network = 0;
-
- wo->tried_rip = 0;
- wo->tried_nlsp = 0;
-}
-
-/*
- * Copy the node number
- */
-
-static void
-copy_node (src, dst)
-u_char *src, *dst;
-{
- memcpy (dst, src, sizeof (ipxcp_wantoptions[0].our_node));
-}
-
-/*
- * Compare node numbers
- */
-
-static int
-compare_node (src, dst)
-u_char *src, *dst;
-{
- return memcmp (dst, src, sizeof (ipxcp_wantoptions[0].our_node)) == 0;
-}
-
-/*
- * Is the node number zero?
- */
-
-static int
-zero_node (node)
-u_char *node;
-{
- int indx;
- for (indx = 0; indx < sizeof (ipxcp_wantoptions[0].our_node); ++indx)
- if (node [indx] != 0)
- return 0;
- return 1;
-}
-
-/*
- * Increment the node number
- */
-
-static void
-inc_node (node)
-u_char *node;
-{
- u_char *outp;
- u_int32_t magic_num;
-
- outp = node;
- magic_num = magic();
- *outp++ = '\0';
- *outp++ = '\0';
- PUTLONG (magic_num, outp);
-}
-
-/*
- * ipxcp_open - IPXCP is allowed to come up.
- */
-static void
-ipxcp_open(unit)
- int unit;
-{
- fsm_open(&ipxcp_fsm[unit]);
-}
-
-/*
- * ipxcp_close - Take IPXCP down.
- */
-static void
-ipxcp_close(unit, reason)
- int unit;
- char *reason;
-{
- fsm_close(&ipxcp_fsm[unit], reason);
-}
-
-
-/*
- * ipxcp_lowerup - The lower layer is up.
- */
-static void
-ipxcp_lowerup(unit)
- int unit;
-{
- fsm_lowerup(&ipxcp_fsm[unit]);
-}
-
-
-/*
- * ipxcp_lowerdown - The lower layer is down.
- */
-static void
-ipxcp_lowerdown(unit)
- int unit;
-{
- fsm_lowerdown(&ipxcp_fsm[unit]);
-}
-
-
-/*
- * ipxcp_input - Input IPXCP packet.
- */
-static void
-ipxcp_input(unit, p, len)
- int unit;
- u_char *p;
- int len;
-{
- fsm_input(&ipxcp_fsm[unit], p, len);
-}
-
-
-/*
- * ipxcp_protrej - A Protocol-Reject was received for IPXCP.
- *
- * Pretend the lower layer went down, so we shut up.
- */
-static void
-ipxcp_protrej(unit)
- int unit;
-{
- fsm_lowerdown(&ipxcp_fsm[unit]);
-}
-
-
-/*
- * ipxcp_resetci - Reset our CI.
- */
-static void
-ipxcp_resetci(f)
- fsm *f;
-{
- wo->req_node = wo->neg_node && ao->neg_node;
- wo->req_nn = wo->neg_nn && ao->neg_nn;
-
- if (wo->our_network == 0) {
- wo->neg_node = 1;
- ao->accept_network = 1;
- }
-/*
- * If our node number is zero then change it.
- */
- if (zero_node (wo->our_node)) {
- inc_node (wo->our_node);
- ao->accept_local = 1;
- wo->neg_node = 1;
- }
-/*
- * If his node number is zero then change it.
- */
- if (zero_node (wo->his_node)) {
- inc_node (wo->his_node);
- ao->accept_remote = 1;
- }
-/*
- * If no routing agent was specified then we do RIP/SAP according to the
- * RFC documents. If you have specified something then OK. Otherwise, we
- * do RIP/SAP.
- */
- if (ao->router == 0) {
- ao->router |= BIT(RIP_SAP);
- wo->router |= BIT(RIP_SAP);
- }
-
- /* Always specify a routing protocol unless it was REJected. */
- wo->neg_router = 1;
-/*
- * Start with these default values
- */
- *go = *wo;
-}
-
-/*
- * ipxcp_cilen - Return length of our CI.
- */
-
-static int
-ipxcp_cilen(f)
- fsm *f;
-{
- int len;
-
- len = go->neg_nn ? CILEN_NETN : 0;
- len += go->neg_node ? CILEN_NODEN : 0;
- len += go->neg_name ? CILEN_NAME + strlen (go->name) - 1 : 0;
-
- /* RFC says that defaults should not be included. */
- if (go->neg_router && to_external(go->router) != RIP_SAP)
- len += CILEN_PROTOCOL;
-
- return (len);
-}
-
-
-/*
- * ipxcp_addci - Add our desired CIs to a packet.
- */
-static void
-ipxcp_addci(f, ucp, lenp)
- fsm *f;
- u_char *ucp;
- int *lenp;
-{
-/*
- * Add the options to the record.
- */
- if (go->neg_nn) {
- PUTCHAR (IPX_NETWORK_NUMBER, ucp);
- PUTCHAR (CILEN_NETN, ucp);
- PUTLONG (go->our_network, ucp);
- }
-
- if (go->neg_node) {
- int indx;
- PUTCHAR (IPX_NODE_NUMBER, ucp);
- PUTCHAR (CILEN_NODEN, ucp);
- for (indx = 0; indx < sizeof (go->our_node); ++indx)
- PUTCHAR (go->our_node[indx], ucp);
- }
-
- if (go->neg_name) {
- int cilen = strlen (go->name);
- int indx;
- PUTCHAR (IPX_ROUTER_NAME, ucp);
- PUTCHAR (CILEN_NAME + cilen - 1, ucp);
- for (indx = 0; indx < cilen; ++indx)
- PUTCHAR (go->name [indx], ucp);
- }
-
- if (go->neg_router) {
- short external = to_external (go->router);
- if (external != RIP_SAP) {
- PUTCHAR (IPX_ROUTER_PROTOCOL, ucp);
- PUTCHAR (CILEN_PROTOCOL, ucp);
- PUTSHORT (external, ucp);
- }
- }
-}
-
-/*
- * ipxcp_ackci - Ack our CIs.
- *
- * Returns:
- * 0 - Ack was bad.
- * 1 - Ack was good.
- */
-static int
-ipxcp_ackci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- u_short cilen, citype, cishort;
- u_char cichar;
- u_int32_t cilong;
-
-#define ACKCIVOID(opt, neg) \
- if (neg) { \
- if ((len -= CILEN_VOID) < 0) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_VOID || \
- citype != opt) \
- break; \
- }
-
-#define ACKCICOMPLETE(opt,neg) ACKCIVOID(opt, neg)
-
-#define ACKCICHARS(opt, neg, val, cnt) \
- if (neg) { \
- int indx, count = cnt; \
- len -= (count + 2); \
- if (len < 0) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != (count + 2) || \
- citype != opt) \
- break; \
- for (indx = 0; indx < count; ++indx) {\
- GETCHAR(cichar, p); \
- if (cichar != ((u_char *) &val)[indx]) \
- break; \
- }\
- if (indx != count) \
- break; \
- }
-
-#define ACKCINODE(opt,neg,val) ACKCICHARS(opt,neg,val,sizeof(val))
-#define ACKCINAME(opt,neg,val) ACKCICHARS(opt,neg,val,strlen(val))
-
-#define ACKCINETWORK(opt, neg, val) \
- if (neg) { \
- if ((len -= CILEN_NETN) < 0) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_NETN || \
- citype != opt) \
- break; \
- GETLONG(cilong, p); \
- if (cilong != val) \
- break; \
- }
-
-#define ACKCIPROTO(opt, neg, val) \
- if (neg) { \
- if (len < 2) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_PROTOCOL || citype != opt) \
- break; \
- len -= cilen; \
- if (len < 0) \
- break; \
- GETSHORT(cishort, p); \
- if (cishort != to_external (val) || cishort == RIP_SAP) \
- break; \
- }
-/*
- * Process the ACK frame in the order in which the frame was assembled
- */
- do {
- ACKCINETWORK (IPX_NETWORK_NUMBER, go->neg_nn, go->our_network);
- ACKCINODE (IPX_NODE_NUMBER, go->neg_node, go->our_node);
- ACKCINAME (IPX_ROUTER_NAME, go->neg_name, go->name);
- if (len > 0)
- ACKCIPROTO (IPX_ROUTER_PROTOCOL, go->neg_router, go->router);
-/*
- * This is the end of the record.
- */
- if (len == 0)
- return (1);
- } while (0);
-/*
- * The frame is invalid
- */
- IPXCPDEBUG(("ipxcp_ackci: received bad Ack!"));
- return (0);
-}
-
-/*
- * ipxcp_nakci - Peer has sent a NAK for some of our CIs.
- * This should not modify any state if the Nak is bad
- * or if IPXCP is in the OPENED state.
- *
- * Returns:
- * 0 - Nak was bad.
- * 1 - Nak was good.
- */
-
-static int
-ipxcp_nakci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- u_char citype, cilen, *next;
- u_short s;
- u_int32_t l;
- ipxcp_options no; /* options we've seen Naks for */
- ipxcp_options try; /* options to request next time */
-
- BZERO(&no, sizeof(no));
- try = *go;
-
- while (len > CILEN_VOID) {
- GETCHAR (citype, p);
- GETCHAR (cilen, p);
- len -= cilen;
- if (len < 0)
- goto bad;
- next = &p [cilen - CILEN_VOID];
-
- switch (citype) {
- case IPX_NETWORK_NUMBER:
- if (!go->neg_nn || no.neg_nn || (cilen != CILEN_NETN))
- goto bad;
- no.neg_nn = 1;
-
- GETLONG(l, p);
- if (l && ao->accept_network)
- try.our_network = l;
- break;
-
- case IPX_NODE_NUMBER:
- if (!go->neg_node || no.neg_node || (cilen != CILEN_NODEN))
- goto bad;
- no.neg_node = 1;
-
- if (!zero_node (p) && ao->accept_local &&
- ! compare_node (p, ho->his_node))
- copy_node (p, try.our_node);
- break;
-
- /* This has never been sent. Ignore the NAK frame */
- case IPX_COMPRESSION_PROTOCOL:
- goto bad;
-
- case IPX_ROUTER_PROTOCOL:
- if (!go->neg_router || (cilen < CILEN_PROTOCOL))
- goto bad;
-
- GETSHORT (s, p);
- if (s > 15) /* This is just bad, but ignore for now. */
- break;
-
- s = BIT(s);
- if (no.router & s) /* duplicate NAKs are always bad */
- goto bad;
-
- if (no.router == 0) /* Reset on first NAK only */
- try.router = 0;
-
- no.router |= s;
- try.router |= s;
- try.neg_router = 1;
- break;
-
- /* These, according to the RFC, must never be NAKed. */
- case IPX_ROUTER_NAME:
- case IPX_COMPLETE:
- goto bad;
-
- /* These are for options which we have not seen. */
- default:
- break;
- }
- p = next;
- }
-
- /*
- * Do not permit the peer to force a router protocol which we do not
- * support. However, default to the condition that will accept "NONE".
- */
- try.router &= (ao->router | BIT(IPX_NONE));
- if (try.router == 0 && ao->router != 0)
- try.router = BIT(IPX_NONE);
-
- if (try.router != 0)
- try.neg_router = 1;
-
- /*
- * OK, the Nak is good. Now we can update state.
- * If there are any options left, we ignore them.
- */
- if (f->state != OPENED)
- *go = try;
-
- return 1;
-
-bad:
- IPXCPDEBUG(("ipxcp_nakci: received bad Nak!"));
- return 0;
-}
-
-/*
- * ipxcp_rejci - Reject some of our CIs.
- */
-static int
-ipxcp_rejci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- u_short cilen, citype, cishort;
- u_char cichar;
- u_int32_t cilong;
- ipxcp_options try; /* options to request next time */
-
-#define REJCINETWORK(opt, neg, val) \
- if (neg && p[0] == opt) { \
- if ((len -= CILEN_NETN) < 0) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_NETN || \
- citype != opt) \
- break; \
- GETLONG(cilong, p); \
- if (cilong != val) \
- break; \
- neg = 0; \
- }
-
-#define REJCICHARS(opt, neg, val, cnt) \
- if (neg && p[0] == opt) { \
- int indx, count = cnt; \
- len -= (count + 2); \
- if (len < 0) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != (count + 2) || \
- citype != opt) \
- break; \
- for (indx = 0; indx < count; ++indx) {\
- GETCHAR(cichar, p); \
- if (cichar != ((u_char *) &val)[indx]) \
- break; \
- }\
- if (indx != count) \
- break; \
- neg = 0; \
- }
-
-#define REJCINODE(opt,neg,val) REJCICHARS(opt,neg,val,sizeof(val))
-#define REJCINAME(opt,neg,val) REJCICHARS(opt,neg,val,strlen(val))
-
-#define REJCIVOID(opt, neg) \
- if (neg && p[0] == opt) { \
- if ((len -= CILEN_VOID) < 0) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_VOID || citype != opt) \
- break; \
- neg = 0; \
- }
-
-/* a reject for RIP/SAP is invalid since we don't send it and you can't
- reject something which is not sent. (You can NAK, but you can't REJ.) */
-#define REJCIPROTO(opt, neg, val, bit) \
- if (neg && p[0] == opt) { \
- if ((len -= CILEN_PROTOCOL) < 0) \
- break; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_PROTOCOL) \
- break; \
- GETSHORT(cishort, p); \
- if (cishort != to_external (val) || cishort == RIP_SAP) \
- break; \
- neg = 0; \
- }
-/*
- * Any Rejected CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
- try = *go;
-
- do {
- REJCINETWORK (IPX_NETWORK_NUMBER, try.neg_nn, try.our_network);
- REJCINODE (IPX_NODE_NUMBER, try.neg_node, try.our_node);
- REJCINAME (IPX_ROUTER_NAME, try.neg_name, try.name);
- REJCIPROTO (IPX_ROUTER_PROTOCOL, try.neg_router, try.router, 0);
-/*
- * This is the end of the record.
- */
- if (len == 0) {
- if (f->state != OPENED)
- *go = try;
- return (1);
- }
- } while (0);
-/*
- * The frame is invalid at this point.
- */
- IPXCPDEBUG(("ipxcp_rejci: received bad Reject!"));
- return 0;
-}
-
-/*
- * ipxcp_reqci - Check the peer's requested CIs and send appropriate response.
- *
- * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified
- * appropriately. If reject_if_disagree is non-zero, doesn't return
- * CONFNAK; returns CONFREJ if it can't return CONFACK.
- */
-static int
-ipxcp_reqci(f, inp, len, reject_if_disagree)
- fsm *f;
- u_char *inp; /* Requested CIs */
- int *len; /* Length of requested CIs */
- int reject_if_disagree;
-{
- u_char *cip, *next; /* Pointer to current and next CIs */
- u_short cilen, citype; /* Parsed len, type */
- u_short cishort; /* Parsed short value */
- u_int32_t cinetwork; /* Parsed address values */
- int rc = CONFACK; /* Final packet return code */
- int orc; /* Individual option return code */
- u_char *p; /* Pointer to next char to parse */
- u_char *ucp = inp; /* Pointer to current output char */
- int l = *len; /* Length left */
-
- /*
- * Reset all his options.
- */
- BZERO(ho, sizeof(*ho));
-
- /*
- * Process all his options.
- */
- next = inp;
- while (l) {
- orc = CONFACK; /* Assume success */
- cip = p = next; /* Remember begining of CI */
- if (l < 2 || /* Not enough data for CI header or */
- p[1] < 2 || /* CI length too small or */
- p[1] > l) { /* CI length too big? */
- IPXCPDEBUG(("ipxcp_reqci: bad CI length!"));
- orc = CONFREJ; /* Reject bad CI */
- cilen = l; /* Reject till end of packet */
- l = 0; /* Don't loop again */
- goto endswitch;
- }
- GETCHAR(citype, p); /* Parse CI type */
- GETCHAR(cilen, p); /* Parse CI length */
- l -= cilen; /* Adjust remaining length */
- next += cilen; /* Step to next CI */
-
- switch (citype) { /* Check CI type */
-/*
- * The network number must match. Choose the larger of the two.
- */
- case IPX_NETWORK_NUMBER:
- /* if we wont negotiate the network number or the length is wrong
- then reject the option */
- if ( !ao->neg_nn || cilen != CILEN_NETN ) {
- orc = CONFREJ;
- break;
- }
- GETLONG(cinetwork, p);
-
- /* If the network numbers match then acknowledge them. */
- if (cinetwork != 0) {
- ho->his_network = cinetwork;
- ho->neg_nn = 1;
- if (wo->our_network == cinetwork)
- break;
-/*
- * If the network number is not given or we don't accept their change or
- * the network number is too small then NAK it.
- */
- if (! ao->accept_network || cinetwork < wo->our_network) {
- DECPTR (sizeof (u_int32_t), p);
- PUTLONG (wo->our_network, p);
- orc = CONFNAK;
- }
- break;
- }
-/*
- * The peer sent '0' for the network. Give it ours if we have one.
- */
- if (go->our_network != 0) {
- DECPTR (sizeof (u_int32_t), p);
- PUTLONG (wo->our_network, p);
- orc = CONFNAK;
-/*
- * We don't have one. Reject the value.
- */
- } else
- orc = CONFREJ;
-
- break;
-/*
- * The node number is required
- */
- case IPX_NODE_NUMBER:
- /* if we wont negotiate the node number or the length is wrong
- then reject the option */
- if ( cilen != CILEN_NODEN ) {
- orc = CONFREJ;
- break;
- }
-
- copy_node (p, ho->his_node);
- ho->neg_node = 1;
-/*
- * If the remote does not have a number and we do then NAK it with the value
- * which we have for it. (We never have a default value of zero.)
- */
- if (zero_node (ho->his_node)) {
- orc = CONFNAK;
- copy_node (wo->his_node, p);
- INCPTR (sizeof (wo->his_node), p);
- break;
- }
-/*
- * If you have given me the expected network node number then I'll accept
- * it now.
- */
- if (compare_node (wo->his_node, ho->his_node)) {
- orc = CONFACK;
- ho->neg_node = 1;
- INCPTR (sizeof (wo->his_node), p);
- break;
- }
-/*
- * If his node number is the same as ours then ask him to try the next
- * value.
- */
- if (compare_node (ho->his_node, go->our_node)) {
- inc_node (ho->his_node);
- orc = CONFNAK;
- copy_node (ho->his_node, p);
- INCPTR (sizeof (wo->his_node), p);
- break;
- }
-/*
- * If we don't accept a new value then NAK it.
- */
- if (! ao->accept_remote) {
- copy_node (wo->his_node, p);
- INCPTR (sizeof (wo->his_node), p);
- orc = CONFNAK;
- break;
- }
- orc = CONFACK;
- ho->neg_node = 1;
- INCPTR (sizeof (wo->his_node), p);
- break;
-/*
- * Compression is not desired at this time. It is always rejected.
- */
- case IPX_COMPRESSION_PROTOCOL:
- orc = CONFREJ;
- break;
-/*
- * The routing protocol is a bitmask of various types. Any combination
- * of the values RIP_SAP and NLSP are permissible. 'IPX_NONE' for no
- * routing protocol must be specified only once.
- */
- case IPX_ROUTER_PROTOCOL:
- if ( !ao->neg_router || cilen < CILEN_PROTOCOL ) {
- orc = CONFREJ;
- break;
- }
-
- GETSHORT (cishort, p);
-
- if (wo->neg_router == 0) {
- wo->neg_router = 1;
- wo->router = BIT(IPX_NONE);
- }
-
- if ((cishort == IPX_NONE && ho->router != 0) ||
- (ho->router & BIT(IPX_NONE))) {
- orc = CONFREJ;
- break;
- }
-
- cishort = BIT(cishort);
- if (ho->router & cishort) {
- orc = CONFREJ;
- break;
- }
-
- ho->router |= cishort;
- ho->neg_router = 1;
-
- /* Finally do not allow a router protocol which we do not
- support. */
-
- if ((cishort & (ao->router | BIT(IPX_NONE))) == 0) {
- int protocol;
-
- if (cishort == BIT(NLSP) &&
- (ao->router & BIT(RIP_SAP)) &&
- !wo->tried_rip) {
- protocol = RIP_SAP;
- wo->tried_rip = 1;
- } else
- protocol = IPX_NONE;
-
- DECPTR (sizeof (u_int16_t), p);
- PUTSHORT (protocol, p);
- orc = CONFNAK;
- }
- break;
-/*
- * The router name is advisorary. Just accept it if it is not too large.
- */
- case IPX_ROUTER_NAME:
- if (cilen >= CILEN_NAME) {
- int name_size = cilen - CILEN_NAME;
- if (name_size > sizeof (ho->name))
- name_size = sizeof (ho->name) - 1;
- memset (ho->name, 0, sizeof (ho->name));
- memcpy (ho->name, p, name_size);
- ho->name [name_size] = '\0';
- ho->neg_name = 1;
- orc = CONFACK;
- break;
- }
- orc = CONFREJ;
- break;
-/*
- * This is advisorary.
- */
- case IPX_COMPLETE:
- if (cilen != CILEN_COMPLETE)
- orc = CONFREJ;
- else {
- ho->neg_complete = 1;
- orc = CONFACK;
- }
- break;
-/*
- * All other entries are not known at this time.
- */
- default:
- orc = CONFREJ;
- break;
- }
-endswitch:
- if (orc == CONFACK && /* Good CI */
- rc != CONFACK) /* but prior CI wasnt? */
- continue; /* Don't send this one */
-
- if (orc == CONFNAK) { /* Nak this CI? */
- if (reject_if_disagree) /* Getting fed up with sending NAKs? */
- orc = CONFREJ; /* Get tough if so */
- if (rc == CONFREJ) /* Rejecting prior CI? */
- continue; /* Don't send this one */
- if (rc == CONFACK) { /* Ack'd all prior CIs? */
- rc = CONFNAK; /* Not anymore... */
- ucp = inp; /* Backup */
- }
- }
-
- if (orc == CONFREJ && /* Reject this CI */
- rc != CONFREJ) { /* but no prior ones? */
- rc = CONFREJ;
- ucp = inp; /* Backup */
- }
-
- /* Need to move CI? */
- if (ucp != cip)
- BCOPY(cip, ucp, cilen); /* Move it */
-
- /* Update output pointer */
- INCPTR(cilen, ucp);
- }
-
- /*
- * If we aren't rejecting this packet, and we want to negotiate
- * their address, and they didn't send their address, then we
- * send a NAK with a IPX_NODE_NUMBER option appended. We assume the
- * input buffer is long enough that we can append the extra
- * option safely.
- */
-
- if (rc != CONFREJ && !ho->neg_node &&
- wo->req_nn && !reject_if_disagree) {
- if (rc == CONFACK) {
- rc = CONFNAK;
- wo->req_nn = 0; /* don't ask again */
- ucp = inp; /* reset pointer */
- }
-
- if (zero_node (wo->his_node))
- inc_node (wo->his_node);
-
- PUTCHAR (IPX_NODE_NUMBER, ucp);
- PUTCHAR (CILEN_NODEN, ucp);
- copy_node (wo->his_node, ucp);
- INCPTR (sizeof (wo->his_node), ucp);
- }
-
- *len = ucp - inp; /* Compute output length */
- IPXCPDEBUG(("ipxcp: returning Configure-%s", CODENAME(rc)));
- return (rc); /* Return final code */
-}
-
-/*
- * ipxcp_up - IPXCP has come UP.
- *
- * Configure the IP network interface appropriately and bring it up.
- */
-
-static void
-ipxcp_up(f)
- fsm *f;
-{
- int unit = f->unit;
-
- IPXCPDEBUG(("ipxcp: up"));
-
- /* The default router protocol is RIP/SAP. */
- if (ho->router == 0)
- ho->router = BIT(RIP_SAP);
-
- if (go->router == 0)
- go->router = BIT(RIP_SAP);
-
- /* Fetch the network number */
- if (!ho->neg_nn)
- ho->his_network = wo->his_network;
-
- if (!ho->neg_node)
- copy_node (wo->his_node, ho->his_node);
-
- if (!wo->neg_node && !go->neg_node)
- copy_node (wo->our_node, go->our_node);
-
- if (zero_node (go->our_node)) {
- static char errmsg[] = "Could not determine local IPX node address";
- if (debug)
- error(errmsg);
- ipxcp_close(f->unit, errmsg);
- return;
- }
-
- go->network = go->our_network;
- if (ho->his_network != 0 && ho->his_network > go->network)
- go->network = ho->his_network;
-
- if (go->network == 0) {
- static char errmsg[] = "Can not determine network number";
- if (debug)
- error(errmsg);
- ipxcp_close (unit, errmsg);
- return;
- }
-
- /* bring the interface up */
- if (!sifup(unit)) {
- if (debug)
- warn("sifup failed (IPX)");
- ipxcp_close(unit, "Interface configuration failed");
- return;
- }
- ipxcp_is_up = 1;
-
- /* set the network number for IPX */
- if (!sipxfaddr(unit, go->network, go->our_node)) {
- if (debug)
- warn("sipxfaddr failed");
- ipxcp_close(unit, "Interface configuration failed");
- return;
- }
-
- np_up(f->unit, PPP_IPX);
-
- /*
- * Execute the ipx-up script, like this:
- * /etc/ppp/ipx-up interface tty speed local-IPX remote-IPX
- */
-
- ipxcp_script (f, _PATH_IPXUP);
-}
-
-/*
- * ipxcp_down - IPXCP has gone DOWN.
- *
- * Take the IP network interface down, clear its addresses
- * and delete routes through it.
- */
-
-static void
-ipxcp_down(f)
- fsm *f;
-{
- IPXCPDEBUG(("ipxcp: down"));
-
- if (!ipxcp_is_up)
- return;
- ipxcp_is_up = 0;
- np_down(f->unit, PPP_IPX);
- cipxfaddr(f->unit);
- sifnpmode(f->unit, PPP_IPX, NPMODE_DROP);
- sifdown(f->unit);
- ipxcp_script (f, _PATH_IPXDOWN);
-}
-
-
-/*
- * ipxcp_finished - possibly shut down the lower layers.
- */
-static void
-ipxcp_finished(f)
- fsm *f;
-{
- np_finished(f->unit, PPP_IPX);
-}
-
-
-/*
- * ipxcp_script - Execute a script with arguments
- * interface-name tty-name speed local-IPX remote-IPX networks.
- */
-static void
-ipxcp_script(f, script)
- fsm *f;
- char *script;
-{
- char strspeed[32], strlocal[32], strremote[32];
- char strnetwork[32], strpid[32];
- char *argv[14], strproto_lcl[32], strproto_rmt[32];
-
- slprintf(strpid, sizeof(strpid), "%d", getpid());
- slprintf(strspeed, sizeof(strspeed),"%d", baud_rate);
-
- strproto_lcl[0] = '\0';
- if (go->neg_router && ((go->router & BIT(IPX_NONE)) == 0)) {
- if (go->router & BIT(RIP_SAP))
- strlcpy (strproto_lcl, "RIP ", sizeof(strproto_lcl));
- if (go->router & BIT(NLSP))
- strlcat (strproto_lcl, "NLSP ", sizeof(strproto_lcl));
- }
-
- if (strproto_lcl[0] == '\0')
- strlcpy (strproto_lcl, "NONE ", sizeof(strproto_lcl));
-
- strproto_lcl[strlen (strproto_lcl)-1] = '\0';
-
- strproto_rmt[0] = '\0';
- if (ho->neg_router && ((ho->router & BIT(IPX_NONE)) == 0)) {
- if (ho->router & BIT(RIP_SAP))
- strlcpy (strproto_rmt, "RIP ", sizeof(strproto_rmt));
- if (ho->router & BIT(NLSP))
- strlcat (strproto_rmt, "NLSP ", sizeof(strproto_rmt));
- }
-
- if (strproto_rmt[0] == '\0')
- strlcpy (strproto_rmt, "NONE ", sizeof(strproto_rmt));
-
- strproto_rmt[strlen (strproto_rmt)-1] = '\0';
-
- strlcpy (strnetwork, ipx_ntoa (go->network), sizeof(strnetwork));
-
- slprintf (strlocal, sizeof(strlocal), "%0.6B", go->our_node);
-
- slprintf (strremote, sizeof(strremote), "%0.6B", ho->his_node);
-
- argv[0] = script;
- argv[1] = ifname;
- argv[2] = devnam;
- argv[3] = strspeed;
- argv[4] = strnetwork;
- argv[5] = strlocal;
- argv[6] = strremote;
- argv[7] = strproto_lcl;
- argv[8] = strproto_rmt;
- argv[9] = go->name;
- argv[10] = ho->name;
- argv[11] = ipparam;
- argv[12] = strpid;
- argv[13] = NULL;
- run_program(script, argv, 0, NULL, NULL);
-}
-
-/*
- * ipxcp_printpkt - print the contents of an IPXCP packet.
- */
-static char *ipxcp_codenames[] = {
- "ConfReq", "ConfAck", "ConfNak", "ConfRej",
- "TermReq", "TermAck", "CodeRej"
-};
-
-static int
-ipxcp_printpkt(p, plen, printer, arg)
- u_char *p;
- int plen;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- int code, id, len, olen;
- u_char *pstart, *optend;
- u_short cishort;
- u_int32_t cilong;
-
- if (plen < HEADERLEN)
- return 0;
- pstart = p;
- GETCHAR(code, p);
- GETCHAR(id, p);
- GETSHORT(len, p);
- if (len < HEADERLEN || len > plen)
- return 0;
-
- if (code >= 1 && code <= sizeof(ipxcp_codenames) / sizeof(char *))
- printer(arg, " %s", ipxcp_codenames[code-1]);
- else
- printer(arg, " code=0x%x", code);
- printer(arg, " id=0x%x", id);
- len -= HEADERLEN;
- switch (code) {
- case CONFREQ:
- case CONFACK:
- case CONFNAK:
- case CONFREJ:
- /* print option list */
- while (len >= 2) {
- GETCHAR(code, p);
- GETCHAR(olen, p);
- p -= 2;
- if (olen < CILEN_VOID || olen > len) {
- break;
- }
- printer(arg, " <");
- len -= olen;
- optend = p + olen;
- switch (code) {
- case IPX_NETWORK_NUMBER:
- if (olen == CILEN_NETN) {
- p += 2;
- GETLONG(cilong, p);
- printer (arg, "network %s", ipx_ntoa (cilong));
- }
- break;
- case IPX_NODE_NUMBER:
- if (olen == CILEN_NODEN) {
- p += 2;
- printer (arg, "node ");
- while (p < optend) {
- GETCHAR(code, p);
- printer(arg, "%.2x", (int) (unsigned int) (unsigned char) code);
- }
- }
- break;
- case IPX_COMPRESSION_PROTOCOL:
- if (olen == CILEN_COMPRESS) {
- p += 2;
- GETSHORT (cishort, p);
- printer (arg, "compression %d", (int) cishort);
- }
- break;
- case IPX_ROUTER_PROTOCOL:
- if (olen == CILEN_PROTOCOL) {
- p += 2;
- GETSHORT (cishort, p);
- printer (arg, "router proto %d", (int) cishort);
- }
- break;
- case IPX_ROUTER_NAME:
- if (olen >= CILEN_NAME) {
- p += 2;
- printer (arg, "router name \"");
- while (p < optend) {
- GETCHAR(code, p);
- if (code >= 0x20 && code <= 0x7E)
- printer (arg, "%c", (int) (unsigned int) (unsigned char) code);
- else
- printer (arg, " \\%.2x", (int) (unsigned int) (unsigned char) code);
- }
- printer (arg, "\"");
- }
- break;
- case IPX_COMPLETE:
- if (olen == CILEN_COMPLETE) {
- p += 2;
- printer (arg, "complete");
- }
- break;
- default:
- break;
- }
-
- while (p < optend) {
- GETCHAR(code, p);
- printer(arg, " %.2x", (int) (unsigned int) (unsigned char) code);
- }
- printer(arg, ">");
- }
- break;
-
- case TERMACK:
- case TERMREQ:
- if (len > 0 && *p >= ' ' && *p < 0x7f) {
- printer(arg, " ");
- print_string(p, len, printer, arg);
- p += len;
- len = 0;
- }
- break;
- }
-
- /* print the rest of the bytes in the packet */
- for (; len > 0; --len) {
- GETCHAR(code, p);
- printer(arg, " %.2x", (int) (unsigned int) (unsigned char) code);
- }
-
- return p - pstart;
-}
-#endif /* ifdef IPX_CHANGE */
diff --git a/mdk-stage1/ppp/pppd/ipxcp.h b/mdk-stage1/ppp/pppd/ipxcp.h
deleted file mode 100644
index 47f680d70..000000000
--- a/mdk-stage1/ppp/pppd/ipxcp.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * ipxcp.h - IPX Control Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-/*
- * Options.
- */
-#define IPX_NETWORK_NUMBER 1 /* IPX Network Number */
-#define IPX_NODE_NUMBER 2
-#define IPX_COMPRESSION_PROTOCOL 3
-#define IPX_ROUTER_PROTOCOL 4
-#define IPX_ROUTER_NAME 5
-#define IPX_COMPLETE 6
-
-/* Values for the router protocol */
-#define IPX_NONE 0
-#define RIP_SAP 2
-#define NLSP 4
-
-typedef struct ipxcp_options {
- bool neg_node; /* Negotiate IPX node number? */
- bool req_node; /* Ask peer to send IPX node number? */
-
- bool neg_nn; /* Negotiate IPX network number? */
- bool req_nn; /* Ask peer to send IPX network number */
-
- bool neg_name; /* Negotiate IPX router name */
- bool neg_complete; /* Negotiate completion */
- bool neg_router; /* Negotiate IPX router number */
-
- bool accept_local; /* accept peer's value for ournode */
- bool accept_remote; /* accept peer's value for hisnode */
- bool accept_network; /* accept network number */
-
- bool tried_nlsp; /* I have suggested NLSP already */
- bool tried_rip; /* I have suggested RIP/SAP already */
-
- u_int32_t his_network; /* base network number */
- u_int32_t our_network; /* our value for network number */
- u_int32_t network; /* the final network number */
-
- u_char his_node[6]; /* peer's node number */
- u_char our_node[6]; /* our node number */
- u_char name [48]; /* name of the router */
- int router; /* routing protocol */
-} ipxcp_options;
-
-extern fsm ipxcp_fsm[];
-extern ipxcp_options ipxcp_wantoptions[];
-extern ipxcp_options ipxcp_gotoptions[];
-extern ipxcp_options ipxcp_allowoptions[];
-extern ipxcp_options ipxcp_hisoptions[];
-
-extern struct protent ipxcp_protent;
diff --git a/mdk-stage1/ppp/pppd/lcp.c b/mdk-stage1/ppp/pppd/lcp.c
deleted file mode 100644
index 41c58cad5..000000000
--- a/mdk-stage1/ppp/pppd/lcp.c
+++ /dev/null
@@ -1,2224 +0,0 @@
-/*
- * lcp.c - PPP Link Control Protocol.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-/*
- * TODO:
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "pppd.h"
-#include "fsm.h"
-#include "lcp.h"
-#include "chap.h"
-#include "magic.h"
-
-static const char rcsid[] = RCSID;
-
-/*
- * When the link comes up we want to be able to wait for a short while,
- * or until seeing some input from the peer, before starting to send
- * configure-requests. We do this by delaying the fsm_lowerup call.
- */
-/* steal a bit in fsm flags word */
-#define DELAYED_UP 0x100
-
-static void lcp_delayed_up __P((void *));
-
-/*
- * LCP-related command-line options.
- */
-int lcp_echo_interval = 0; /* Interval between LCP echo-requests */
-int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
-bool lax_recv = 0; /* accept control chars in asyncmap */
-bool noendpoint = 0; /* don't send/accept endpoint discriminator */
-
-static int noopt __P((char **));
-
-#ifdef HAVE_MULTILINK
-static int setendpoint __P((char **));
-static void printendpoint __P((option_t *, void (*)(void *, char *, ...),
- void *));
-#endif /* HAVE_MULTILINK */
-
-static option_t lcp_option_list[] = {
- /* LCP options */
- { "-all", o_special_noarg, (void *)noopt,
- "Don't request/allow any LCP options" },
-
- { "noaccomp", o_bool, &lcp_wantoptions[0].neg_accompression,
- "Disable address/control compression",
- OPT_A2CLR, &lcp_allowoptions[0].neg_accompression },
- { "-ac", o_bool, &lcp_wantoptions[0].neg_accompression,
- "Disable address/control compression",
- OPT_ALIAS | OPT_A2CLR, &lcp_allowoptions[0].neg_accompression },
-
- { "asyncmap", o_uint32, &lcp_wantoptions[0].asyncmap,
- "Set asyncmap (for received packets)",
- OPT_OR, &lcp_wantoptions[0].neg_asyncmap },
- { "-as", o_uint32, &lcp_wantoptions[0].asyncmap,
- "Set asyncmap (for received packets)",
- OPT_ALIAS | OPT_OR, &lcp_wantoptions[0].neg_asyncmap },
- { "default-asyncmap", o_uint32, &lcp_wantoptions[0].asyncmap,
- "Disable asyncmap negotiation",
- OPT_OR | OPT_NOARG | OPT_VAL(~0U) | OPT_A2CLR,
- &lcp_allowoptions[0].neg_asyncmap },
- { "-am", o_uint32, &lcp_wantoptions[0].asyncmap,
- "Disable asyncmap negotiation",
- OPT_ALIAS | OPT_OR | OPT_NOARG | OPT_VAL(~0U) | OPT_A2CLR,
- &lcp_allowoptions[0].neg_asyncmap },
-
- { "nomagic", o_bool, &lcp_wantoptions[0].neg_magicnumber,
- "Disable magic number negotiation (looped-back line detection)",
- OPT_A2CLR, &lcp_allowoptions[0].neg_magicnumber },
- { "-mn", o_bool, &lcp_wantoptions[0].neg_magicnumber,
- "Disable magic number negotiation (looped-back line detection)",
- OPT_ALIAS | OPT_A2CLR, &lcp_allowoptions[0].neg_magicnumber },
-
- { "mru", o_int, &lcp_wantoptions[0].mru,
- "Set MRU (maximum received packet size) for negotiation",
- OPT_PRIO, &lcp_wantoptions[0].neg_mru },
- { "default-mru", o_bool, &lcp_wantoptions[0].neg_mru,
- "Disable MRU negotiation (use default 1500)",
- OPT_PRIOSUB | OPT_A2CLR, &lcp_allowoptions[0].neg_mru },
- { "-mru", o_bool, &lcp_wantoptions[0].neg_mru,
- "Disable MRU negotiation (use default 1500)",
- OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, &lcp_allowoptions[0].neg_mru },
-
- { "mtu", o_int, &lcp_allowoptions[0].mru,
- "Set our MTU", OPT_LIMITS, NULL, MAXMRU, MINMRU },
-
- { "nopcomp", o_bool, &lcp_wantoptions[0].neg_pcompression,
- "Disable protocol field compression",
- OPT_A2CLR, &lcp_allowoptions[0].neg_pcompression },
- { "-pc", o_bool, &lcp_wantoptions[0].neg_pcompression,
- "Disable protocol field compression",
- OPT_ALIAS | OPT_A2CLR, &lcp_allowoptions[0].neg_pcompression },
-
- { "passive", o_bool, &lcp_wantoptions[0].passive,
- "Set passive mode", 1 },
- { "-p", o_bool, &lcp_wantoptions[0].passive,
- "Set passive mode", OPT_ALIAS | 1 },
-
- { "silent", o_bool, &lcp_wantoptions[0].silent,
- "Set silent mode", 1 },
-
- { "lcp-echo-failure", o_int, &lcp_echo_fails,
- "Set number of consecutive echo failures to indicate link failure",
- OPT_PRIO },
- { "lcp-echo-interval", o_int, &lcp_echo_interval,
- "Set time in seconds between LCP echo requests", OPT_PRIO },
- { "lcp-restart", o_int, &lcp_fsm[0].timeouttime,
- "Set time in seconds between LCP retransmissions", OPT_PRIO },
- { "lcp-max-terminate", o_int, &lcp_fsm[0].maxtermtransmits,
- "Set maximum number of LCP terminate-request transmissions", OPT_PRIO },
- { "lcp-max-configure", o_int, &lcp_fsm[0].maxconfreqtransmits,
- "Set maximum number of LCP configure-request transmissions", OPT_PRIO },
- { "lcp-max-failure", o_int, &lcp_fsm[0].maxnakloops,
- "Set limit on number of LCP configure-naks", OPT_PRIO },
-
- { "receive-all", o_bool, &lax_recv,
- "Accept all received control characters", 1 },
-
-#ifdef HAVE_MULTILINK
- { "mrru", o_int, &lcp_wantoptions[0].mrru,
- "Maximum received packet size for multilink bundle",
- OPT_PRIO, &lcp_wantoptions[0].neg_mrru },
-
- { "mpshortseq", o_bool, &lcp_wantoptions[0].neg_ssnhf,
- "Use short sequence numbers in multilink headers",
- OPT_PRIO | 1, &lcp_allowoptions[0].neg_ssnhf },
- { "nompshortseq", o_bool, &lcp_wantoptions[0].neg_ssnhf,
- "Don't use short sequence numbers in multilink headers",
- OPT_PRIOSUB | OPT_A2CLR, &lcp_allowoptions[0].neg_ssnhf },
-
- { "endpoint", o_special, (void *) setendpoint,
- "Endpoint discriminator for multilink",
- OPT_PRIO | OPT_A2PRINTER, (void *) printendpoint },
-#endif /* HAVE_MULTILINK */
-
- { "noendpoint", o_bool, &noendpoint,
- "Don't send or accept multilink endpoint discriminator", 1 },
-
- {NULL}
-};
-
-/* global vars */
-fsm lcp_fsm[NUM_PPP]; /* LCP fsm structure (global)*/
-lcp_options lcp_wantoptions[NUM_PPP]; /* Options that we want to request */
-lcp_options lcp_gotoptions[NUM_PPP]; /* Options that peer ack'd */
-lcp_options lcp_allowoptions[NUM_PPP]; /* Options we allow peer to request */
-lcp_options lcp_hisoptions[NUM_PPP]; /* Options that we ack'd */
-
-static int lcp_echos_pending = 0; /* Number of outstanding echo msgs */
-static int lcp_echo_number = 0; /* ID number of next echo frame */
-static int lcp_echo_timer_running = 0; /* set if a timer is running */
-
-static u_char nak_buffer[PPP_MRU]; /* where we construct a nak packet */
-
-/*
- * Callbacks for fsm code. (CI = Configuration Information)
- */
-static void lcp_resetci __P((fsm *)); /* Reset our CI */
-static int lcp_cilen __P((fsm *)); /* Return length of our CI */
-static void lcp_addci __P((fsm *, u_char *, int *)); /* Add our CI to pkt */
-static int lcp_ackci __P((fsm *, u_char *, int)); /* Peer ack'd our CI */
-static int lcp_nakci __P((fsm *, u_char *, int)); /* Peer nak'd our CI */
-static int lcp_rejci __P((fsm *, u_char *, int)); /* Peer rej'd our CI */
-static int lcp_reqci __P((fsm *, u_char *, int *, int)); /* Rcv peer CI */
-static void lcp_up __P((fsm *)); /* We're UP */
-static void lcp_down __P((fsm *)); /* We're DOWN */
-static void lcp_starting __P((fsm *)); /* We need lower layer up */
-static void lcp_finished __P((fsm *)); /* We need lower layer down */
-static int lcp_extcode __P((fsm *, int, int, u_char *, int));
-static void lcp_rprotrej __P((fsm *, u_char *, int));
-
-/*
- * routines to send LCP echos to peer
- */
-
-static void lcp_echo_lowerup __P((int));
-static void lcp_echo_lowerdown __P((int));
-static void LcpEchoTimeout __P((void *));
-static void lcp_received_echo_reply __P((fsm *, int, u_char *, int));
-static void LcpSendEchoRequest __P((fsm *));
-static void LcpLinkFailure __P((fsm *));
-static void LcpEchoCheck __P((fsm *));
-
-static fsm_callbacks lcp_callbacks = { /* LCP callback routines */
- lcp_resetci, /* Reset our Configuration Information */
- lcp_cilen, /* Length of our Configuration Information */
- lcp_addci, /* Add our Configuration Information */
- lcp_ackci, /* ACK our Configuration Information */
- lcp_nakci, /* NAK our Configuration Information */
- lcp_rejci, /* Reject our Configuration Information */
- lcp_reqci, /* Request peer's Configuration Information */
- lcp_up, /* Called when fsm reaches OPENED state */
- lcp_down, /* Called when fsm leaves OPENED state */
- lcp_starting, /* Called when we want the lower layer up */
- lcp_finished, /* Called when we want the lower layer down */
- NULL, /* Called when Protocol-Reject received */
- NULL, /* Retransmission is necessary */
- lcp_extcode, /* Called to handle LCP-specific codes */
- "LCP" /* String name of protocol */
-};
-
-/*
- * Protocol entry points.
- * Some of these are called directly.
- */
-
-static void lcp_init __P((int));
-static void lcp_input __P((int, u_char *, int));
-static void lcp_protrej __P((int));
-static int lcp_printpkt __P((u_char *, int,
- void (*) __P((void *, char *, ...)), void *));
-
-struct protent lcp_protent = {
- PPP_LCP,
- lcp_init,
- lcp_input,
- lcp_protrej,
- lcp_lowerup,
- lcp_lowerdown,
- lcp_open,
- lcp_close,
- lcp_printpkt,
- NULL,
- 1,
- "LCP",
- NULL,
- lcp_option_list,
- NULL,
- NULL,
- NULL
-};
-
-int lcp_loopbackfail = DEFLOOPBACKFAIL;
-
-/*
- * Length of each type of configuration option (in octets)
- */
-#define CILEN_VOID 2
-#define CILEN_CHAR 3
-#define CILEN_SHORT 4 /* CILEN_VOID + 2 */
-#define CILEN_CHAP 5 /* CILEN_VOID + 2 + 1 */
-#define CILEN_LONG 6 /* CILEN_VOID + 4 */
-#define CILEN_LQR 8 /* CILEN_VOID + 2 + 4 */
-#define CILEN_CBCP 3
-
-#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
- (x) == CONFNAK ? "NAK" : "REJ")
-
-/*
- * noopt - Disable all options (why?).
- */
-static int
-noopt(argv)
- char **argv;
-{
- BZERO((char *) &lcp_wantoptions[0], sizeof (struct lcp_options));
- BZERO((char *) &lcp_allowoptions[0], sizeof (struct lcp_options));
-
- return (1);
-}
-
-#ifdef HAVE_MULTILINK
-static int
-setendpoint(argv)
- char **argv;
-{
- if (str_to_epdisc(&lcp_wantoptions[0].endpoint, *argv)) {
- lcp_wantoptions[0].neg_endpoint = 1;
- return 1;
- }
- option_error("Can't parse '%s' as an endpoint discriminator", *argv);
- return 0;
-}
-
-static void
-printendpoint(opt, printer, arg)
- option_t *opt;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- printer(arg, "%s", epdisc_to_str(&lcp_wantoptions[0].endpoint));
-}
-#endif /* HAVE_MULTILINK */
-
-/*
- * lcp_init - Initialize LCP.
- */
-static void
-lcp_init(unit)
- int unit;
-{
- fsm *f = &lcp_fsm[unit];
- lcp_options *wo = &lcp_wantoptions[unit];
- lcp_options *ao = &lcp_allowoptions[unit];
-
- f->unit = unit;
- f->protocol = PPP_LCP;
- f->callbacks = &lcp_callbacks;
-
- fsm_init(f);
-
- BZERO(wo, sizeof(*wo));
- wo->neg_mru = 1;
- wo->mru = DEFMRU;
- wo->neg_asyncmap = 1;
- wo->chap_mdtype = CHAP_DIGEST_MD5;
- wo->neg_magicnumber = 1;
- wo->neg_pcompression = 1;
- wo->neg_accompression = 1;
-
- BZERO(ao, sizeof(*ao));
- ao->neg_mru = 1;
- ao->mru = MAXMRU;
- ao->neg_asyncmap = 1;
- ao->neg_chap = 1;
- ao->chap_mdtype = CHAP_DIGEST_MD5;
- ao->neg_upap = 1;
- ao->neg_magicnumber = 1;
- ao->neg_pcompression = 1;
- ao->neg_accompression = 1;
-#ifdef CBCP_SUPPORT
- ao->neg_cbcp = 1;
-#endif
- ao->neg_endpoint = 1;
-}
-
-
-/*
- * lcp_open - LCP is allowed to come up.
- */
-void
-lcp_open(unit)
- int unit;
-{
- fsm *f = &lcp_fsm[unit];
- lcp_options *wo = &lcp_wantoptions[unit];
-
- f->flags &= ~(OPT_PASSIVE | OPT_SILENT);
- if (wo->passive)
- f->flags |= OPT_PASSIVE;
- if (wo->silent)
- f->flags |= OPT_SILENT;
- fsm_open(f);
-}
-
-
-/*
- * lcp_close - Take LCP down.
- */
-void
-lcp_close(unit, reason)
- int unit;
- char *reason;
-{
- fsm *f = &lcp_fsm[unit];
-
- if (phase != PHASE_DEAD)
- new_phase(PHASE_TERMINATE);
- if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
- /*
- * This action is not strictly according to the FSM in RFC1548,
- * but it does mean that the program terminates if you do a
- * lcp_close() in passive/silent mode when a connection hasn't
- * been established.
- */
- f->state = CLOSED;
- lcp_finished(f);
-
- } else
- fsm_close(&lcp_fsm[unit], reason);
-}
-
-
-/*
- * lcp_lowerup - The lower layer is up.
- */
-void
-lcp_lowerup(unit)
- int unit;
-{
- lcp_options *wo = &lcp_wantoptions[unit];
- fsm *f = &lcp_fsm[unit];
-
- /*
- * Don't use A/C or protocol compression on transmission,
- * but accept A/C and protocol compressed packets
- * if we are going to ask for A/C and protocol compression.
- */
- ppp_send_config(unit, PPP_MRU, 0xffffffff, 0, 0);
- ppp_recv_config(unit, PPP_MRU, (lax_recv? 0: 0xffffffff),
- wo->neg_pcompression, wo->neg_accompression);
- peer_mru[unit] = PPP_MRU;
-
- if (listen_time != 0) {
- f->flags |= DELAYED_UP;
- timeout(lcp_delayed_up, f, 0, listen_time * 1000);
- } else
- fsm_lowerup(f);
-}
-
-
-/*
- * lcp_lowerdown - The lower layer is down.
- */
-void
-lcp_lowerdown(unit)
- int unit;
-{
- fsm *f = &lcp_fsm[unit];
-
- if (f->flags & DELAYED_UP)
- f->flags &= ~DELAYED_UP;
- else
- fsm_lowerdown(&lcp_fsm[unit]);
-}
-
-
-/*
- * lcp_delayed_up - Bring the lower layer up now.
- */
-static void
-lcp_delayed_up(arg)
- void *arg;
-{
- fsm *f = arg;
-
- if (f->flags & DELAYED_UP) {
- f->flags &= ~DELAYED_UP;
- fsm_lowerup(f);
- }
-}
-
-
-/*
- * lcp_input - Input LCP packet.
- */
-static void
-lcp_input(unit, p, len)
- int unit;
- u_char *p;
- int len;
-{
- fsm *f = &lcp_fsm[unit];
-
- if (f->flags & DELAYED_UP) {
- f->flags &= ~DELAYED_UP;
- fsm_lowerup(f);
- }
- fsm_input(f, p, len);
-}
-
-
-/*
- * lcp_extcode - Handle a LCP-specific code.
- */
-static int
-lcp_extcode(f, code, id, inp, len)
- fsm *f;
- int code, id;
- u_char *inp;
- int len;
-{
- u_char *magp;
-
- switch( code ){
- case PROTREJ:
- lcp_rprotrej(f, inp, len);
- break;
-
- case ECHOREQ:
- if (f->state != OPENED)
- break;
- magp = inp;
- PUTLONG(lcp_gotoptions[f->unit].magicnumber, magp);
- fsm_sdata(f, ECHOREP, id, inp, len);
- break;
-
- case ECHOREP:
- lcp_received_echo_reply(f, id, inp, len);
- break;
-
- case DISCREQ:
- break;
-
- default:
- return 0;
- }
- return 1;
-}
-
-
-/*
- * lcp_rprotrej - Receive an Protocol-Reject.
- *
- * Figure out which protocol is rejected and inform it.
- */
-static void
-lcp_rprotrej(f, inp, len)
- fsm *f;
- u_char *inp;
- int len;
-{
- int i;
- struct protent *protp;
- u_short prot;
-
- if (len < 2) {
- LCPDEBUG(("lcp_rprotrej: Rcvd short Protocol-Reject packet!"));
- return;
- }
-
- GETSHORT(prot, inp);
-
- /*
- * Protocol-Reject packets received in any state other than the LCP
- * OPENED state SHOULD be silently discarded.
- */
- if( f->state != OPENED ){
- LCPDEBUG(("Protocol-Reject discarded: LCP in state %d", f->state));
- return;
- }
-
- /*
- * Upcall the proper Protocol-Reject routine.
- */
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->protocol == prot && protp->enabled_flag) {
- (*protp->protrej)(f->unit);
- return;
- }
-
- warn("Protocol-Reject for unsupported protocol 0x%x", prot);
-}
-
-
-/*
- * lcp_protrej - A Protocol-Reject was received.
- */
-/*ARGSUSED*/
-static void
-lcp_protrej(unit)
- int unit;
-{
- /*
- * Can't reject LCP!
- */
- error("Received Protocol-Reject for LCP!");
- fsm_protreject(&lcp_fsm[unit]);
-}
-
-
-/*
- * lcp_sprotrej - Send a Protocol-Reject for some protocol.
- */
-void
-lcp_sprotrej(unit, p, len)
- int unit;
- u_char *p;
- int len;
-{
- /*
- * Send back the protocol and the information field of the
- * rejected packet. We only get here if LCP is in the OPENED state.
- */
- p += 2;
- len -= 2;
-
- fsm_sdata(&lcp_fsm[unit], PROTREJ, ++lcp_fsm[unit].id,
- p, len);
-}
-
-
-/*
- * lcp_resetci - Reset our CI.
- */
-static void
-lcp_resetci(f)
- fsm *f;
-{
- lcp_options *wo = &lcp_wantoptions[f->unit];
- lcp_options *go = &lcp_gotoptions[f->unit];
- lcp_options *ao = &lcp_allowoptions[f->unit];
-
- wo->magicnumber = magic();
- wo->numloops = 0;
- *go = *wo;
- if (!multilink) {
- go->neg_mrru = 0;
- go->neg_ssnhf = 0;
- go->neg_endpoint = 0;
- }
- if (noendpoint)
- ao->neg_endpoint = 0;
- peer_mru[f->unit] = PPP_MRU;
- auth_reset(f->unit);
-}
-
-
-/*
- * lcp_cilen - Return length of our CI.
- */
-static int
-lcp_cilen(f)
- fsm *f;
-{
- lcp_options *go = &lcp_gotoptions[f->unit];
-
-#define LENCIVOID(neg) ((neg) ? CILEN_VOID : 0)
-#define LENCICHAP(neg) ((neg) ? CILEN_CHAP : 0)
-#define LENCISHORT(neg) ((neg) ? CILEN_SHORT : 0)
-#define LENCILONG(neg) ((neg) ? CILEN_LONG : 0)
-#define LENCILQR(neg) ((neg) ? CILEN_LQR: 0)
-#define LENCICBCP(neg) ((neg) ? CILEN_CBCP: 0)
- /*
- * NB: we only ask for one of CHAP and UPAP, even if we will
- * accept either.
- */
- return (LENCISHORT(go->neg_mru && go->mru != DEFMRU) +
- LENCILONG(go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF) +
- LENCICHAP(go->neg_chap) +
- LENCISHORT(!go->neg_chap && go->neg_upap) +
- LENCILQR(go->neg_lqr) +
- LENCICBCP(go->neg_cbcp) +
- LENCILONG(go->neg_magicnumber) +
- LENCIVOID(go->neg_pcompression) +
- LENCIVOID(go->neg_accompression) +
- LENCISHORT(go->neg_mrru) +
- LENCIVOID(go->neg_ssnhf) +
- (go->neg_endpoint? CILEN_CHAR + go->endpoint.length: 0));
-}
-
-
-/*
- * lcp_addci - Add our desired CIs to a packet.
- */
-static void
-lcp_addci(f, ucp, lenp)
- fsm *f;
- u_char *ucp;
- int *lenp;
-{
- lcp_options *go = &lcp_gotoptions[f->unit];
- u_char *start_ucp = ucp;
-
-#define ADDCIVOID(opt, neg) \
- if (neg) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_VOID, ucp); \
- }
-#define ADDCISHORT(opt, neg, val) \
- if (neg) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_SHORT, ucp); \
- PUTSHORT(val, ucp); \
- }
-#define ADDCICHAP(opt, neg, val, digest) \
- if (neg) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_CHAP, ucp); \
- PUTSHORT(val, ucp); \
- PUTCHAR(digest, ucp); \
- }
-#define ADDCILONG(opt, neg, val) \
- if (neg) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_LONG, ucp); \
- PUTLONG(val, ucp); \
- }
-#define ADDCILQR(opt, neg, val) \
- if (neg) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_LQR, ucp); \
- PUTSHORT(PPP_LQR, ucp); \
- PUTLONG(val, ucp); \
- }
-#define ADDCICHAR(opt, neg, val) \
- if (neg) { \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_CHAR, ucp); \
- PUTCHAR(val, ucp); \
- }
-#define ADDCIENDP(opt, neg, class, val, len) \
- if (neg) { \
- int i; \
- PUTCHAR(opt, ucp); \
- PUTCHAR(CILEN_CHAR + len, ucp); \
- PUTCHAR(class, ucp); \
- for (i = 0; i < len; ++i) \
- PUTCHAR(val[i], ucp); \
- }
-
- ADDCISHORT(CI_MRU, go->neg_mru && go->mru != DEFMRU, go->mru);
- ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF,
- go->asyncmap);
- ADDCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype);
- ADDCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
- ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
- ADDCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
- ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
- ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
- ADDCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
- ADDCISHORT(CI_MRRU, go->neg_mrru, go->mrru);
- ADDCIVOID(CI_SSNHF, go->neg_ssnhf);
- ADDCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class,
- go->endpoint.value, go->endpoint.length);
-
- if (ucp - start_ucp != *lenp) {
- /* this should never happen, because peer_mtu should be 1500 */
- error("Bug in lcp_addci: wrong length");
- }
-}
-
-
-/*
- * lcp_ackci - Ack our CIs.
- * This should not modify any state if the Ack is bad.
- *
- * Returns:
- * 0 - Ack was bad.
- * 1 - Ack was good.
- */
-static int
-lcp_ackci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- lcp_options *go = &lcp_gotoptions[f->unit];
- u_char cilen, citype, cichar;
- u_short cishort;
- u_int32_t cilong;
-
- /*
- * CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-#define ACKCIVOID(opt, neg) \
- if (neg) { \
- if ((len -= CILEN_VOID) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_VOID || \
- citype != opt) \
- goto bad; \
- }
-#define ACKCISHORT(opt, neg, val) \
- if (neg) { \
- if ((len -= CILEN_SHORT) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_SHORT || \
- citype != opt) \
- goto bad; \
- GETSHORT(cishort, p); \
- if (cishort != val) \
- goto bad; \
- }
-#define ACKCICHAR(opt, neg, val) \
- if (neg) { \
- if ((len -= CILEN_CHAR) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_CHAR || \
- citype != opt) \
- goto bad; \
- GETCHAR(cichar, p); \
- if (cichar != val) \
- goto bad; \
- }
-#define ACKCICHAP(opt, neg, val, digest) \
- if (neg) { \
- if ((len -= CILEN_CHAP) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_CHAP || \
- citype != opt) \
- goto bad; \
- GETSHORT(cishort, p); \
- if (cishort != val) \
- goto bad; \
- GETCHAR(cichar, p); \
- if (cichar != digest) \
- goto bad; \
- }
-#define ACKCILONG(opt, neg, val) \
- if (neg) { \
- if ((len -= CILEN_LONG) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_LONG || \
- citype != opt) \
- goto bad; \
- GETLONG(cilong, p); \
- if (cilong != val) \
- goto bad; \
- }
-#define ACKCILQR(opt, neg, val) \
- if (neg) { \
- if ((len -= CILEN_LQR) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_LQR || \
- citype != opt) \
- goto bad; \
- GETSHORT(cishort, p); \
- if (cishort != PPP_LQR) \
- goto bad; \
- GETLONG(cilong, p); \
- if (cilong != val) \
- goto bad; \
- }
-#define ACKCIENDP(opt, neg, class, val, vlen) \
- if (neg) { \
- int i; \
- if ((len -= CILEN_CHAR + vlen) < 0) \
- goto bad; \
- GETCHAR(citype, p); \
- GETCHAR(cilen, p); \
- if (cilen != CILEN_CHAR + vlen || \
- citype != opt) \
- goto bad; \
- GETCHAR(cichar, p); \
- if (cichar != class) \
- goto bad; \
- for (i = 0; i < vlen; ++i) { \
- GETCHAR(cichar, p); \
- if (cichar != val[i]) \
- goto bad; \
- } \
- }
-
- ACKCISHORT(CI_MRU, go->neg_mru && go->mru != DEFMRU, go->mru);
- ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF,
- go->asyncmap);
- ACKCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype);
- ACKCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
- ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
- ACKCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
- ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
- ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
- ACKCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
- ACKCISHORT(CI_MRRU, go->neg_mrru, go->mrru);
- ACKCIVOID(CI_SSNHF, go->neg_ssnhf);
- ACKCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class,
- go->endpoint.value, go->endpoint.length);
-
- /*
- * If there are any remaining CIs, then this packet is bad.
- */
- if (len != 0)
- goto bad;
- return (1);
-bad:
- LCPDEBUG(("lcp_acki: received bad Ack!"));
- return (0);
-}
-
-
-/*
- * lcp_nakci - Peer has sent a NAK for some of our CIs.
- * This should not modify any state if the Nak is bad
- * or if LCP is in the OPENED state.
- *
- * Returns:
- * 0 - Nak was bad.
- * 1 - Nak was good.
- */
-static int
-lcp_nakci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- lcp_options *go = &lcp_gotoptions[f->unit];
- lcp_options *wo = &lcp_wantoptions[f->unit];
- u_char citype, cichar, *next;
- u_short cishort;
- u_int32_t cilong;
- lcp_options no; /* options we've seen Naks for */
- lcp_options try; /* options to request next time */
- int looped_back = 0;
- int cilen;
-
- BZERO(&no, sizeof(no));
- try = *go;
-
- /*
- * Any Nak'd CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-#define NAKCIVOID(opt, neg) \
- if (go->neg && \
- len >= CILEN_VOID && \
- p[1] == CILEN_VOID && \
- p[0] == opt) { \
- len -= CILEN_VOID; \
- INCPTR(CILEN_VOID, p); \
- no.neg = 1; \
- try.neg = 0; \
- }
-#define NAKCICHAP(opt, neg, code) \
- if (go->neg && \
- len >= CILEN_CHAP && \
- p[1] == CILEN_CHAP && \
- p[0] == opt) { \
- len -= CILEN_CHAP; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- GETCHAR(cichar, p); \
- no.neg = 1; \
- code \
- }
-#define NAKCICHAR(opt, neg, code) \
- if (go->neg && \
- len >= CILEN_CHAR && \
- p[1] == CILEN_CHAR && \
- p[0] == opt) { \
- len -= CILEN_CHAR; \
- INCPTR(2, p); \
- GETCHAR(cichar, p); \
- no.neg = 1; \
- code \
- }
-#define NAKCISHORT(opt, neg, code) \
- if (go->neg && \
- len >= CILEN_SHORT && \
- p[1] == CILEN_SHORT && \
- p[0] == opt) { \
- len -= CILEN_SHORT; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- no.neg = 1; \
- code \
- }
-#define NAKCILONG(opt, neg, code) \
- if (go->neg && \
- len >= CILEN_LONG && \
- p[1] == CILEN_LONG && \
- p[0] == opt) { \
- len -= CILEN_LONG; \
- INCPTR(2, p); \
- GETLONG(cilong, p); \
- no.neg = 1; \
- code \
- }
-#define NAKCILQR(opt, neg, code) \
- if (go->neg && \
- len >= CILEN_LQR && \
- p[1] == CILEN_LQR && \
- p[0] == opt) { \
- len -= CILEN_LQR; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- GETLONG(cilong, p); \
- no.neg = 1; \
- code \
- }
-#define NAKCIENDP(opt, neg) \
- if (go->neg && \
- len >= CILEN_CHAR && \
- p[0] == opt && \
- p[1] >= CILEN_CHAR && \
- p[1] <= len) { \
- len -= p[1]; \
- INCPTR(p[1], p); \
- no.neg = 1; \
- try.neg = 0; \
- }
-
- /*
- * We don't care if they want to send us smaller packets than
- * we want. Therefore, accept any MRU less than what we asked for,
- * but then ignore the new value when setting the MRU in the kernel.
- * If they send us a bigger MRU than what we asked, accept it, up to
- * the limit of the default MRU we'd get if we didn't negotiate.
- */
- if (go->neg_mru && go->mru != DEFMRU) {
- NAKCISHORT(CI_MRU, neg_mru,
- if (cishort <= wo->mru || cishort <= DEFMRU)
- try.mru = cishort;
- );
- }
-
- /*
- * Add any characters they want to our (receive-side) asyncmap.
- */
- if (go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF) {
- NAKCILONG(CI_ASYNCMAP, neg_asyncmap,
- try.asyncmap = go->asyncmap | cilong;
- );
- }
-
- /*
- * If they've nak'd our authentication-protocol, check whether
- * they are proposing a different protocol, or a different
- * hash algorithm for CHAP.
- */
- if ((go->neg_chap || go->neg_upap)
- && len >= CILEN_SHORT
- && p[0] == CI_AUTHTYPE && p[1] >= CILEN_SHORT && p[1] <= len) {
- cilen = p[1];
- len -= cilen;
- no.neg_chap = go->neg_chap;
- no.neg_upap = go->neg_upap;
- INCPTR(2, p);
- GETSHORT(cishort, p);
- if (cishort == PPP_PAP && cilen == CILEN_SHORT) {
- /*
- * If we were asking for CHAP, they obviously don't want to do it.
- * If we weren't asking for CHAP, then we were asking for PAP,
- * in which case this Nak is bad.
- */
- if (!go->neg_chap)
- goto bad;
- try.neg_chap = 0;
-
- } else if (cishort == PPP_CHAP && cilen == CILEN_CHAP) {
- GETCHAR(cichar, p);
- if (go->neg_chap) {
- /*
- * We were asking for CHAP/MD5; they must want a different
- * algorithm. If they can't do MD5, we can ask for M$-CHAP
- * if we support it, otherwise we'll have to stop
- * asking for CHAP.
- */
- if (cichar != go->chap_mdtype) {
-#ifdef CHAPMS
- if (cichar == CHAP_MICROSOFT)
- go->chap_mdtype = CHAP_MICROSOFT;
- else
-#endif /* CHAPMS */
- try.neg_chap = 0;
- }
- } else {
- /*
- * Stop asking for PAP if we were asking for it.
- */
- try.neg_upap = 0;
- }
-
- } else {
- /*
- * We don't recognize what they're suggesting.
- * Stop asking for what we were asking for.
- */
- if (go->neg_chap)
- try.neg_chap = 0;
- else
- try.neg_upap = 0;
- p += cilen - CILEN_SHORT;
- }
- }
-
- /*
- * If they can't cope with our link quality protocol, we'll have
- * to stop asking for LQR. We haven't got any other protocol.
- * If they Nak the reporting period, take their value XXX ?
- */
- NAKCILQR(CI_QUALITY, neg_lqr,
- if (cishort != PPP_LQR)
- try.neg_lqr = 0;
- else
- try.lqr_period = cilong;
- );
-
- /*
- * Only implementing CBCP...not the rest of the callback options
- */
- NAKCICHAR(CI_CALLBACK, neg_cbcp,
- try.neg_cbcp = 0;
- );
-
- /*
- * Check for a looped-back line.
- */
- NAKCILONG(CI_MAGICNUMBER, neg_magicnumber,
- try.magicnumber = magic();
- looped_back = 1;
- );
-
- /*
- * Peer shouldn't send Nak for protocol compression or
- * address/control compression requests; they should send
- * a Reject instead. If they send a Nak, treat it as a Reject.
- */
- NAKCIVOID(CI_PCOMPRESSION, neg_pcompression);
- NAKCIVOID(CI_ACCOMPRESSION, neg_accompression);
-
- /*
- * Nak for MRRU option - accept their value if it is smaller
- * than the one we want.
- */
- if (go->neg_mrru) {
- NAKCISHORT(CI_MRRU, neg_mrru,
- if (cishort <= wo->mrru)
- try.mrru = cishort;
- );
- }
-
- /*
- * Nak for short sequence numbers shouldn't be sent, treat it
- * like a reject.
- */
- NAKCIVOID(CI_SSNHF, neg_ssnhf);
-
- /*
- * Nak of the endpoint discriminator option is not permitted,
- * treat it like a reject.
- */
- NAKCIENDP(CI_EPDISC, neg_endpoint);
-
- /*
- * There may be remaining CIs, if the peer is requesting negotiation
- * on an option that we didn't include in our request packet.
- * If we see an option that we requested, or one we've already seen
- * in this packet, then this packet is bad.
- * If we wanted to respond by starting to negotiate on the requested
- * option(s), we could, but we don't, because except for the
- * authentication type and quality protocol, if we are not negotiating
- * an option, it is because we were told not to.
- * For the authentication type, the Nak from the peer means
- * `let me authenticate myself with you' which is a bit pointless.
- * For the quality protocol, the Nak means `ask me to send you quality
- * reports', but if we didn't ask for them, we don't want them.
- * An option we don't recognize represents the peer asking to
- * negotiate some option we don't support, so ignore it.
- */
- while (len > CILEN_VOID) {
- GETCHAR(citype, p);
- GETCHAR(cilen, p);
- if (cilen < CILEN_VOID || (len -= cilen) < 0)
- goto bad;
- next = p + cilen - 2;
-
- switch (citype) {
- case CI_MRU:
- if ((go->neg_mru && go->mru != DEFMRU)
- || no.neg_mru || cilen != CILEN_SHORT)
- goto bad;
- GETSHORT(cishort, p);
- if (cishort < DEFMRU) {
- try.neg_mru = 1;
- try.mru = cishort;
- }
- break;
- case CI_ASYNCMAP:
- if ((go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF)
- || no.neg_asyncmap || cilen != CILEN_LONG)
- goto bad;
- break;
- case CI_AUTHTYPE:
- if (go->neg_chap || no.neg_chap || go->neg_upap || no.neg_upap)
- goto bad;
- break;
- case CI_MAGICNUMBER:
- if (go->neg_magicnumber || no.neg_magicnumber ||
- cilen != CILEN_LONG)
- goto bad;
- break;
- case CI_PCOMPRESSION:
- if (go->neg_pcompression || no.neg_pcompression
- || cilen != CILEN_VOID)
- goto bad;
- break;
- case CI_ACCOMPRESSION:
- if (go->neg_accompression || no.neg_accompression
- || cilen != CILEN_VOID)
- goto bad;
- break;
- case CI_QUALITY:
- if (go->neg_lqr || no.neg_lqr || cilen != CILEN_LQR)
- goto bad;
- break;
- case CI_MRRU:
- if (go->neg_mrru || no.neg_mrru || cilen != CILEN_SHORT)
- goto bad;
- break;
- case CI_SSNHF:
- if (go->neg_ssnhf || no.neg_ssnhf || cilen != CILEN_VOID)
- goto bad;
- try.neg_ssnhf = 1;
- break;
- case CI_EPDISC:
- if (go->neg_endpoint || no.neg_endpoint || cilen < CILEN_CHAR)
- goto bad;
- break;
- }
- p = next;
- }
-
- /*
- * OK, the Nak is good. Now we can update state.
- * If there are any options left we ignore them.
- */
- if (f->state != OPENED) {
- if (looped_back) {
- if (++try.numloops >= lcp_loopbackfail) {
- notice("Serial line is looped back.");
- lcp_close(f->unit, "Loopback detected");
- status = EXIT_LOOPBACK;
- }
- } else
- try.numloops = 0;
- *go = try;
- }
-
- return 1;
-
-bad:
- LCPDEBUG(("lcp_nakci: received bad Nak!"));
- return 0;
-}
-
-
-/*
- * lcp_rejci - Peer has Rejected some of our CIs.
- * This should not modify any state if the Reject is bad
- * or if LCP is in the OPENED state.
- *
- * Returns:
- * 0 - Reject was bad.
- * 1 - Reject was good.
- */
-static int
-lcp_rejci(f, p, len)
- fsm *f;
- u_char *p;
- int len;
-{
- lcp_options *go = &lcp_gotoptions[f->unit];
- u_char cichar;
- u_short cishort;
- u_int32_t cilong;
- lcp_options try; /* options to request next time */
-
- try = *go;
-
- /*
- * Any Rejected CIs must be in exactly the same order that we sent.
- * Check packet length and CI length at each step.
- * If we find any deviations, then this packet is bad.
- */
-#define REJCIVOID(opt, neg) \
- if (go->neg && \
- len >= CILEN_VOID && \
- p[1] == CILEN_VOID && \
- p[0] == opt) { \
- len -= CILEN_VOID; \
- INCPTR(CILEN_VOID, p); \
- try.neg = 0; \
- }
-#define REJCISHORT(opt, neg, val) \
- if (go->neg && \
- len >= CILEN_SHORT && \
- p[1] == CILEN_SHORT && \
- p[0] == opt) { \
- len -= CILEN_SHORT; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- /* Check rejected value. */ \
- if (cishort != val) \
- goto bad; \
- try.neg = 0; \
- }
-#define REJCICHAP(opt, neg, val, digest) \
- if (go->neg && \
- len >= CILEN_CHAP && \
- p[1] == CILEN_CHAP && \
- p[0] == opt) { \
- len -= CILEN_CHAP; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- GETCHAR(cichar, p); \
- /* Check rejected value. */ \
- if (cishort != val || cichar != digest) \
- goto bad; \
- try.neg = 0; \
- try.neg_upap = 0; \
- }
-#define REJCILONG(opt, neg, val) \
- if (go->neg && \
- len >= CILEN_LONG && \
- p[1] == CILEN_LONG && \
- p[0] == opt) { \
- len -= CILEN_LONG; \
- INCPTR(2, p); \
- GETLONG(cilong, p); \
- /* Check rejected value. */ \
- if (cilong != val) \
- goto bad; \
- try.neg = 0; \
- }
-#define REJCILQR(opt, neg, val) \
- if (go->neg && \
- len >= CILEN_LQR && \
- p[1] == CILEN_LQR && \
- p[0] == opt) { \
- len -= CILEN_LQR; \
- INCPTR(2, p); \
- GETSHORT(cishort, p); \
- GETLONG(cilong, p); \
- /* Check rejected value. */ \
- if (cishort != PPP_LQR || cilong != val) \
- goto bad; \
- try.neg = 0; \
- }
-#define REJCICBCP(opt, neg, val) \
- if (go->neg && \
- len >= CILEN_CBCP && \
- p[1] == CILEN_CBCP && \
- p[0] == opt) { \
- len -= CILEN_CBCP; \
- INCPTR(2, p); \
- GETCHAR(cichar, p); \
- /* Check rejected value. */ \
- if (cichar != val) \
- goto bad; \
- try.neg = 0; \
- }
-#define REJCIENDP(opt, neg, class, val, vlen) \
- if (go->neg && \
- len >= CILEN_CHAR + vlen && \
- p[0] == opt && \
- p[1] == CILEN_CHAR + vlen) { \
- int i; \
- len -= CILEN_CHAR + vlen; \
- INCPTR(2, p); \
- GETCHAR(cichar, p); \
- if (cichar != class) \
- goto bad; \
- for (i = 0; i < vlen; ++i) { \
- GETCHAR(cichar, p); \
- if (cichar != val[i]) \
- goto bad; \
- } \
- try.neg = 0; \
- }
-
- REJCISHORT(CI_MRU, neg_mru, go->mru);
- REJCILONG(CI_ASYNCMAP, neg_asyncmap, go->asyncmap);
- REJCICHAP(CI_AUTHTYPE, neg_chap, PPP_CHAP, go->chap_mdtype);
- if (!go->neg_chap) {
- REJCISHORT(CI_AUTHTYPE, neg_upap, PPP_PAP);
- }
- REJCILQR(CI_QUALITY, neg_lqr, go->lqr_period);
- REJCICBCP(CI_CALLBACK, neg_cbcp, CBCP_OPT);
- REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber);
- REJCIVOID(CI_PCOMPRESSION, neg_pcompression);
- REJCIVOID(CI_ACCOMPRESSION, neg_accompression);
- REJCISHORT(CI_MRRU, neg_mrru, go->mrru);
- REJCIVOID(CI_SSNHF, neg_ssnhf);
- REJCIENDP(CI_EPDISC, neg_endpoint, go->endpoint.class,
- go->endpoint.value, go->endpoint.length);
-
- /*
- * If there are any remaining CIs, then this packet is bad.
- */
- if (len != 0)
- goto bad;
- /*
- * Now we can update state.
- */
- if (f->state != OPENED)
- *go = try;
- return 1;
-
-bad:
- LCPDEBUG(("lcp_rejci: received bad Reject!"));
- return 0;
-}
-
-
-/*
- * lcp_reqci - Check the peer's requested CIs and send appropriate response.
- *
- * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified
- * appropriately. If reject_if_disagree is non-zero, doesn't return
- * CONFNAK; returns CONFREJ if it can't return CONFACK.
- */
-static int
-lcp_reqci(f, inp, lenp, reject_if_disagree)
- fsm *f;
- u_char *inp; /* Requested CIs */
- int *lenp; /* Length of requested CIs */
- int reject_if_disagree;
-{
- lcp_options *go = &lcp_gotoptions[f->unit];
- lcp_options *ho = &lcp_hisoptions[f->unit];
- lcp_options *ao = &lcp_allowoptions[f->unit];
- u_char *cip, *next; /* Pointer to current and next CIs */
- int cilen, citype, cichar; /* Parsed len, type, char value */
- u_short cishort; /* Parsed short value */
- u_int32_t cilong; /* Parse long value */
- int rc = CONFACK; /* Final packet return code */
- int orc; /* Individual option return code */
- u_char *p; /* Pointer to next char to parse */
- u_char *rejp; /* Pointer to next char in reject frame */
- u_char *nakp; /* Pointer to next char in Nak frame */
- int l = *lenp; /* Length left */
-
- /*
- * Reset all his options.
- */
- BZERO(ho, sizeof(*ho));
-
- /*
- * Process all his options.
- */
- next = inp;
- nakp = nak_buffer;
- rejp = inp;
- while (l) {
- orc = CONFACK; /* Assume success */
- cip = p = next; /* Remember begining of CI */
- if (l < 2 || /* Not enough data for CI header or */
- p[1] < 2 || /* CI length too small or */
- p[1] > l) { /* CI length too big? */
- LCPDEBUG(("lcp_reqci: bad CI length!"));
- orc = CONFREJ; /* Reject bad CI */
- cilen = l; /* Reject till end of packet */
- l = 0; /* Don't loop again */
- citype = 0;
- goto endswitch;
- }
- GETCHAR(citype, p); /* Parse CI type */
- GETCHAR(cilen, p); /* Parse CI length */
- l -= cilen; /* Adjust remaining length */
- next += cilen; /* Step to next CI */
-
- switch (citype) { /* Check CI type */
- case CI_MRU:
- if (!ao->neg_mru || /* Allow option? */
- cilen != CILEN_SHORT) { /* Check CI length */
- orc = CONFREJ; /* Reject CI */
- break;
- }
- GETSHORT(cishort, p); /* Parse MRU */
-
- /*
- * He must be able to receive at least our minimum.
- * No need to check a maximum. If he sends a large number,
- * we'll just ignore it.
- */
- if (cishort < MINMRU) {
- orc = CONFNAK; /* Nak CI */
- PUTCHAR(CI_MRU, nakp);
- PUTCHAR(CILEN_SHORT, nakp);
- PUTSHORT(MINMRU, nakp); /* Give him a hint */
- break;
- }
- ho->neg_mru = 1; /* Remember he sent MRU */
- ho->mru = cishort; /* And remember value */
- break;
-
- case CI_ASYNCMAP:
- if (!ao->neg_asyncmap ||
- cilen != CILEN_LONG) {
- orc = CONFREJ;
- break;
- }
- GETLONG(cilong, p);
-
- /*
- * Asyncmap must have set at least the bits
- * which are set in lcp_allowoptions[unit].asyncmap.
- */
- if ((ao->asyncmap & ~cilong) != 0) {
- orc = CONFNAK;
- PUTCHAR(CI_ASYNCMAP, nakp);
- PUTCHAR(CILEN_LONG, nakp);
- PUTLONG(ao->asyncmap | cilong, nakp);
- break;
- }
- ho->neg_asyncmap = 1;
- ho->asyncmap = cilong;
- break;
-
- case CI_AUTHTYPE:
- if (cilen < CILEN_SHORT ||
- !(ao->neg_upap || ao->neg_chap)) {
- /*
- * Reject the option if we're not willing to authenticate.
- */
- orc = CONFREJ;
- break;
- }
- GETSHORT(cishort, p);
-
- /*
- * Authtype must be PAP or CHAP.
- *
- * Note: if both ao->neg_upap and ao->neg_chap are set,
- * and the peer sends a Configure-Request with two
- * authenticate-protocol requests, one for CHAP and one
- * for UPAP, then we will reject the second request.
- * Whether we end up doing CHAP or UPAP depends then on
- * the ordering of the CIs in the peer's Configure-Request.
- */
-
- if (cishort == PPP_PAP) {
- if (ho->neg_chap || /* we've already accepted CHAP */
- cilen != CILEN_SHORT) {
- LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE PAP, rejecting..."));
- orc = CONFREJ;
- break;
- }
- if (!ao->neg_upap) { /* we don't want to do PAP */
- orc = CONFNAK; /* NAK it and suggest CHAP */
- PUTCHAR(CI_AUTHTYPE, nakp);
- PUTCHAR(CILEN_CHAP, nakp);
- PUTSHORT(PPP_CHAP, nakp);
- PUTCHAR(ao->chap_mdtype, nakp);
- /* XXX if we can do CHAP_MICROSOFT as well, we should
- probably put in another option saying so */
- break;
- }
- ho->neg_upap = 1;
- break;
- }
- if (cishort == PPP_CHAP) {
- if (ho->neg_upap || /* we've already accepted PAP */
- cilen != CILEN_CHAP) {
- LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE CHAP, rejecting..."));
- orc = CONFREJ;
- break;
- }
- if (!ao->neg_chap) { /* we don't want to do CHAP */
- orc = CONFNAK; /* NAK it and suggest PAP */
- PUTCHAR(CI_AUTHTYPE, nakp);
- PUTCHAR(CILEN_SHORT, nakp);
- PUTSHORT(PPP_PAP, nakp);
- break;
- }
- GETCHAR(cichar, p); /* get digest type*/
- if (cichar != CHAP_DIGEST_MD5
-#ifdef CHAPMS
- && cichar != CHAP_MICROSOFT
-#endif
- ) {
- orc = CONFNAK;
- PUTCHAR(CI_AUTHTYPE, nakp);
- PUTCHAR(CILEN_CHAP, nakp);
- PUTSHORT(PPP_CHAP, nakp);
- PUTCHAR(ao->chap_mdtype, nakp);
- break;
- }
- ho->chap_mdtype = cichar; /* save md type */
- ho->neg_chap = 1;
- break;
- }
-
- /*
- * We don't recognize the protocol they're asking for.
- * Nak it with something we're willing to do.
- * (At this point we know ao->neg_upap || ao->neg_chap.)
- */
- orc = CONFNAK;
- PUTCHAR(CI_AUTHTYPE, nakp);
- if (ao->neg_chap) {
- PUTCHAR(CILEN_CHAP, nakp);
- PUTSHORT(PPP_CHAP, nakp);
- PUTCHAR(ao->chap_mdtype, nakp);
- } else {
- PUTCHAR(CILEN_SHORT, nakp);
- PUTSHORT(PPP_PAP, nakp);
- }
- break;
-
- case CI_QUALITY:
- if (!ao->neg_lqr ||
- cilen != CILEN_LQR) {
- orc = CONFREJ;
- break;
- }
-
- GETSHORT(cishort, p);
- GETLONG(cilong, p);
-
- /*
- * Check the protocol and the reporting period.
- * XXX When should we Nak this, and what with?
- */
- if (cishort != PPP_LQR) {
- orc = CONFNAK;
- PUTCHAR(CI_QUALITY, nakp);
- PUTCHAR(CILEN_LQR, nakp);
- PUTSHORT(PPP_LQR, nakp);
- PUTLONG(ao->lqr_period, nakp);
- break;
- }
- break;
-
- case CI_MAGICNUMBER:
- if (!(ao->neg_magicnumber || go->neg_magicnumber) ||
- cilen != CILEN_LONG) {
- orc = CONFREJ;
- break;
- }
- GETLONG(cilong, p);
-
- /*
- * He must have a different magic number.
- */
- if (go->neg_magicnumber &&
- cilong == go->magicnumber) {
- cilong = magic(); /* Don't put magic() inside macro! */
- orc = CONFNAK;
- PUTCHAR(CI_MAGICNUMBER, nakp);
- PUTCHAR(CILEN_LONG, nakp);
- PUTLONG(cilong, nakp);
- break;
- }
- ho->neg_magicnumber = 1;
- ho->magicnumber = cilong;
- break;
-
-
- case CI_PCOMPRESSION:
- if (!ao->neg_pcompression ||
- cilen != CILEN_VOID) {
- orc = CONFREJ;
- break;
- }
- ho->neg_pcompression = 1;
- break;
-
- case CI_ACCOMPRESSION:
- if (!ao->neg_accompression ||
- cilen != CILEN_VOID) {
- orc = CONFREJ;
- break;
- }
- ho->neg_accompression = 1;
- break;
-
- case CI_MRRU:
- if (!ao->neg_mrru || !multilink ||
- cilen != CILEN_SHORT) {
- orc = CONFREJ;
- break;
- }
-
- GETSHORT(cishort, p);
- /* possibly should insist on a minimum/maximum MRRU here */
- ho->neg_mrru = 1;
- ho->mrru = cishort;
- break;
-
- case CI_SSNHF:
- if (!ao->neg_ssnhf || !multilink ||
- cilen != CILEN_VOID) {
- orc = CONFREJ;
- break;
- }
- ho->neg_ssnhf = 1;
- break;
-
- case CI_EPDISC:
- if (!ao->neg_endpoint ||
- cilen < CILEN_CHAR ||
- cilen > CILEN_CHAR + MAX_ENDP_LEN) {
- orc = CONFREJ;
- break;
- }
- GETCHAR(cichar, p);
- cilen -= CILEN_CHAR;
- ho->neg_endpoint = 1;
- ho->endpoint.class = cichar;
- ho->endpoint.length = cilen;
- BCOPY(p, ho->endpoint.value, cilen);
- INCPTR(cilen, p);
- break;
-
- default:
- LCPDEBUG(("lcp_reqci: rcvd unknown option %d", citype));
- orc = CONFREJ;
- break;
- }
-
-endswitch:
- if (orc == CONFACK && /* Good CI */
- rc != CONFACK) /* but prior CI wasnt? */
- continue; /* Don't send this one */
-
- if (orc == CONFNAK) { /* Nak this CI? */
- if (reject_if_disagree /* Getting fed up with sending NAKs? */
- && citype != CI_MAGICNUMBER) {
- orc = CONFREJ; /* Get tough if so */
- } else {
- if (rc == CONFREJ) /* Rejecting prior CI? */
- continue; /* Don't send this one */
- rc = CONFNAK;
- }
- }
- if (orc == CONFREJ) { /* Reject this CI */
- rc = CONFREJ;
- if (cip != rejp) /* Need to move rejected CI? */
- BCOPY(cip, rejp, cilen); /* Move it */
- INCPTR(cilen, rejp); /* Update output pointer */
- }
- }
-
- /*
- * If we wanted to send additional NAKs (for unsent CIs), the
- * code would go here. The extra NAKs would go at *nakp.
- * At present there are no cases where we want to ask the
- * peer to negotiate an option.
- */
-
- switch (rc) {
- case CONFACK:
- *lenp = next - inp;
- break;
- case CONFNAK:
- /*
- * Copy the Nak'd options from the nak_buffer to the caller's buffer.
- */
- *lenp = nakp - nak_buffer;
- BCOPY(nak_buffer, inp, *lenp);
- break;
- case CONFREJ:
- *lenp = rejp - inp;
- break;
- }
-
- LCPDEBUG(("lcp_reqci: returning CONF%s.", CODENAME(rc)));
- return (rc); /* Return final code */
-}
-
-
-/*
- * lcp_up - LCP has come UP.
- */
-static void
-lcp_up(f)
- fsm *f;
-{
- lcp_options *wo = &lcp_wantoptions[f->unit];
- lcp_options *ho = &lcp_hisoptions[f->unit];
- lcp_options *go = &lcp_gotoptions[f->unit];
- lcp_options *ao = &lcp_allowoptions[f->unit];
- int mtu;
-
- if (!go->neg_magicnumber)
- go->magicnumber = 0;
- if (!ho->neg_magicnumber)
- ho->magicnumber = 0;
-
- /*
- * Set our MTU to the smaller of the MTU we wanted and
- * the MRU our peer wanted. If we negotiated an MRU,
- * set our MRU to the larger of value we wanted and
- * the value we got in the negotiation.
- * Note on the MTU: the link MTU can be the MRU the peer wanted,
- * the interface MTU is set to the lower of that and the
- * MTU we want to use.
- */
- mtu = ho->neg_mru? ho->mru: PPP_MRU;
-#ifdef HAVE_MULTILINK
- if (!(multilink && go->neg_mrru && ho->neg_mrru))
-#endif /* HAVE_MULTILINK */
- netif_set_mtu(f->unit, MIN(mtu, ao->mru));
- ppp_send_config(f->unit, mtu,
- (ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
- ho->neg_pcompression, ho->neg_accompression);
- ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU),
- (lax_recv? 0: go->neg_asyncmap? go->asyncmap: 0xffffffff),
- go->neg_pcompression, go->neg_accompression);
-
- if (ho->neg_mru)
- peer_mru[f->unit] = ho->mru;
-
- lcp_echo_lowerup(f->unit); /* Enable echo messages */
-
- link_established(f->unit);
-}
-
-
-/*
- * lcp_down - LCP has gone DOWN.
- *
- * Alert other protocols.
- */
-static void
-lcp_down(f)
- fsm *f;
-{
- lcp_options *go = &lcp_gotoptions[f->unit];
-
- lcp_echo_lowerdown(f->unit);
-
- link_down(f->unit);
-
- ppp_send_config(f->unit, PPP_MRU, 0xffffffff, 0, 0);
- ppp_recv_config(f->unit, PPP_MRU,
- (go->neg_asyncmap? go->asyncmap: 0xffffffff),
- go->neg_pcompression, go->neg_accompression);
- peer_mru[f->unit] = PPP_MRU;
-}
-
-
-/*
- * lcp_starting - LCP needs the lower layer up.
- */
-static void
-lcp_starting(f)
- fsm *f;
-{
- link_required(f->unit);
-}
-
-
-/*
- * lcp_finished - LCP has finished with the lower layer.
- */
-static void
-lcp_finished(f)
- fsm *f;
-{
- link_terminated(f->unit);
-}
-
-
-/*
- * lcp_printpkt - print the contents of an LCP packet.
- */
-static char *lcp_codenames[] = {
- "ConfReq", "ConfAck", "ConfNak", "ConfRej",
- "TermReq", "TermAck", "CodeRej", "ProtRej",
- "EchoReq", "EchoRep", "DiscReq"
-};
-
-static int
-lcp_printpkt(p, plen, printer, arg)
- u_char *p;
- int plen;
- void (*printer) __P((void *, char *, ...));
- void *arg;
-{
- int code, id, len, olen, i;
- u_char *pstart, *optend;
- u_short cishort;
- u_int32_t cilong;
-
- if (plen < HEADERLEN)
- return 0;
- pstart = p;
- GETCHAR(code, p);
- GETCHAR(id, p);
- GETSHORT(len, p);
- if (len < HEADERLEN || len > plen)
- return 0;
-
- if (code >= 1 && code <= sizeof(lcp_codenames) / sizeof(char *))
- printer(arg, " %s", lcp_codenames[code-1]);
- else
- printer(arg, " code=0x%x", code);
- printer(arg, " id=0x%x", id);
- len -= HEADERLEN;
- switch (code) {
- case CONFREQ:
- case CONFACK:
- case CONFNAK:
- case CONFREJ:
- /* print option list */
- while (len >= 2) {
- GETCHAR(code, p);
- GETCHAR(olen, p);
- p -= 2;
- if (olen < 2 || olen > len) {
- break;
- }
- printer(arg, " <");
- len -= olen;
- optend = p + olen;
- switch (code) {
- case CI_MRU:
- if (olen == CILEN_SHORT) {
- p += 2;
- GETSHORT(cishort, p);
- printer(arg, "mru %d", cishort);
- }
- break;
- case CI_ASYNCMAP:
- if (olen == CILEN_LONG) {
- p += 2;
- GETLONG(cilong, p);
- printer(arg, "asyncmap 0x%x", cilong);
- }
- break;
- case CI_AUTHTYPE:
- if (olen >= CILEN_SHORT) {
- p += 2;
- printer(arg, "auth ");
- GETSHORT(cishort, p);
- switch (cishort) {
- case PPP_PAP:
- printer(arg, "pap");
- break;
- case PPP_CHAP:
- printer(arg, "chap");
- if (p < optend) {
- switch (*p) {
- case CHAP_DIGEST_MD5:
- printer(arg, " MD5");
- ++p;
- break;
-#ifdef CHAPMS
- case CHAP_MICROSOFT:
- printer(arg, " m$oft");
- ++p;
- break;
-#endif
- }
- }
- break;
- default:
- printer(arg, "0x%x", cishort);
- }
- }
- break;
- case CI_QUALITY:
- if (olen >= CILEN_SHORT) {
- p += 2;
- printer(arg, "quality ");
- GETSHORT(cishort, p);
- switch (cishort) {
- case PPP_LQR:
- printer(arg, "lqr");
- break;
- default:
- printer(arg, "0x%x", cishort);
- }
- }
- break;
- case CI_CALLBACK:
- if (olen >= CILEN_CHAR) {
- p += 2;
- printer(arg, "callback ");
- GETCHAR(cishort, p);
- switch (cishort) {
- case CBCP_OPT:
- printer(arg, "CBCP");
- break;
- default:
- printer(arg, "0x%x", cishort);
- }
- }
- break;
- case CI_MAGICNUMBER:
- if (olen == CILEN_LONG) {
- p += 2;
- GETLONG(cilong, p);
- printer(arg, "magic 0x%x", cilong);
- }
- break;
- case CI_PCOMPRESSION:
- if (olen == CILEN_VOID) {
- p += 2;
- printer(arg, "pcomp");
- }
- break;
- case CI_ACCOMPRESSION:
- if (olen == CILEN_VOID) {
- p += 2;
- printer(arg, "accomp");
- }
- break;
- case CI_MRRU:
- if (olen == CILEN_SHORT) {
- p += 2;
- GETSHORT(cishort, p);
- printer(arg, "mrru %d", cishort);
- }
- break;
- case CI_SSNHF:
- if (olen == CILEN_VOID) {
- p += 2;
- printer(arg, "ssnhf");
- }
- break;
- case CI_EPDISC:
-#ifdef HAVE_MULTILINK
- if (olen >= CILEN_CHAR) {
- struct epdisc epd;
- p += 2;
- GETCHAR(epd.class, p);
- epd.length = olen - CILEN_CHAR;
- if (epd.length > MAX_ENDP_LEN)
- epd.length = MAX_ENDP_LEN;
- if (epd.length > 0) {
- BCOPY(p, epd.value, epd.length);
- p += epd.length;
- }
- printer(arg, "endpoint [%s]", epdisc_to_str(&epd));
- }
-#else
- printer(arg, "endpoint");
-#endif
- break;
- }
- while (p < optend) {
- GETCHAR(code, p);
- printer(arg, " %.2x", code);
- }
- printer(arg, ">");
- }
- break;
-
- case TERMACK:
- case TERMREQ:
- if (len > 0 && *p >= ' ' && *p < 0x7f) {
- printer(arg, " ");
- print_string((char *)p, len, printer, arg);
- p += len;
- len = 0;
- }
- break;
-
- case ECHOREQ:
- case ECHOREP:
- case DISCREQ:
- if (len >= 4) {
- GETLONG(cilong, p);
- printer(arg, " magic=0x%x", cilong);
- p += 4;
- len -= 4;
- }
- break;
- }
-
- /* print the rest of the bytes in the packet */
- for (i = 0; i < len && i < 32; ++i) {
- GETCHAR(code, p);
- printer(arg, " %.2x", code);
- }
- if (i < len) {
- printer(arg, " ...");
- p += len - i;
- }
-
- return p - pstart;
-}
-
-/*
- * Time to shut down the link because there is nothing out there.
- */
-
-static
-void LcpLinkFailure (f)
- fsm *f;
-{
- if (f->state == OPENED) {
- info("No response to %d echo-requests", lcp_echos_pending);
- notice("Serial link appears to be disconnected.");
- lcp_close(f->unit, "Peer not responding");
- status = EXIT_PEER_DEAD;
- }
-}
-
-/*
- * Timer expired for the LCP echo requests from this process.
- */
-
-static void
-LcpEchoCheck (f)
- fsm *f;
-{
- LcpSendEchoRequest (f);
- if (f->state != OPENED)
- return;
-
- /*
- * Start the timer for the next interval.
- */
- if (lcp_echo_timer_running)
- warn("assertion lcp_echo_timer_running==0 failed");
- TIMEOUT (LcpEchoTimeout, f, lcp_echo_interval);
- lcp_echo_timer_running = 1;
-}
-
-/*
- * LcpEchoTimeout - Timer expired on the LCP echo
- */
-
-static void
-LcpEchoTimeout (arg)
- void *arg;
-{
- if (lcp_echo_timer_running != 0) {
- lcp_echo_timer_running = 0;
- LcpEchoCheck ((fsm *) arg);
- }
-}
-
-/*
- * LcpEchoReply - LCP has received a reply to the echo
- */
-
-static void
-lcp_received_echo_reply (f, id, inp, len)
- fsm *f;
- int id;
- u_char *inp;
- int len;
-{
- u_int32_t magic;
-
- /* Check the magic number - don't count replies from ourselves. */
- if (len < 4) {
- dbglog("lcp: received short Echo-Reply, length %d", len);
- return;
- }
- GETLONG(magic, inp);
- if (lcp_gotoptions[f->unit].neg_magicnumber
- && magic == lcp_gotoptions[f->unit].magicnumber) {
- warn("appear to have received our own echo-reply!");
- return;
- }
-
- /* Reset the number of outstanding echo frames */
- lcp_echos_pending = 0;
-}
-
-/*
- * LcpSendEchoRequest - Send an echo request frame to the peer
- */
-
-static void
-LcpSendEchoRequest (f)
- fsm *f;
-{
- u_int32_t lcp_magic;
- u_char pkt[4], *pktp;
-
- /*
- * Detect the failure of the peer at this point.
- */
- if (lcp_echo_fails != 0) {
- if (lcp_echos_pending >= lcp_echo_fails) {
- LcpLinkFailure(f);
- lcp_echos_pending = 0;
- }
- }
-
- /*
- * Make and send the echo request frame.
- */
- if (f->state == OPENED) {
- lcp_magic = lcp_gotoptions[f->unit].magicnumber;
- pktp = pkt;
- PUTLONG(lcp_magic, pktp);
- fsm_sdata(f, ECHOREQ, lcp_echo_number++ & 0xFF, pkt, pktp - pkt);
- ++lcp_echos_pending;
- }
-}
-
-/*
- * lcp_echo_lowerup - Start the timer for the LCP frame
- */
-
-static void
-lcp_echo_lowerup (unit)
- int unit;
-{
- fsm *f = &lcp_fsm[unit];
-
- /* Clear the parameters for generating echo frames */
- lcp_echos_pending = 0;
- lcp_echo_number = 0;
- lcp_echo_timer_running = 0;
-
- /* If a timeout interval is specified then start the timer */
- if (lcp_echo_interval != 0)
- LcpEchoCheck (f);
-}
-
-/*
- * lcp_echo_lowerdown - Stop the timer for the LCP frame
- */
-
-static void
-lcp_echo_lowerdown (unit)
- int unit;
-{
- fsm *f = &lcp_fsm[unit];
-
- if (lcp_echo_timer_running != 0) {
- UNTIMEOUT (LcpEchoTimeout, f);
- lcp_echo_timer_running = 0;
- }
-}
diff --git a/mdk-stage1/ppp/pppd/lcp.h b/mdk-stage1/ppp/pppd/lcp.h
deleted file mode 100644
index b87a9295e..000000000
--- a/mdk-stage1/ppp/pppd/lcp.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * lcp.h - Link Control Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-/*
- * Options.
- */
-#define CI_MRU 1 /* Maximum Receive Unit */
-#define CI_ASYNCMAP 2 /* Async Control Character Map */
-#define CI_AUTHTYPE 3 /* Authentication Type */
-#define CI_QUALITY 4 /* Quality Protocol */
-#define CI_MAGICNUMBER 5 /* Magic Number */
-#define CI_PCOMPRESSION 7 /* Protocol Field Compression */
-#define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */
-#define CI_CALLBACK 13 /* callback */
-#define CI_MRRU 17 /* max reconstructed receive unit; multilink */
-#define CI_SSNHF 18 /* short sequence numbers for multilink */
-#define CI_EPDISC 19 /* endpoint discriminator */
-
-/*
- * LCP-specific packet types.
- */
-#define PROTREJ 8 /* Protocol Reject */
-#define ECHOREQ 9 /* Echo Request */
-#define ECHOREP 10 /* Echo Reply */
-#define DISCREQ 11 /* Discard Request */
-#define CBCP_OPT 6 /* Use callback control protocol */
-
-/*
- * The state of options is described by an lcp_options structure.
- */
-typedef struct lcp_options {
- bool passive; /* Don't die if we don't get a response */
- bool silent; /* Wait for the other end to start first */
- bool restart; /* Restart vs. exit after close */
- bool neg_mru; /* Negotiate the MRU? */
- bool neg_asyncmap; /* Negotiate the async map? */
- bool neg_upap; /* Ask for UPAP authentication? */
- bool neg_chap; /* Ask for CHAP authentication? */
- bool neg_magicnumber; /* Ask for magic number? */
- bool neg_pcompression; /* HDLC Protocol Field Compression? */
- bool neg_accompression; /* HDLC Address/Control Field Compression? */
- bool neg_lqr; /* Negotiate use of Link Quality Reports */
- bool neg_cbcp; /* Negotiate use of CBCP */
- bool neg_mrru; /* negotiate multilink MRRU */
- bool neg_ssnhf; /* negotiate short sequence numbers */
- bool neg_endpoint; /* negotiate endpoint discriminator */
- int mru; /* Value of MRU */
- int mrru; /* Value of MRRU, and multilink enable */
- u_char chap_mdtype; /* which MD type (hashing algorithm) */
- u_int32_t asyncmap; /* Value of async map */
- u_int32_t magicnumber;
- int numloops; /* Number of loops during magic number neg. */
- u_int32_t lqr_period; /* Reporting period for LQR 1/100ths second */
- struct epdisc endpoint; /* endpoint discriminator */
-} lcp_options;
-
-extern fsm lcp_fsm[];
-extern lcp_options lcp_wantoptions[];
-extern lcp_options lcp_gotoptions[];
-extern lcp_options lcp_allowoptions[];
-extern lcp_options lcp_hisoptions[];
-
-#define DEFMRU 1500 /* Try for this */
-#define MINMRU 128 /* No MRUs below this */
-#define MAXMRU 16384 /* Normally limit MRU to this */
-
-void lcp_open __P((int));
-void lcp_close __P((int, char *));
-void lcp_lowerup __P((int));
-void lcp_lowerdown __P((int));
-void lcp_sprotrej __P((int, u_char *, int)); /* send protocol reject */
-
-extern struct protent lcp_protent;
-
-/* Default number of times we receive our magic number from the peer
- before deciding the link is looped-back. */
-#define DEFLOOPBACKFAIL 10
diff --git a/mdk-stage1/ppp/pppd/magic.c b/mdk-stage1/ppp/pppd/magic.c
deleted file mode 100644
index 1682dee03..000000000
--- a/mdk-stage1/ppp/pppd/magic.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * magic.c - PPP Magic Number routines.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include "pppd.h"
-#include "magic.h"
-
-static const char rcsid[] = RCSID;
-
-extern long mrand48 __P((void));
-extern void srand48 __P((long));
-
-/*
- * magic_init - Initialize the magic number generator.
- *
- * Attempts to compute a random number seed which will not repeat.
- * The current method uses the current hostid, current process ID
- * and current time, currently.
- */
-void
-magic_init()
-{
- long seed;
- struct timeval t;
-
- gettimeofday(&t, NULL);
- seed = get_host_seed() ^ t.tv_sec ^ t.tv_usec ^ getpid();
- srand48(seed);
-}
-
-/*
- * magic - Returns the next magic number.
- */
-u_int32_t
-magic()
-{
- return (u_int32_t) mrand48();
-}
-
-#ifdef NO_DRAND48
-/*
- * Substitute procedures for those systems which don't have
- * drand48 et al.
- */
-
-double
-drand48()
-{
- return (double)random() / (double)0x7fffffffL; /* 2**31-1 */
-}
-
-long
-mrand48()
-{
- return random();
-}
-
-void
-srand48(seedval)
-long seedval;
-{
- srandom((int)seedval);
-}
-
-#endif
diff --git a/mdk-stage1/ppp/pppd/magic.h b/mdk-stage1/ppp/pppd/magic.h
deleted file mode 100644
index 1344626a3..000000000
--- a/mdk-stage1/ppp/pppd/magic.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * magic.h - PPP Magic Number definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id$
- */
-
-void magic_init __P((void)); /* Initialize the magic number generator */
-u_int32_t magic __P((void)); /* Returns the next magic number */
diff --git a/mdk-stage1/ppp/pppd/main.c b/mdk-stage1/ppp/pppd/main.c
deleted file mode 100644
index c074938cd..000000000
--- a/mdk-stage1/ppp/pppd/main.c
+++ /dev/null
@@ -1,1846 +0,0 @@
-/*
- * main.c - Point-to-Point Protocol main module
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#define RCSID "$Id$"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <netdb.h>
-#include <utmp.h>
-#include <pwd.h>
-#include <setjmp.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "pppd.h"
-#include "magic.h"
-#include "fsm.h"
-#include "lcp.h"
-#include "ipcp.h"
-#ifdef INET6
-#include "ipv6cp.h"
-#endif
-#include "upap.h"
-#include "chap.h"
-#include "ccp.h"
-#include "pathnames.h"
-#include "tdb.h"
-
-#ifdef CBCP_SUPPORT
-#include "cbcp.h"
-#endif
-
-#ifdef IPX_CHANGE
-#include "ipxcp.h"
-#endif /* IPX_CHANGE */
-#ifdef AT_CHANGE
-#include "atcp.h"
-#endif
-
-static const char rcsid[] = RCSID;
-
-/* interface vars */
-char ifname[32]; /* Interface name */
-int ifunit; /* Interface unit number */
-
-struct channel *the_channel;
-
-char *progname; /* Name of this program */
-char hostname[MAXNAMELEN]; /* Our hostname */
-static char pidfilename[MAXPATHLEN]; /* name of pid file */
-static char linkpidfile[MAXPATHLEN]; /* name of linkname pid file */
-char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
-uid_t uid; /* Our real user-id */
-struct notifier *pidchange = NULL;
-struct notifier *phasechange = NULL;
-struct notifier *exitnotify = NULL;
-struct notifier *sigreceived = NULL;
-
-int hungup; /* terminal has been hung up */
-int privileged; /* we're running as real uid root */
-int need_holdoff; /* need holdoff period before restarting */
-int detached; /* have detached from terminal */
-volatile int status; /* exit status for pppd */
-int unsuccess; /* # unsuccessful connection attempts */
-int do_callback; /* != 0 if we should do callback next */
-int doing_callback; /* != 0 if we are doing callback */
-TDB_CONTEXT *pppdb; /* database for storing status etc. */
-char db_key[32];
-
-int (*holdoff_hook) __P((void)) = NULL;
-int (*new_phase_hook) __P((int)) = NULL;
-
-static int conn_running; /* we have a [dis]connector running */
-static int devfd; /* fd of underlying device */
-static int fd_ppp = -1; /* fd for talking PPP */
-static int fd_loop; /* fd for getting demand-dial packets */
-
-int phase; /* where the link is at */
-int kill_link;
-int open_ccp_flag;
-int listen_time;
-int got_sigusr2;
-int got_sigterm;
-int got_sighup;
-
-static int waiting;
-static sigjmp_buf sigjmp;
-
-char **script_env; /* Env. variable values for scripts */
-int s_env_nalloc; /* # words avail at script_env */
-
-u_char outpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for outgoing packet */
-u_char inpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for incoming packet */
-
-static int n_children; /* # child processes still running */
-static int got_sigchld; /* set if we have received a SIGCHLD */
-
-int privopen; /* don't lock, open device as root */
-
-char *no_ppp_msg = "Sorry - this system lacks PPP kernel support\n";
-
-GIDSET_TYPE groups[NGROUPS_MAX];/* groups the user is in */
-int ngroups; /* How many groups valid in groups */
-
-static struct timeval start_time; /* Time when link was started. */
-
-struct pppd_stats link_stats;
-int link_connect_time;
-int link_stats_valid;
-
-/*
- * We maintain a list of child process pids and
- * functions to call when they exit.
- */
-struct subprocess {
- pid_t pid;
- char *prog;
- void (*done) __P((void *));
- void *arg;
- struct subprocess *next;
-};
-
-static struct subprocess *children;
-
-/* Prototypes for procedures local to this file. */
-
-static void setup_signals __P((void));
-static void create_pidfile __P((void));
-static void create_linkpidfile __P((void));
-static void cleanup __P((void));
-static void get_input __P((void));
-static void calltimeout __P((void));
-static struct timeval *timeleft __P((struct timeval *));
-static void kill_my_pg __P((int));
-static void hup __P((int));
-static void term __P((int));
-static void chld __P((int));
-static void toggle_debug __P((int));
-static void open_ccp __P((int));
-static void bad_signal __P((int));
-static void holdoff_end __P((void *));
-static int reap_kids __P((int waitfor));
-static void update_db_entry __P((void));
-static void add_db_key __P((const char *));
-static void delete_db_key __P((const char *));
-static void cleanup_db __P((void));
-static void handle_events __P((void));
-
-extern char *ttyname __P((int));
-extern char *getlogin __P((void));
-int main __P((int, char *[]));
-
-#ifdef ultrix
-#undef O_NONBLOCK
-#define O_NONBLOCK O_NDELAY
-#endif
-
-#ifdef ULTRIX
-#define setlogmask(x)
-#endif
-
-/*
- * PPP Data Link Layer "protocol" table.
- * One entry per supported protocol.
- * The last entry must be NULL.
- */
-struct protent *protocols[] = {
- &lcp_protent,
- &pap_protent,
- &chap_protent,
-#ifdef CBCP_SUPPORT
- &cbcp_protent,
-#endif
- &ipcp_protent,
-#ifdef INET6
- &ipv6cp_protent,
-#endif
- &ccp_protent,
-#ifdef IPX_CHANGE
- &ipxcp_protent,
-#endif
-#ifdef AT_CHANGE
- &atcp_protent,
-#endif
- NULL
-};
-
-/*
- * If PPP_DRV_NAME is not defined, use the default "ppp" as the device name.
- */
-#if !defined(PPP_DRV_NAME)
-#define PPP_DRV_NAME "ppp"
-#endif /* !defined(PPP_DRV_NAME) */
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int i, t;
- char *p;
- struct passwd *pw;
- struct protent *protp;
- char numbuf[16];
-
- new_phase(PHASE_INITIALIZE);
-
- /*
- * Ensure that fds 0, 1, 2 are open, to /dev/null if nowhere else.
- * This way we can close 0, 1, 2 in detach() without clobbering
- * a fd that we are using.
- */
- if ((i = open("/dev/null", O_RDWR)) >= 0) {
- while (0 <= i && i <= 2)
- i = dup(i);
- if (i >= 0)
- close(i);
- }
-
- script_env = NULL;
-
- /* Initialize syslog facilities */
- reopen_log();
-
- if (gethostname(hostname, MAXNAMELEN) < 0 ) {
- option_error("Couldn't get hostname: %m");
- exit(1);
- }
- hostname[MAXNAMELEN-1] = 0;
-
- /* make sure we don't create world or group writable files. */
- umask(umask(0777) | 022);
-
- uid = getuid();
- privileged = uid == 0;
- slprintf(numbuf, sizeof(numbuf), "%d", uid);
- script_setenv("ORIG_UID", numbuf, 0);
-
- ngroups = getgroups(NGROUPS_MAX, groups);
-
- /*
- * Initialize magic number generator now so that protocols may
- * use magic numbers in initialization.
- */
- magic_init();
-
- /*
- * Initialize each protocol.
- */
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- (*protp->init)(0);
-
- /*
- * Initialize the default channel.
- */
- tty_init();
-
- progname = *argv;
-
- /*
- * Parse, in order, the system options file, the user's options file,
- * and the command line arguments.
- */
- if (!options_from_file(_PATH_SYSOPTIONS, !privileged, 0, 1)
- || !options_from_user()
- || !parse_args(argc-1, argv+1))
- exit(EXIT_OPTION_ERROR);
- devnam_fixed = 1; /* can no longer change device name */
-
- /*
- * Work out the device name, if it hasn't already been specified,
- * and parse the tty's options file.
- */
- if (the_channel->process_extra_options)
- (*the_channel->process_extra_options)();
-
- if (debug)
- setlogmask(LOG_UPTO(LOG_DEBUG));
-
- /*
- * Check that we are running as root.
- */
- if (geteuid() != 0) {
- option_error("must be root to run %s, since it is not setuid-root",
- argv[0]);
- exit(EXIT_NOT_ROOT);
- }
-
- if (!ppp_available()) {
- option_error("%s", no_ppp_msg);
- exit(EXIT_NO_KERNEL_SUPPORT);
- }
-
- /*
- * Check that the options given are valid and consistent.
- */
- check_options();
- if (!sys_check_options())
- exit(EXIT_OPTION_ERROR);
- auth_check_options();
-#ifdef HAVE_MULTILINK
- mp_check_options();
-#endif
- for (i = 0; (protp = protocols[i]) != NULL; ++i)
- if (protp->check_options != NULL)
- (*protp->check_options)();
- if (the_channel->check_options)
- (*the_channel->check_options)();
-
-
- if (dump_options || dryrun) {
- init_pr_log(NULL, LOG_INFO);
- print_options(pr_log, NULL);
- end_pr_log();
- if (dryrun)
- die(0);
- }
-
- /*
- * Initialize system-dependent stuff.
- */
- sys_init();
-
- pppdb = tdb_open(_PATH_PPPDB, 0, 0, O_RDWR|O_CREAT, 0644);
- if (pppdb != NULL) {
- slprintf(db_key, sizeof(db_key), "pppd%d", getpid());
- update_db_entry();
- } else {
- warn("Warning: couldn't open ppp database %s", _PATH_PPPDB);
- if (multilink) {
- warn("Warning: disabling multilink");
- multilink = 0;
- }
- }
-
- /*
- * Detach ourselves from the terminal, if required,
- * and identify who is running us.
- */
- if (!nodetach && !updetach)
- detach();
- p = getlogin();
- if (p == NULL) {
- pw = getpwuid(uid);
- if (pw != NULL && pw->pw_name != NULL)
- p = pw->pw_name;
- else
- p = "(unknown)";
- }
- syslog(LOG_NOTICE, "pppd %s started by %s, uid %d", VERSION, p, uid);
- script_setenv("PPPLOGNAME", p, 0);
-
- if (devnam[0])
- script_setenv("DEVICE", devnam, 1);
- slprintf(numbuf, sizeof(numbuf), "%d", getpid());
- script_setenv("PPPD_PID", numbuf, 1);
-
- setup_signals();
-
- waiting = 0;
-
- create_linkpidfile();
-
- /*
- * If we're doing dial-on-demand, set up the interface now.
- */
- if (demand) {
- /*
- * Open the loopback channel and set it up to be the ppp interface.
- */
- tdb_writelock(pppdb);
- fd_loop = open_ppp_loopback();
- set_ifunit(1);
- tdb_writeunlock(pppdb);
-
- /*
- * Configure the interface and mark it up, etc.
- */
- demand_conf();
- }
-
- do_callback = 0;
- for (;;) {
-
- listen_time = 0;
- need_holdoff = 1;
- devfd = -1;
- status = EXIT_OK;
- ++unsuccess;
- doing_callback = do_callback;
- do_callback = 0;
-
- if (demand && !doing_callback) {
- /*
- * Don't do anything until we see some activity.
- */
- new_phase(PHASE_DORMANT);
- demand_unblock();
- add_fd(fd_loop);
- for (;;) {
- handle_events();
- if (kill_link && !persist)
- break;
- if (get_loop_output())
- break;
- }
- remove_fd(fd_loop);
- if (kill_link && !persist)
- break;
-
- /*
- * Now we want to bring up the link.
- */
- demand_block();
- info("Starting link");
- }
-
- new_phase(PHASE_SERIALCONN);
-
- devfd = the_channel->connect();
- if (devfd < 0)
- goto fail;
-
- /* set up the serial device as a ppp interface */
- tdb_writelock(pppdb);
- fd_ppp = the_channel->establish_ppp(devfd);
- if (fd_ppp < 0) {
- tdb_writeunlock(pppdb);
- status = EXIT_FATAL_ERROR;
- goto disconnect;
- }
-
- if (!demand && ifunit >= 0)
- set_ifunit(1);
- tdb_writeunlock(pppdb);
-
- /*
- * Start opening the connection and wait for
- * incoming events (reply, timeout, etc.).
- */
- notice("Connect: %s <--> %s", ifname, ppp_devnam);
- gettimeofday(&start_time, NULL);
- link_stats_valid = 0;
- script_unsetenv("CONNECT_TIME");
- script_unsetenv("BYTES_SENT");
- script_unsetenv("BYTES_RCVD");
- lcp_lowerup(0);
-
- add_fd(fd_ppp);
- lcp_open(0); /* Start protocol */
- status = EXIT_NEGOTIATION_FAILED;
- new_phase(PHASE_ESTABLISH);
- while (phase != PHASE_DEAD) {
- handle_events();
- get_input();
- if (kill_link)
- lcp_close(0, "User request");
- if (open_ccp_flag) {
- if (phase == PHASE_NETWORK || phase == PHASE_RUNNING) {
- ccp_fsm[0].flags = OPT_RESTART; /* clears OPT_SILENT */
- (*ccp_protent.open)(0);
- }
- }
- }
-
- /*
- * Print connect time and statistics.
- */
- if (link_stats_valid) {
- int t = (link_connect_time + 5) / 6; /* 1/10ths of minutes */
- info("Connect time %d.%d minutes.", t/10, t%10);
- info("Sent %u bytes, received %u bytes.",
- link_stats.bytes_out, link_stats.bytes_in);
- }
-
- /*
- * Delete pid file before disestablishing ppp. Otherwise it
- * can happen that another pppd gets the same unit and then
- * we delete its pid file.
- */
- if (!demand) {
- if (pidfilename[0] != 0
- && unlink(pidfilename) < 0 && errno != ENOENT)
- warn("unable to delete pid file %s: %m", pidfilename);
- pidfilename[0] = 0;
- }
-
- /*
- * If we may want to bring the link up again, transfer
- * the ppp unit back to the loopback. Set the
- * real serial device back to its normal mode of operation.
- */
- remove_fd(fd_ppp);
- clean_check();
- the_channel->disestablish_ppp(devfd);
- fd_ppp = -1;
- if (!hungup)
- lcp_lowerdown(0);
- if (!demand)
- script_unsetenv("IFNAME");
-
- /*
- * Run disconnector script, if requested.
- * XXX we may not be able to do this if the line has hung up!
- */
- disconnect:
- new_phase(PHASE_DISCONNECT);
- the_channel->disconnect();
-
- fail:
- if (the_channel->cleanup)
- (*the_channel->cleanup)();
-
- if (!demand) {
- if (pidfilename[0] != 0
- && unlink(pidfilename) < 0 && errno != ENOENT)
- warn("unable to delete pid file %s: %m", pidfilename);
- pidfilename[0] = 0;
- }
-
- if (!persist || (maxfail > 0 && unsuccess >= maxfail))
- break;
-
- if (demand)
- demand_discard();
- t = need_holdoff? holdoff: 0;
- if (holdoff_hook)
- t = (*holdoff_hook)();
- if (t > 0) {
- new_phase(PHASE_HOLDOFF);
- TIMEOUT(holdoff_end, NULL, t);
- do {
- handle_events();
- if (kill_link)
- new_phase(PHASE_DORMANT); /* allow signal to end holdoff */
- } while (phase == PHASE_HOLDOFF);
- if (!persist)
- break;
- }
- }
-
- /* Wait for scripts to finish */
- /* XXX should have a timeout here */
- while (n_children > 0) {
- if (debug) {
- struct subprocess *chp;
- dbglog("Waiting for %d child processes...", n_children);
- for (chp = children; chp != NULL; chp = chp->next)
- dbglog(" script %s, pid %d", chp->prog, chp->pid);
- }
- if (reap_kids(1) < 0)
- break;
- }
-
- die(status);
- return 0;
-}
-
-/*
- * handle_events - wait for something to happen and respond to it.
- */
-static void
-handle_events()
-{
- struct timeval timo;
- sigset_t mask;
-
- kill_link = open_ccp_flag = 0;
- if (sigsetjmp(sigjmp, 1) == 0) {
- sigprocmask(SIG_BLOCK, &mask, NULL);
- if (got_sighup || got_sigterm || got_sigusr2 || got_sigchld) {
- sigprocmask(SIG_UNBLOCK, &mask, NULL);
- } else {
- waiting = 1;
- sigprocmask(SIG_UNBLOCK, &mask, NULL);
- wait_input(timeleft(&timo));
- }
- }
- waiting = 0;
- calltimeout();
- if (got_sighup) {
- kill_link = 1;
- got_sighup = 0;
- if (status != EXIT_HANGUP)
- status = EXIT_USER_REQUEST;
- }
- if (got_sigterm) {
- kill_link = 1;
- persist = 0;
- status = EXIT_USER_REQUEST;
- got_sigterm = 0;
- }
- if (got_sigchld) {
- reap_kids(0); /* Don't leave dead kids lying around */
- got_sigchld = 0;
- }
- if (got_sigusr2) {
- open_ccp_flag = 1;
- got_sigusr2 = 0;
- }
-}
-
-/*
- * setup_signals - initialize signal handling.
- */
-static void
-setup_signals()
-{
- struct sigaction sa;
- sigset_t mask;
-
- /*
- * Compute mask of all interesting signals and install signal handlers
- * for each. Only one signal handler may be active at a time. Therefore,
- * all other signals should be masked when any handler is executing.
- */
- sigemptyset(&mask);
- sigaddset(&mask, SIGHUP);
- sigaddset(&mask, SIGINT);
- sigaddset(&mask, SIGTERM);
- sigaddset(&mask, SIGCHLD);
- sigaddset(&mask, SIGUSR2);
-
-#define SIGNAL(s, handler) do { \
- sa.sa_handler = handler; \
- if (sigaction(s, &sa, NULL) < 0) \
- fatal("Couldn't establish signal handler (%d): %m", s); \
- } while (0)
-
- sa.sa_mask = mask;
- sa.sa_flags = 0;
- SIGNAL(SIGHUP, hup); /* Hangup */
- SIGNAL(SIGINT, term); /* Interrupt */
- SIGNAL(SIGTERM, term); /* Terminate */
- SIGNAL(SIGCHLD, chld);
-
- SIGNAL(SIGUSR1, toggle_debug); /* Toggle debug flag */
- SIGNAL(SIGUSR2, open_ccp); /* Reopen CCP */
-
- /*
- * Install a handler for other signals which would otherwise
- * cause pppd to exit without cleaning up.
- */
- SIGNAL(SIGABRT, bad_signal);
- SIGNAL(SIGALRM, bad_signal);
- SIGNAL(SIGFPE, bad_signal);
- SIGNAL(SIGILL, bad_signal);
- SIGNAL(SIGPIPE, bad_signal);
- SIGNAL(SIGQUIT, bad_signal);
- SIGNAL(SIGSEGV, bad_signal);
-#ifdef SIGBUS
- SIGNAL(SIGBUS, bad_signal);
-#endif
-#ifdef SIGEMT
- SIGNAL(SIGEMT, bad_signal);
-#endif
-#ifdef SIGPOLL
- SIGNAL(SIGPOLL, bad_signal);
-#endif
-#ifdef SIGPROF
- SIGNAL(SIGPROF, bad_signal);
-#endif
-#ifdef SIGSYS
- SIGNAL(SIGSYS, bad_signal);
-#endif
-#ifdef SIGTRAP
- SIGNAL(SIGTRAP, bad_signal);
-#endif
-#ifdef SIGVTALRM
- SIGNAL(SIGVTALRM, bad_signal);
-#endif
-#ifdef SIGXCPU
- SIGNAL(SIGXCPU, bad_signal);
-#endif
-#ifdef SIGXFSZ
- SIGNAL(SIGXFSZ, bad_signal);
-#endif
-
- /*
- * Apparently we can get a SIGPIPE when we call syslog, if
- * syslogd has died and been restarted. Ignoring it seems
- * be sufficient.
- */
- signal(SIGPIPE, SIG_IGN);
-}
-
-/*
- * set_ifunit - do things we need to do once we know which ppp
- * unit we are using.
- */
-void
-set_ifunit(iskey)
- int iskey;
-{
- info("Using interface %s%d", PPP_DRV_NAME, ifunit);
- slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
- script_setenv("IFNAME", ifname, iskey);
- if (iskey) {
- create_pidfile(); /* write pid to file */
- create_linkpidfile();
- }
-}
-
-/*
- * detach - detach us from the controlling terminal.
- */
-void
-detach()
-{
- int pid;
- char numbuf[16];
-
- if (detached)
- return;
- if ((pid = fork()) < 0) {
- error("Couldn't detach (fork failed: %m)");
- die(1); /* or just return? */
- }
- if (pid != 0) {
- /* parent */
- notify(pidchange, pid);
- exit(0); /* parent dies */
- }
- setsid();
- chdir("/");
- close(0);
- close(1);
- close(2);
- detached = 1;
- if (log_default)
- log_to_fd = -1;
- /* update pid files if they have been written already */
- if (pidfilename[0])
- create_pidfile();
- if (linkpidfile[0])
- create_linkpidfile();
- slprintf(numbuf, sizeof(numbuf), "%d", getpid());
- script_setenv("PPPD_PID", numbuf, 1);
-}
-
-/*
- * reopen_log - (re)open our connection to syslog.
- */
-void
-reopen_log()
-{
-#ifdef ULTRIX
- openlog("pppd", LOG_PID);
-#else
- openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
- setlogmask(LOG_UPTO(LOG_INFO));
-#endif
-}
-
-/*
- * Create a file containing our process ID.
- */
-static void
-create_pidfile()
-{
- FILE *pidfile;
-
- slprintf(pidfilename, sizeof(pidfilename), "%s%s.pid",
- _PATH_VARRUN, ifname);
- if ((pidfile = fopen(pidfilename, "w")) != NULL) {
- fprintf(pidfile, "%d\n", getpid());
- (void) fclose(pidfile);
- } else {
- error("Failed to create pid file %s: %m", pidfilename);
- pidfilename[0] = 0;
- }
-}
-
-static void
-create_linkpidfile()
-{
- FILE *pidfile;
-
- if (linkname[0] == 0)
- return;
- script_setenv("LINKNAME", linkname, 1);
- slprintf(linkpidfile, sizeof(linkpidfile), "%sppp-%s.pid",
- _PATH_VARRUN, linkname);
- if ((pidfile = fopen(linkpidfile, "w")) != NULL) {
- fprintf(pidfile, "%d\n", getpid());
- if (ifname[0])
- fprintf(pidfile, "%s\n", ifname);
- (void) fclose(pidfile);
- } else {
- error("Failed to create pid file %s: %m", linkpidfile);
- linkpidfile[0] = 0;
- }
-}
-
-/*
- * holdoff_end - called via a timeout when the holdoff period ends.
- */
-static void
-holdoff_end(arg)
- void *arg;
-{
- new_phase(PHASE_DORMANT);
-}
-
-/* List of protocol names, to make our messages a little more informative. */
-struct protocol_list {
- u_short proto;
- const char *name;
-} protocol_list[] = {
- { 0x21, "IP" },
- { 0x23, "OSI Network Layer" },
- { 0x25, "Xerox NS IDP" },
- { 0x27, "DECnet Phase IV" },
- { 0x29, "Appletalk" },
- { 0x2b, "Novell IPX" },
- { 0x2d, "VJ compressed TCP/IP" },
- { 0x2f, "VJ uncompressed TCP/IP" },
- { 0x31, "Bridging PDU" },
- { 0x33, "Stream Protocol ST-II" },
- { 0x35, "Banyan Vines" },
- { 0x39, "AppleTalk EDDP" },
- { 0x3b, "AppleTalk SmartBuffered" },
- { 0x3d, "Multi-Link" },
- { 0x3f, "NETBIOS Framing" },
- { 0x41, "Cisco Systems" },
- { 0x43, "Ascom Timeplex" },
- { 0x45, "Fujitsu Link Backup and Load Balancing (LBLB)" },
- { 0x47, "DCA Remote Lan" },
- { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" },
- { 0x4b, "SNA over 802.2" },
- { 0x4d, "SNA" },
- { 0x4f, "IP6 Header Compression" },
- { 0x6f, "Stampede Bridging" },
- { 0xfb, "single-link compression" },
- { 0xfd, "1st choice compression" },
- { 0x0201, "802.1d Hello Packets" },
- { 0x0203, "IBM Source Routing BPDU" },
- { 0x0205, "DEC LANBridge100 Spanning Tree" },
- { 0x0231, "Luxcom" },
- { 0x0233, "Sigma Network Systems" },
- { 0x8021, "Internet Protocol Control Protocol" },
- { 0x8023, "OSI Network Layer Control Protocol" },
- { 0x8025, "Xerox NS IDP Control Protocol" },
- { 0x8027, "DECnet Phase IV Control Protocol" },
- { 0x8029, "Appletalk Control Protocol" },
- { 0x802b, "Novell IPX Control Protocol" },
- { 0x8031, "Bridging NCP" },
- { 0x8033, "Stream Protocol Control Protocol" },
- { 0x8035, "Banyan Vines Control Protocol" },
- { 0x803d, "Multi-Link Control Protocol" },
- { 0x803f, "NETBIOS Framing Control Protocol" },
- { 0x8041, "Cisco Systems Control Protocol" },
- { 0x8043, "Ascom Timeplex" },
- { 0x8045, "Fujitsu LBLB Control Protocol" },
- { 0x8047, "DCA Remote Lan Network Control Protocol (RLNCP)" },
- { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" },
- { 0x804b, "SNA over 802.2 Control Protocol" },
- { 0x804d, "SNA Control Protocol" },
- { 0x804f, "IP6 Header Compression Control Protocol" },
- { 0x006f, "Stampede Bridging Control Protocol" },
- { 0x80fb, "Single Link Compression Control Protocol" },
- { 0x80fd, "Compression Control Protocol" },
- { 0xc021, "Link Control Protocol" },
- { 0xc023, "Password Authentication Protocol" },
- { 0xc025, "Link Quality Report" },
- { 0xc027, "Shiva Password Authentication Protocol" },
- { 0xc029, "CallBack Control Protocol (CBCP)" },
- { 0xc081, "Container Control Protocol" },
- { 0xc223, "Challenge Handshake Authentication Protocol" },
- { 0xc281, "Proprietary Authentication Protocol" },
- { 0, NULL },
-};
-
-/*
- * protocol_name - find a name for a PPP protocol.
- */
-const char *
-protocol_name(proto)
- int proto;
-{
- struct protocol_list *lp;
-
- for (lp = protocol_list; lp->proto != 0; ++lp)
- if (proto == lp->proto)
- return lp->name;
- return NULL;
-}
-
-/*
- * get_input - called when incoming data is available.
- */
-static void
-get_input()
-{
- int len, i;
- u_char *p;
- u_short protocol;
- struct protent *protp;
-
- p = inpacket_buf; /* point to beginning of packet buffer */
-
- len = read_packet(inpacket_buf);
- if (len < 0)
- return;
-
- if (len == 0) {
- notice("Modem hangup");
- hungup = 1;
- status = EXIT_HANGUP;
- lcp_lowerdown(0); /* serial link is no longer available */
- link_terminated(0);
- return;
- }
-
- if (debug /*&& (debugflags & DBG_INPACKET)*/)
- dbglog("rcvd %P", p, len);
-
- if (len < PPP_HDRLEN) {
- MAINDEBUG(("io(): Received short packet."));
- return;
- }
-
- p += 2; /* Skip address and control */
- GETSHORT(protocol, p);
- len -= PPP_HDRLEN;
-
- /*
- * Toss all non-LCP packets unless LCP is OPEN.
- */
- if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) {
- MAINDEBUG(("get_input: Received non-LCP packet when LCP not open."));
- return;
- }
-
- /*
- * Until we get past the authentication phase, toss all packets
- * except LCP, LQR and authentication packets.
- */
- if (phase <= PHASE_AUTHENTICATE
- && !(protocol == PPP_LCP || protocol == PPP_LQR
- || protocol == PPP_PAP || protocol == PPP_CHAP)) {
- MAINDEBUG(("get_input: discarding proto 0x%x in phase %d",
- protocol, phase));
- return;
- }
-
- /*
- * Upcall the proper protocol input routine.
- */
- for (i = 0; (protp = protocols[i]) != NULL; ++i) {
- if (protp->protocol == protocol && protp->enabled_flag) {
- (*protp->input)(0, p, len);
- return;
- }
- if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag
- && protp->datainput != NULL) {
- (*protp->datainput)(0, p, len);
- return;
- }
- }
-
- if (debug) {
- const char *pname = protocol_name(protocol);
- if (pname != NULL)
- warn("Unsupported protocol '%s' (0x%x) received", pname, protocol);
- else
- warn("Unsupported protocol 0x%x received", protocol);
- }
- lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN);
-}
-
-/*
- * new_phase - signal the start of a new phase of pppd's operation.
- */
-void
-new_phase(p)
- int p;
-{
- phase = p;
- if (new_phase_hook)
- (*new_phase_hook)(p);
- notify(phasechange, p);
-}
-
-/*
- * die - clean up state and exit with the specified status.
- */
-void
-die(status)
- int status;
-{
- cleanup();
- notify(exitnotify, status);
- syslog(LOG_INFO, "Exit.");
- exit(status);
-}
-
-/*
- * cleanup - restore anything which needs to be restored before we exit
- */
-/* ARGSUSED */
-static void
-cleanup()
-{
- sys_cleanup();
-
- if (fd_ppp >= 0)
- the_channel->disestablish_ppp(devfd);
- if (the_channel->cleanup)
- (*the_channel->cleanup)();
-
- if (pidfilename[0] != 0 && unlink(pidfilename) < 0 && errno != ENOENT)
- warn("unable to delete pid file %s: %m", pidfilename);
- pidfilename[0] = 0;
- if (linkpidfile[0] != 0 && unlink(linkpidfile) < 0 && errno != ENOENT)
- warn("unable to delete pid file %s: %m", linkpidfile);
- linkpidfile[0] = 0;
-
- if (pppdb != NULL)
- cleanup_db();
-}
-
-/*
- * update_link_stats - get stats at link termination.
- */
-void
-update_link_stats(u)
- int u;
-{
- struct timeval now;
- char numbuf[32];
-
- if (!get_ppp_stats(u, &link_stats)
- || gettimeofday(&now, NULL) < 0)
- return;
- link_connect_time = now.tv_sec - start_time.tv_sec;
- link_stats_valid = 1;
-
- slprintf(numbuf, sizeof(numbuf), "%d", link_connect_time);
- script_setenv("CONNECT_TIME", numbuf, 0);
- slprintf(numbuf, sizeof(numbuf), "%d", link_stats.bytes_out);
- script_setenv("BYTES_SENT", numbuf, 0);
- slprintf(numbuf, sizeof(numbuf), "%d", link_stats.bytes_in);
- script_setenv("BYTES_RCVD", numbuf, 0);
-}
-
-
-struct callout {
- struct timeval c_time; /* time at which to call routine */
- void *c_arg; /* argument to routine */
- void (*c_func) __P((void *)); /* routine */
- struct callout *c_next;
-};
-
-static struct callout *callout = NULL; /* Callout list */
-static struct timeval timenow; /* Current time */
-
-/*
- * timeout - Schedule a timeout.
- *
- * Note that this timeout takes the number of milliseconds, NOT hz (as in
- * the kernel).
- */
-void
-timeout(func, arg, secs, usecs)
- void (*func) __P((void *));
- void *arg;
- int secs, usecs;
-{
- struct callout *newp, *p, **pp;
-
- MAINDEBUG(("Timeout %p:%p in %d.%03d seconds.", func, arg,
- time / 1000, time % 1000));
-
- /*
- * Allocate timeout.
- */
- if ((newp = (struct callout *) malloc(sizeof(struct callout))) == NULL)
- fatal("Out of memory in timeout()!");
- newp->c_arg = arg;
- newp->c_func = func;
- gettimeofday(&timenow, NULL);
- newp->c_time.tv_sec = timenow.tv_sec + secs;
- newp->c_time.tv_usec = timenow.tv_usec + usecs;
- if (newp->c_time.tv_usec >= 1000000) {
- newp->c_time.tv_sec += newp->c_time.tv_usec / 1000000;
- newp->c_time.tv_usec %= 1000000;
- }
-
- /*
- * Find correct place and link it in.
- */
- for (pp = &callout; (p = *pp); pp = &p->c_next)
- if (newp->c_time.tv_sec < p->c_time.tv_sec
- || (newp->c_time.tv_sec == p->c_time.tv_sec
- && newp->c_time.tv_usec < p->c_time.tv_usec))
- break;
- newp->c_next = p;
- *pp = newp;
-}
-
-
-/*
- * untimeout - Unschedule a timeout.
- */
-void
-untimeout(func, arg)
- void (*func) __P((void *));
- void *arg;
-{
- struct callout **copp, *freep;
-
- MAINDEBUG(("Untimeout %p:%p.", func, arg));
-
- /*
- * Find first matching timeout and remove it from the list.
- */
- for (copp = &callout; (freep = *copp); copp = &freep->c_next)
- if (freep->c_func == func && freep->c_arg == arg) {
- *copp = freep->c_next;
- free((char *) freep);
- break;
- }
-}
-
-
-/*
- * calltimeout - Call any timeout routines which are now due.
- */
-static void
-calltimeout()
-{
- struct callout *p;
-
- while (callout != NULL) {
- p = callout;
-
- if (gettimeofday(&timenow, NULL) < 0)
- fatal("Failed to get time of day: %m");
- if (!(p->c_time.tv_sec < timenow.tv_sec
- || (p->c_time.tv_sec == timenow.tv_sec
- && p->c_time.tv_usec <= timenow.tv_usec)))
- break; /* no, it's not time yet */
-
- callout = p->c_next;
- (*p->c_func)(p->c_arg);
-
- free((char *) p);
- }
-}
-
-
-/*
- * timeleft - return the length of time until the next timeout is due.
- */
-static struct timeval *
-timeleft(tvp)
- struct timeval *tvp;
-{
- if (callout == NULL)
- return NULL;
-
- gettimeofday(&timenow, NULL);
- tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec;
- tvp->tv_usec = callout->c_time.tv_usec - timenow.tv_usec;
- if (tvp->tv_usec < 0) {
- tvp->tv_usec += 1000000;
- tvp->tv_sec -= 1;
- }
- if (tvp->tv_sec < 0)
- tvp->tv_sec = tvp->tv_usec = 0;
-
- return tvp;
-}
-
-
-/*
- * kill_my_pg - send a signal to our process group, and ignore it ourselves.
- */
-static void
-kill_my_pg(sig)
- int sig;
-{
- struct sigaction act, oldact;
-
- act.sa_handler = SIG_IGN;
- act.sa_flags = 0;
- kill(0, sig);
- sigaction(sig, &act, &oldact);
- sigaction(sig, &oldact, NULL);
-}
-
-
-/*
- * hup - Catch SIGHUP signal.
- *
- * Indicates that the physical layer has been disconnected.
- * We don't rely on this indication; if the user has sent this
- * signal, we just take the link down.
- */
-static void
-hup(sig)
- int sig;
-{
- info("Hangup (SIGHUP)");
- got_sighup = 1;
- if (conn_running)
- /* Send the signal to the [dis]connector process(es) also */
- kill_my_pg(sig);
- notify(sigreceived, sig);
- if (waiting)
- siglongjmp(sigjmp, 1);
-}
-
-
-/*
- * term - Catch SIGTERM signal and SIGINT signal (^C/del).
- *
- * Indicates that we should initiate a graceful disconnect and exit.
- */
-/*ARGSUSED*/
-static void
-term(sig)
- int sig;
-{
- info("Terminating on signal %d.", sig);
- got_sigterm = 1;
- if (conn_running)
- /* Send the signal to the [dis]connector process(es) also */
- kill_my_pg(sig);
- notify(sigreceived, sig);
- if (waiting)
- siglongjmp(sigjmp, 1);
-}
-
-
-/*
- * chld - Catch SIGCHLD signal.
- * Sets a flag so we will call reap_kids in the mainline.
- */
-static void
-chld(sig)
- int sig;
-{
- got_sigchld = 1;
- if (waiting)
- siglongjmp(sigjmp, 1);
-}
-
-
-/*
- * toggle_debug - Catch SIGUSR1 signal.
- *
- * Toggle debug flag.
- */
-/*ARGSUSED*/
-static void
-toggle_debug(sig)
- int sig;
-{
- debug = !debug;
- if (debug) {
- setlogmask(LOG_UPTO(LOG_DEBUG));
- } else {
- setlogmask(LOG_UPTO(LOG_WARNING));
- }
-}
-
-
-/*
- * open_ccp - Catch SIGUSR2 signal.
- *
- * Try to (re)negotiate compression.
- */
-/*ARGSUSED*/
-static void
-open_ccp(sig)
- int sig;
-{
- got_sigusr2 = 1;
- if (waiting)
- siglongjmp(sigjmp, 1);
-}
-
-
-/*
- * bad_signal - We've caught a fatal signal. Clean up state and exit.
- */
-static void
-bad_signal(sig)
- int sig;
-{
- static int crashed = 0;
-
- if (crashed)
- _exit(127);
- crashed = 1;
- error("Fatal signal %d", sig);
- if (conn_running)
- kill_my_pg(SIGTERM);
- notify(sigreceived, sig);
- die(127);
-}
-
-
-/*
- * device_script - run a program to talk to the specified fds
- * (e.g. to run the connector or disconnector script).
- * stderr gets connected to the log fd or to the _PATH_CONNERRS file.
- */
-int
-device_script(program, in, out, dont_wait)
- char *program;
- int in, out;
- int dont_wait;
-{
- int pid, fd;
- int status = -1;
- int errfd;
-
- ++conn_running;
- pid = fork();
-
- if (pid < 0) {
- --conn_running;
- error("Failed to create child process: %m");
- return -1;
- }
-
- if (pid != 0) {
- if (dont_wait) {
- record_child(pid, program, NULL, NULL);
- status = 0;
- } else {
- while (waitpid(pid, &status, 0) < 0) {
- if (errno == EINTR)
- continue;
- fatal("error waiting for (dis)connection process: %m");
- }
- --conn_running;
- }
- return (status == 0 ? 0 : -1);
- }
-
- /* here we are executing in the child */
- /* make sure fds 0, 1, 2 are occupied */
- while ((fd = dup(in)) >= 0) {
- if (fd > 2) {
- close(fd);
- break;
- }
- }
-
- /* dup in and out to fds > 2 */
- in = dup(in);
- out = dup(out);
- if (log_to_fd >= 0) {
- errfd = dup(log_to_fd);
- } else {
- errfd = open(_PATH_CONNERRS, O_WRONLY | O_APPEND | O_CREAT, 0600);
- }
-
- /* close fds 0 - 2 and any others we can think of */
- close(0);
- close(1);
- close(2);
- sys_close();
- if (the_channel->close)
- (*the_channel->close)();
- closelog();
-
- /* dup the in, out, err fds to 0, 1, 2 */
- dup2(in, 0);
- close(in);
- dup2(out, 1);
- close(out);
- if (errfd >= 0) {
- dup2(errfd, 2);
- close(errfd);
- }
-
- setuid(uid);
- if (getuid() != uid) {
- error("setuid failed");
- exit(1);
- }
- setgid(getgid());
- {
- int argc = 0;
- char * argv[500];
- char * ptr = program;
- while (ptr != NULL) {
- argv[argc] = ptr;
- argc++;
- ptr = strchr(ptr, ' ');
- if (ptr) {
- ptr[0] = '\0';
- ptr++;
- }
- }
- argv[argc] = NULL;
- execv(argv[0], argv);
- error("could not exec %s: %m", program);
- exit(99);
- }
- /* NOTREACHED */
-}
-
-
-/*
- * run-program - execute a program with given arguments,
- * but don't wait for it.
- * If the program can't be executed, logs an error unless
- * must_exist is 0 and the program file doesn't exist.
- * Returns -1 if it couldn't fork, 0 if the file doesn't exist
- * or isn't an executable plain file, or the process ID of the child.
- * If done != NULL, (*done)(arg) will be called later (within
- * reap_kids) iff the return value is > 0.
- */
-pid_t
-run_program(prog, args, must_exist, done, arg)
- char *prog;
- char **args;
- int must_exist;
- void (*done) __P((void *));
- void *arg;
-{
- int pid;
- struct stat sbuf;
-
- /*
- * First check if the file exists and is executable.
- * We don't use access() because that would use the
- * real user-id, which might not be root, and the script
- * might be accessible only to root.
- */
- errno = EINVAL;
- if (stat(prog, &sbuf) < 0 || !S_ISREG(sbuf.st_mode)
- || (sbuf.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) == 0) {
- if (must_exist || errno != ENOENT)
- warn("Can't execute %s: %m", prog);
- return 0;
- }
-
- pid = fork();
- if (pid == -1) {
- error("Failed to create child process for %s: %m", prog);
- return -1;
- }
- if (pid == 0) {
- int new_fd;
-
- /* Leave the current location */
- (void) setsid(); /* No controlling tty. */
- (void) umask (S_IRWXG|S_IRWXO);
- (void) chdir ("/"); /* no current directory. */
- setuid(0); /* set real UID = root */
- setgid(getegid());
-
- /* Ensure that nothing of our device environment is inherited. */
- sys_close();
- closelog();
- close (0);
- close (1);
- close (2);
- if (the_channel->close)
- (*the_channel->close)();
-
- /* Don't pass handles to the PPP device, even by accident. */
- new_fd = open (_PATH_DEVNULL, O_RDWR);
- if (new_fd >= 0) {
- if (new_fd != 0) {
- dup2 (new_fd, 0); /* stdin <- /dev/null */
- close (new_fd);
- }
- dup2 (0, 1); /* stdout -> /dev/null */
- dup2 (0, 2); /* stderr -> /dev/null */
- }
-
-#ifdef BSD
- /* Force the priority back to zero if pppd is running higher. */
- if (setpriority (PRIO_PROCESS, 0, 0) < 0)
- warn("can't reset priority to 0: %m");
-#endif
-
- /* SysV recommends a second fork at this point. */
-
- /* run the program */
- execve(prog, args, script_env);
- if (must_exist || errno != ENOENT) {
- /* have to reopen the log, there's nowhere else
- for the message to go. */
- reopen_log();
- syslog(LOG_ERR, "Can't execute %s: %m", prog);
- closelog();
- }
- _exit(-1);
- }
-
- if (debug)
- dbglog("Script %s started (pid %d)", prog, pid);
- record_child(pid, prog, done, arg);
-
- return pid;
-}
-
-
-/*
- * record_child - add a child process to the list for reap_kids
- * to use.
- */
-void
-record_child(pid, prog, done, arg)
- int pid;
- char *prog;
- void (*done) __P((void *));
- void *arg;
-{
- struct subprocess *chp;
-
- ++n_children;
-
- chp = (struct subprocess *) malloc(sizeof(struct subprocess));
- if (chp == NULL) {
- warn("losing track of %s process", prog);
- } else {
- chp->pid = pid;
- chp->prog = prog;
- chp->done = done;
- chp->arg = arg;
- chp->next = children;
- children = chp;
- }
-}
-
-
-/*
- * reap_kids - get status from any dead child processes,
- * and log a message for abnormal terminations.
- */
-static int
-reap_kids(waitfor)
- int waitfor;
-{
- int pid, status;
- struct subprocess *chp, **prevp;
-
- if (n_children == 0)
- return 0;
- while ((pid = waitpid(-1, &status, (waitfor? 0: WNOHANG))) != -1
- && pid != 0) {
- for (prevp = &children; (chp = *prevp) != NULL; prevp = &chp->next) {
- if (chp->pid == pid) {
- --n_children;
- *prevp = chp->next;
- break;
- }
- }
- if (WIFSIGNALED(status)) {
- warn("Child process %s (pid %d) terminated with signal %d",
- (chp? chp->prog: "??"), pid, WTERMSIG(status));
- } else if (debug)
- dbglog("Script %s finished (pid %d), status = 0x%x",
- (chp? chp->prog: "??"), pid, status);
- if (chp && chp->done)
- (*chp->done)(chp->arg);
- if (chp)
- free(chp);
- }
- if (pid == -1) {
- if (errno == ECHILD)
- return -1;
- if (errno != EINTR)
- error("Error waiting for child process: %m");
- }
- return 0;
-}
-
-/*
- * add_notifier - add a new function to be called when something happens.
- */
-void
-add_notifier(notif, func, arg)
- struct notifier **notif;
- notify_func func;
- void *arg;
-{
- struct notifier *np;
-
- np = malloc(sizeof(struct notifier));
- if (np == 0)
- novm("notifier struct");
- np->next = *notif;
- np->func = func;
- np->arg = arg;
- *notif = np;
-}
-
-/*
- * remove_notifier - remove a function from the list of things to
- * be called when something happens.
- */
-void
-remove_notifier(notif, func, arg)
- struct notifier **notif;
- notify_func func;
- void *arg;
-{
- struct notifier *np;
-
- for (; (np = *notif) != 0; notif = &np->next) {
- if (np->func == func && np->arg == arg) {
- *notif = np->next;
- free(np);
- break;
- }
- }
-}
-
-/*
- * notify - call a set of functions registered with add_notify.
- */
-void
-notify(notif, val)
- struct notifier *notif;
- int val;
-{
- struct notifier *np;
-
- while ((np = notif) != 0) {
- notif = np->next;
- (*np->func)(np->arg, val);
- }
-}
-
-/*
- * novm - log an error message saying we ran out of memory, and die.
- */
-void
-novm(msg)
- char *msg;
-{
- fatal("Virtual memory exhausted allocating %s\n", msg);
-}
-
-/*
- * script_setenv - set an environment variable value to be used
- * for scripts that we run (e.g. ip-up, auth-up, etc.)
- */
-void
-script_setenv(var, value, iskey)
- char *var, *value;
- int iskey;
-{
- size_t varl = strlen(var);
- size_t vl = varl + strlen(value) + 2;
- int i;
- char *p, *newstring;
-
- newstring = (char *) malloc(vl+1);
- if (newstring == 0)
- return;
- *newstring++ = iskey;
- slprintf(newstring, vl, "%s=%s", var, value);
-
- /* check if this variable is already set */
- if (script_env != 0) {
- for (i = 0; (p = script_env[i]) != 0; ++i) {
- if (strncmp(p, var, varl) == 0 && p[varl] == '=') {
- if (p[-1] && pppdb != NULL)
- delete_db_key(p);
- free(p-1);
- script_env[i] = newstring;
- if (iskey && pppdb != NULL)
- add_db_key(newstring);
- update_db_entry();
- return;
- }
- }
- } else {
- /* no space allocated for script env. ptrs. yet */
- i = 0;
- script_env = (char **) malloc(16 * sizeof(char *));
- if (script_env == 0)
- return;
- s_env_nalloc = 16;
- }
-
- /* reallocate script_env with more space if needed */
- if (i + 1 >= s_env_nalloc) {
- int new_n = i + 17;
- char **newenv = (char **) realloc((void *)script_env,
- new_n * sizeof(char *));
- if (newenv == 0)
- return;
- script_env = newenv;
- s_env_nalloc = new_n;
- }
-
- script_env[i] = newstring;
- script_env[i+1] = 0;
-
- if (pppdb != NULL) {
- if (iskey)
- add_db_key(newstring);
- update_db_entry();
- }
-}
-
-/*
- * script_unsetenv - remove a variable from the environment
- * for scripts.
- */
-void
-script_unsetenv(var)
- char *var;
-{
- int vl = strlen(var);
- int i;
- char *p;
-
- if (script_env == 0)
- return;
- for (i = 0; (p = script_env[i]) != 0; ++i) {
- if (strncmp(p, var, vl) == 0 && p[vl] == '=') {
- if (p[-1] && pppdb != NULL)
- delete_db_key(p);
- free(p-1);
- while ((script_env[i] = script_env[i+1]) != 0)
- ++i;
- break;
- }
- }
- if (pppdb != NULL)
- update_db_entry();
-}
-
-/*
- * update_db_entry - update our entry in the database.
- */
-static void
-update_db_entry()
-{
- TDB_DATA key, dbuf;
- int vlen, i;
- char *p, *q, *vbuf;
-
- if (script_env == NULL)
- return;
- vlen = 0;
- for (i = 0; (p = script_env[i]) != 0; ++i)
- vlen += strlen(p) + 1;
- vbuf = malloc(vlen);
- if (vbuf == 0)
- novm("database entry");
- q = vbuf;
- for (i = 0; (p = script_env[i]) != 0; ++i)
- q += slprintf(q, vbuf + vlen - q, "%s;", p);
-
- key.dptr = db_key;
- key.dsize = strlen(db_key);
- dbuf.dptr = vbuf;
- dbuf.dsize = vlen;
- if (tdb_store(pppdb, key, dbuf, TDB_REPLACE))
- error("tdb_store failed: %s", tdb_error(pppdb));
-
-}
-
-/*
- * add_db_key - add a key that we can use to look up our database entry.
- */
-static void
-add_db_key(str)
- const char *str;
-{
- TDB_DATA key, dbuf;
-
- key.dptr = (char *) str;
- key.dsize = strlen(str);
- dbuf.dptr = db_key;
- dbuf.dsize = strlen(db_key);
- if (tdb_store(pppdb, key, dbuf, TDB_REPLACE))
- error("tdb_store key failed: %s", tdb_error(pppdb));
-}
-
-/*
- * delete_db_key - delete a key for looking up our database entry.
- */
-static void
-delete_db_key(str)
- const char *str;
-{
- TDB_DATA key;
-
- key.dptr = (char *) str;
- key.dsize = strlen(str);
- tdb_delete(pppdb, key);
-}
-
-/*
- * cleanup_db - delete all the entries we put in the database.
- */
-static void
-cleanup_db()
-{
- TDB_DATA key;
- int i;
- char *p;
-
- key.dptr = db_key;
- key.dsize = strlen(db_key);
- tdb_delete(pppdb, key);
- for (i = 0; (p = script_env[i]) != 0; ++i)
- if (p[-1])
- delete_db_key(p);
-}
diff --git a/mdk-stage1/ppp/pppd/md4.c b/mdk-stage1/ppp/pppd/md4.c
deleted file mode 100644
index cda9f943d..000000000
--- a/mdk-stage1/ppp/pppd/md4.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
-** ********************************************************************
-** md4.c -- Implementation of MD4 Message Digest Algorithm **
-** Updated: 2/16/90 by Ronald L. Rivest **
-** (C) 1990 RSA Data Security, Inc. **
-** ********************************************************************
-*/
-
-/*
-** To use MD4:
-** -- Include md4.h in your program
-** -- Declare an MDstruct MD to hold the state of the digest
-** computation.
-** -- Initialize MD using MDbegin(&MD)
-** -- For each full block (64 bytes) X you wish to process, call
-** MD4Update(&MD,X,512)
-** (512 is the number of bits in a full block.)
-** -- For the last block (less than 64 bytes) you wish to process,
-** MD4Update(&MD,X,n)
-** where n is the number of bits in the partial block. A partial
-** block terminates the computation, so every MD computation
-** should terminate by processing a partial block, even if it
-** has n = 0.
-** -- The message digest is available in MD.buffer[0] ...
-** MD.buffer[3]. (Least-significant byte of each word
-** should be output first.)
-** -- You can print out the digest using MDprint(&MD)
-*/
-
-/* Implementation notes:
-** This implementation assumes that ints are 32-bit quantities.
-*/
-
-#define TRUE 1
-#define FALSE 0
-
-/* Compile-time includes
-*/
-#include <stdio.h>
-#include "md4.h"
-#include "pppd.h"
-
-/* Compile-time declarations of MD4 "magic constants".
-*/
-#define I0 0x67452301 /* Initial values for MD buffer */
-#define I1 0xefcdab89
-#define I2 0x98badcfe
-#define I3 0x10325476
-#define C2 013240474631 /* round 2 constant = sqrt(2) in octal */
-#define C3 015666365641 /* round 3 constant = sqrt(3) in octal */
-/* C2 and C3 are from Knuth, The Art of Programming, Volume 2
-** (Seminumerical Algorithms), Second Edition (1981), Addison-Wesley.
-** Table 2, page 660.
-*/
-
-#define fs1 3 /* round 1 shift amounts */
-#define fs2 7
-#define fs3 11
-#define fs4 19
-#define gs1 3 /* round 2 shift amounts */
-#define gs2 5
-#define gs3 9
-#define gs4 13
-#define hs1 3 /* round 3 shift amounts */
-#define hs2 9
-#define hs3 11
-#define hs4 15
-
-/* Compile-time macro declarations for MD4.
-** Note: The "rot" operator uses the variable "tmp".
-** It assumes tmp is declared as unsigned int, so that the >>
-** operator will shift in zeros rather than extending the sign bit.
-*/
-#define f(X,Y,Z) ((X&Y) | ((~X)&Z))
-#define g(X,Y,Z) ((X&Y) | (X&Z) | (Y&Z))
-#define h(X,Y,Z) (X^Y^Z)
-#define rot(X,S) (tmp=X,(tmp<<S) | (tmp>>(32-S)))
-#define ff(A,B,C,D,i,s) A = rot((A + f(B,C,D) + X[i]),s)
-#define gg(A,B,C,D,i,s) A = rot((A + g(B,C,D) + X[i] + C2),s)
-#define hh(A,B,C,D,i,s) A = rot((A + h(B,C,D) + X[i] + C3),s)
-
-/* MD4print(MDp)
-** Print message digest buffer MDp as 32 hexadecimal digits.
-** Order is from low-order byte of buffer[0] to high-order byte of
-** buffer[3].
-** Each byte is printed with high-order hexadecimal digit first.
-** This is a user-callable routine.
-*/
-void
-MD4Print(MDp)
-MD4_CTX *MDp;
-{
- int i,j;
- for (i=0;i<4;i++)
- for (j=0;j<32;j=j+8)
- printf("%02x",(MDp->buffer[i]>>j) & 0xFF);
-}
-
-/* MD4Init(MDp)
-** Initialize message digest buffer MDp.
-** This is a user-callable routine.
-*/
-void
-MD4Init(MDp)
-MD4_CTX *MDp;
-{
- int i;
- MDp->buffer[0] = I0;
- MDp->buffer[1] = I1;
- MDp->buffer[2] = I2;
- MDp->buffer[3] = I3;
- for (i=0;i<8;i++) MDp->count[i] = 0;
- MDp->done = 0;
-}
-
-/* MDblock(MDp,X)
-** Update message digest buffer MDp->buffer using 16-word data block X.
-** Assumes all 16 words of X are full of data.
-** Does not update MDp->count.
-** This routine is not user-callable.
-*/
-static void
-MDblock(MDp,Xb)
-MD4_CTX *MDp;
-unsigned char *Xb;
-{
- register unsigned int tmp, A, B, C, D;
- unsigned int X[16];
- int i;
-
- for (i = 0; i < 16; ++i) {
- X[i] = Xb[0] + (Xb[1] << 8) + (Xb[2] << 16) + (Xb[3] << 24);
- Xb += 4;
- }
-
- A = MDp->buffer[0];
- B = MDp->buffer[1];
- C = MDp->buffer[2];
- D = MDp->buffer[3];
- /* Update the message digest buffer */
- ff(A , B , C , D , 0 , fs1); /* Round 1 */
- ff(D , A , B , C , 1 , fs2);
- ff(C , D , A , B , 2 , fs3);
- ff(B , C , D , A , 3 , fs4);
- ff(A , B , C , D , 4 , fs1);
- ff(D , A , B , C , 5 , fs2);
- ff(C , D , A , B , 6 , fs3);
- ff(B , C , D , A , 7 , fs4);
- ff(A , B , C , D , 8 , fs1);
- ff(D , A , B , C , 9 , fs2);
- ff(C , D , A , B , 10 , fs3);
- ff(B , C , D , A , 11 , fs4);
- ff(A , B , C , D , 12 , fs1);
- ff(D , A , B , C , 13 , fs2);
- ff(C , D , A , B , 14 , fs3);
- ff(B , C , D , A , 15 , fs4);
- gg(A , B , C , D , 0 , gs1); /* Round 2 */
- gg(D , A , B , C , 4 , gs2);
- gg(C , D , A , B , 8 , gs3);
- gg(B , C , D , A , 12 , gs4);
- gg(A , B , C , D , 1 , gs1);
- gg(D , A , B , C , 5 , gs2);
- gg(C , D , A , B , 9 , gs3);
- gg(B , C , D , A , 13 , gs4);
- gg(A , B , C , D , 2 , gs1);
- gg(D , A , B , C , 6 , gs2);
- gg(C , D , A , B , 10 , gs3);
- gg(B , C , D , A , 14 , gs4);
- gg(A , B , C , D , 3 , gs1);
- gg(D , A , B , C , 7 , gs2);
- gg(C , D , A , B , 11 , gs3);
- gg(B , C , D , A , 15 , gs4);
- hh(A , B , C , D , 0 , hs1); /* Round 3 */
- hh(D , A , B , C , 8 , hs2);
- hh(C , D , A , B , 4 , hs3);
- hh(B , C , D , A , 12 , hs4);
- hh(A , B , C , D , 2 , hs1);
- hh(D , A , B , C , 10 , hs2);
- hh(C , D , A , B , 6 , hs3);
- hh(B , C , D , A , 14 , hs4);
- hh(A , B , C , D , 1 , hs1);
- hh(D , A , B , C , 9 , hs2);
- hh(C , D , A , B , 5 , hs3);
- hh(B , C , D , A , 13 , hs4);
- hh(A , B , C , D , 3 , hs1);
- hh(D , A , B , C , 11 , hs2);
- hh(C , D , A , B , 7 , hs3);
- hh(B , C , D , A , 15 , hs4);
- MDp->buffer[0] += A;
- MDp->buffer[1] += B;
- MDp->buffer[2] += C;
- MDp->buffer[3] += D;
-}
-
-/* MD4Update(MDp,X,count)
-** Input: X -- a pointer to an array of unsigned characters.
-** count -- the number of bits of X to use.
-** (if not a multiple of 8, uses high bits of last byte.)
-** Update MDp using the number of bits of X given by count.
-** This is the basic input routine for an MD4 user.
-** The routine completes the MD computation when count < 512, so
-** every MD computation should end with one call to MD4Update with a
-** count less than 512. A call with count 0 will be ignored if the
-** MD has already been terminated (done != 0), so an extra call with
-** count 0 can be given as a "courtesy close" to force termination
-** if desired.
-*/
-void
-MD4Update(MDp,X,count)
-MD4_CTX *MDp;
-unsigned char *X;
-unsigned int count;
-{
- unsigned int i, tmp, bit, byte, mask;
- unsigned char XX[64];
- unsigned char *p;
-
- /* return with no error if this is a courtesy close with count
- ** zero and MDp->done is true.
- */
- if (count == 0 && MDp->done) return;
- /* check to see if MD is already done and report error */
- if (MDp->done)
- { printf("\nError: MD4Update MD already done."); return; }
-
- /* Add count to MDp->count */
- tmp = count;
- p = MDp->count;
- while (tmp)
- { tmp += *p;
- *p++ = tmp;
- tmp = tmp >> 8;
- }
-
- /* Process data */
- if (count == 512)
- { /* Full block of data to handle */
- MDblock(MDp,X);
- }
- else if (count > 512) /* Check for count too large */
- {
- printf("\nError: MD4Update called with illegal count value %d.",
- count);
- return;
- }
- else /* partial block -- must be last block so finish up */
- {
- /* Find out how many bytes and residual bits there are */
- byte = count >> 3;
- bit = count & 7;
- /* Copy X into XX since we need to modify it */
- for (i=0;i<=byte;i++) XX[i] = X[i];
- for (i=byte+1;i<64;i++) XX[i] = 0;
- /* Add padding '1' bit and low-order zeros in last byte */
- mask = 1 << (7 - bit);
- XX[byte] = (XX[byte] | mask) & ~( mask - 1);
- /* If room for bit count, finish up with this block */
- if (byte <= 55)
- {
- for (i=0;i<8;i++) XX[56+i] = MDp->count[i];
- MDblock(MDp,XX);
- }
- else /* need to do two blocks to finish up */
- {
- MDblock(MDp,XX);
- for (i=0;i<56;i++) XX[i] = 0;
- for (i=0;i<8;i++) XX[56+i] = MDp->count[i];
- MDblock(MDp,XX);
- }
- /* Set flag saying we're done with MD computation */
- MDp->done = 1;
- }
-}
-
-/*
-** Finish up MD4 computation and return message digest.
-*/
-void
-MD4Final(buf, MD)
-unsigned char *buf;
-MD4_CTX *MD;
-{
- int i, j;
- unsigned int w;
-
- MD4Update(MD, NULL, 0);
- for (i = 0; i < 4; ++i) {
- w = MD->buffer[i];
- for (j = 0; j < 4; ++j) {
- *buf++ = w;
- w >>= 8;
- }
- }
-}
-
-/*
-** End of md4.c
-****************************(cut)***********************************/
diff --git a/mdk-stage1/ppp/pppd/md4.h b/mdk-stage1/ppp/pppd/md4.h
deleted file mode 100644
index 80e8f9a2a..000000000
--- a/mdk-stage1/ppp/pppd/md4.h
+++ /dev/null
@@ -1,64 +0,0 @@
-
-/*
-** ********************************************************************
-** md4.h -- Header file for implementation of **
-** MD4 Message Digest Algorithm **
-** Updated: 2/13/90 by Ronald L. Rivest **
-** (C) 1990 RSA Data Security, Inc. **
-** ********************************************************************
-*/
-
-#ifndef __P
-# if defined(__STDC__) || defined(__GNUC__)
-# define __P(x) x
-# else
-# define __P(x) ()
-# endif
-#endif
-
-
-/* MDstruct is the data structure for a message digest computation.
-*/
-typedef struct {
- unsigned int buffer[4]; /* Holds 4-word result of MD computation */
- unsigned char count[8]; /* Number of bits processed so far */
- unsigned int done; /* Nonzero means MD computation finished */
-} MD4_CTX;
-
-/* MD4Init(MD4_CTX *)
-** Initialize the MD4_CTX prepatory to doing a message digest
-** computation.
-*/
-extern void MD4Init __P((MD4_CTX *MD));
-
-/* MD4Update(MD,X,count)
-** Input: X -- a pointer to an array of unsigned characters.
-** count -- the number of bits of X to use (an unsigned int).
-** Updates MD using the first "count" bits of X.
-** The array pointed to by X is not modified.
-** If count is not a multiple of 8, MD4Update uses high bits of
-** last byte.
-** This is the basic input routine for a user.
-** The routine terminates the MD computation when count < 512, so
-** every MD computation should end with one call to MD4Update with a
-** count less than 512. Zero is OK for a count.
-*/
-extern void MD4Update __P((MD4_CTX *MD, unsigned char *X, unsigned int count));
-
-/* MD4Print(MD)
-** Prints message digest buffer MD as 32 hexadecimal digits.
-** Order is from low-order byte of buffer[0] to high-order byte
-** of buffer[3].
-** Each byte is printed with high-order hexadecimal digit first.
-*/
-extern void MD4Print __P((MD4_CTX *));
-
-/* MD4Final(buf, MD)
-** Returns message digest from MD and terminates the message
-** digest computation.
-*/
-extern void MD4Final __P((unsigned char *, MD4_CTX *));
-
-/*
-** End of md4.h
-****************************(cut)***********************************/
diff --git a/mdk-stage1/ppp/pppd/md5.c b/mdk-stage1/ppp/pppd/md5.c
deleted file mode 100644
index 0b8de3aae..000000000
--- a/mdk-stage1/ppp/pppd/md5.c
+++ /dev/null
@@ -1,309 +0,0 @@
-
-
-/*
- ***********************************************************************
- ** md5.c -- the source code for MD5 routines **
- ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
- ** Created: 2/17/90 RLR **
- ** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. **
- ***********************************************************************
- */
-
-/*
- ***********************************************************************
- ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
- ** **
- ** License to copy and use this software is granted provided that **
- ** it is identified as the "RSA Data Security, Inc. MD5 Message- **
- ** Digest Algorithm" in all material mentioning or referencing this **
- ** software or this function. **
- ** **