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
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
|
/* nmcli - command-line tool to control NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright 2010 - 2018 Red Hat, Inc.
*/
#include "nm-default.h"
#include "nm-meta-setting-desc.h"
#include <stdlib.h>
#include <arpa/inet.h>
#include "nm-common-macros.h"
#include "nm-utils/nm-enum-utils.h"
#include "nm-utils/nm-secret-utils.h"
#include "nm-libnm-core-utils.h"
#include "nm-vpn-helpers.h"
#include "nm-client-utils.h"
#include "nm-meta-setting-access.h"
/*****************************************************************************/
static char *secret_flags_to_string (guint32 flags, NMMetaAccessorGetType get_type);
#define ALL_SECRET_FLAGS \
(NM_SETTING_SECRET_FLAG_NONE | \
NM_SETTING_SECRET_FLAG_AGENT_OWNED | \
NM_SETTING_SECRET_FLAG_NOT_SAVED | \
NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
/*****************************************************************************/
static GType
_gobject_property_get_gtype (GObject *gobject, const char *property_name)
{
GParamSpec *param_spec;
param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (gobject), property_name);
if (param_spec)
return param_spec->value_type;
g_return_val_if_reached (G_TYPE_INVALID);
}
static GType
_gtype_property_get_gtype (GType gtype, const char *property_name)
{
/* given @gtype, a type for a GObject, lookup the property @property_name
* and return its value_type. */
if (G_TYPE_IS_CLASSED (gtype)) {
GParamSpec *param_spec;
nm_auto_unref_gtypeclass GTypeClass *gtypeclass = g_type_class_ref (gtype);
if (G_IS_OBJECT_CLASS (gtypeclass)) {
param_spec = g_object_class_find_property (G_OBJECT_CLASS (gtypeclass), property_name);
if (param_spec)
return param_spec->value_type;
}
}
g_return_val_if_reached (G_TYPE_INVALID);
}
/*****************************************************************************/
static int
_int64_cmp_desc (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
NM_CMP_DIRECT (*((const gint64 *) b), *((const gint64 *) a));
return 0;
}
static gint64 *
_value_str_as_index_list (const char *value, gsize *out_len)
{
gs_free char *str_clone_free = NULL;
gboolean str_cloned = FALSE;
char *str;
gsize i, j;
gsize n_alloc;
gsize len;
gs_free gint64 *arr = NULL;
*out_len = 0;
if (!value)
return NULL;
str = (char *) value;
n_alloc = 0;
len = 0;
while (TRUE) {
gint64 i64;
const char *s;
gsize good;
good = strcspn (str, ","NM_ASCII_SPACES);
if (good == 0) {
if (str[0] == '\0')
break;
str++;
continue;
}
if (str[good] == '\0') {
s = str;
str += good;
} else {
if (!str_cloned) {
str_cloned = TRUE;
str = nm_strndup_a (200, str, strlen (str), &str_clone_free);
}
s = str;
str[good] = '\0';
str += good + 1;
}
i64 = _nm_utils_ascii_str_to_int64 (s, 10, 0, G_MAXINT64, -1);
if (i64 == -1)
return NULL;
if (len >= n_alloc) {
if (n_alloc > 0) {
n_alloc = n_alloc * 2;
arr = g_realloc (arr, n_alloc * sizeof (gint64));
} else {
n_alloc = 4;
arr = g_new (gint64, n_alloc);
}
}
arr[len++] = i64;
}
if (len > 1) {
/* sort the list of indexes descendingly, and drop duplicates. */
g_qsort_with_data (arr,
len,
sizeof (gint64),
_int64_cmp_desc,
NULL);
j = 1;
for (i = 1; i < len; i++) {
nm_assert (arr[i - 1] >= arr[i]);
if (arr[i - 1] > arr[i])
arr[j++] = arr[i];
}
len = j;
}
*out_len = len;
return g_steal_pointer (&arr);
}
#define MULTILIST_WITH_ESCAPE_CHARS NM_ASCII_SPACES","
#define ESCAPED_TOKENS_DELIMITER ','
#define ESCAPED_TOKENS_DELIMITERS ","
typedef enum {
VALUE_STRSPLIT_MODE_STRIPPED,
VALUE_STRSPLIT_MODE_OBJLIST,
VALUE_STRSPLIT_MODE_OBJLIST_WITH_ESCAPE,
VALUE_STRSPLIT_MODE_MULTILIST,
VALUE_STRSPLIT_MODE_MULTILIST_WITH_ESCAPE,
VALUE_STRSPLIT_MODE_ESCAPED_TOKENS,
} ValueStrsplitMode;
static const char *
_value_strescape (const char *str, char **out_to_free)
{
return _nm_utils_escape_plain (str, MULTILIST_WITH_ESCAPE_CHARS, out_to_free);
}
static const char **
_value_strsplit (const char *value,
ValueStrsplitMode split_mode,
gsize *out_len)
{
gs_free const char **strv = NULL;
gsize i;
gsize len;
/* FIXME: some modes should support backslash escaping.
* In particular, to distingish from _value_str_as_index_list(), which
* does not accept '\\'. */
/* note that all modes remove empty tokens (",", "a,,b", ",,"). */
switch (split_mode) {
case VALUE_STRSPLIT_MODE_STRIPPED:
strv = nm_utils_strsplit_set (value, NM_ASCII_SPACES",");
break;
case VALUE_STRSPLIT_MODE_OBJLIST:
strv = nm_utils_strsplit_set (value, ",");
break;
case VALUE_STRSPLIT_MODE_OBJLIST_WITH_ESCAPE:
strv = nm_utils_strsplit_set_full (value, ",", NM_UTILS_STRSPLIT_SET_FLAGS_ALLOW_ESCAPING);
break;
case VALUE_STRSPLIT_MODE_MULTILIST:
strv = nm_utils_strsplit_set (value, " \t,");
break;
case VALUE_STRSPLIT_MODE_MULTILIST_WITH_ESCAPE:
strv = nm_utils_strsplit_set_full (value, MULTILIST_WITH_ESCAPE_CHARS, NM_UTILS_STRSPLIT_SET_FLAGS_ALLOW_ESCAPING);
break;
case VALUE_STRSPLIT_MODE_ESCAPED_TOKENS:
strv = nm_utils_escaped_tokens_split (value, ESCAPED_TOKENS_DELIMITERS);
NM_SET_OUT (out_len, NM_PTRARRAY_LEN (strv));
return g_steal_pointer (&strv);
default:
nm_assert_not_reached ();
break;
}
NM_SET_OUT (out_len, 0);
if (!strv)
return NULL;
len = 0;
for (i = 0; strv[i]; i++) {
const char *s = strv[i];
s = nm_str_skip_leading_spaces (s);
if (s[0] == '\0')
continue;
if (split_mode == VALUE_STRSPLIT_MODE_MULTILIST_WITH_ESCAPE)
_nm_utils_unescape_plain ((char *) s, MULTILIST_WITH_ESCAPE_CHARS, TRUE);
else if (split_mode == VALUE_STRSPLIT_MODE_OBJLIST_WITH_ESCAPE)
_nm_utils_unescape_plain ((char *) s, ",", TRUE);
else
g_strchomp ((char *) s);
strv[len++] = s;
}
strv[len] = NULL;
NM_SET_OUT (out_len, len);
return g_steal_pointer (&strv);
}
static NMIPAddress *
_parse_ip_address (int family, const char *address, GError **error)
{
gs_free char *ip_str = NULL;
const int MAX_PREFIX = (family == AF_INET) ? 32 : 128;
NMIPAddress *addr;
char *plen;
int prefix;
GError *local = NULL;
g_return_val_if_fail (address, NULL);
g_return_val_if_fail (!error || !*error, NULL);
ip_str = g_strstrip (g_strdup (address));
prefix = MAX_PREFIX;
plen = strchr (ip_str, '/');
if (plen) {
*plen++ = '\0';
if ((prefix = _nm_utils_ascii_str_to_int64 (plen, 10, 1, MAX_PREFIX, -1)) == -1) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid prefix '%s'; <1-%d> allowed"), plen, MAX_PREFIX);
return NULL;
}
}
addr = nm_ip_address_new (family, ip_str, prefix, &local);
if (!addr) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid IP address: %s"), local->message);
g_clear_error (&local);
}
return addr;
}
static NMIPRoute *
_parse_ip_route (int family,
const char *str,
GError **error)
{
const int MAX_PREFIX = (family == AF_INET) ? 32 : 128;
const char *next_hop = NULL;
int prefix;
NMIPRoute *route = NULL;
GError *local = NULL;
gint64 metric = -1;
guint i;
gs_free const char **routev = NULL;
gs_free char *str_clean_free = NULL;
const char *str_clean;
gs_free char *dest_clone = NULL;
const char *dest;
const char *plen;
gs_unref_hashtable GHashTable *attrs = NULL;
#define ROUTE_SYNTAX _("The valid syntax is: 'ip[/prefix] [next-hop] [metric] [attribute=val]... [,ip[/prefix] ...]'")
nm_assert (NM_IN_SET (family, AF_INET, AF_INET6));
nm_assert (str);
nm_assert (!error || !*error);
str_clean = nm_strstrip_avoid_copy_a (300, str, &str_clean_free);
routev = nm_utils_strsplit_set (str_clean, " \t");
if (!routev) {
g_set_error (error, 1, 0,
"'%s' is not valid. %s",
str, ROUTE_SYNTAX);
return NULL;
}
dest = routev[0];
plen = strchr (dest, '/'); /* prefix delimiter */
if (plen) {
dest_clone = g_strdup (dest);
plen = &dest_clone[plen - dest];
dest = dest_clone;
*((char *) plen) = '\0';
plen++;
}
prefix = MAX_PREFIX;
if (plen) {
if ((prefix = _nm_utils_ascii_str_to_int64 (plen, 10, 1, MAX_PREFIX, -1)) == -1) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid prefix '%s'; <1-%d> allowed"),
plen, MAX_PREFIX);
return NULL;
}
}
for (i = 1; routev[i]; i++) {
gint64 tmp64;
if (nm_utils_ipaddr_valid (family, routev[i])) {
if (metric != -1 || attrs) {
g_set_error (error, 1, 0, _("the next hop ('%s') must be first"), routev[i]);
return NULL;
}
next_hop = routev[i];
} else if ((tmp64 = _nm_utils_ascii_str_to_int64 (routev[i], 10, 0, G_MAXUINT32, -1)) != -1) {
if (attrs) {
g_set_error (error, 1, 0, _("the metric ('%s') must be before attributes"), routev[i]);
return NULL;
}
metric = tmp64;
} else if (strchr (routev[i], '=')) {
GHashTableIter iter;
char *iter_key;
GVariant *iter_value;
gs_unref_hashtable GHashTable *tmp_attrs = NULL;
tmp_attrs = nm_utils_parse_variant_attributes (routev[i], ' ', '=', FALSE,
nm_ip_route_get_variant_attribute_spec(),
error);
if (!tmp_attrs) {
g_prefix_error (error, "invalid option '%s': ", routev[i]);
return NULL;
}
if (!attrs) {
attrs = g_hash_table_new_full (nm_str_hash,
g_str_equal,
g_free,
(GDestroyNotify) g_variant_unref);
}
g_hash_table_iter_init (&iter, tmp_attrs);
while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) {
/* need to sink the reference, because nm_utils_parse_variant_attributes() returns
* floating refs. */
g_variant_ref_sink (iter_value);
if (!nm_ip_route_attribute_validate (iter_key, iter_value, family, NULL, error)) {
g_prefix_error (error, "%s: ", iter_key);
return NULL;
}
g_hash_table_insert (attrs, iter_key, iter_value);
g_hash_table_iter_steal (&iter);
}
} else {
g_set_error (error, 1, 0, "%s", ROUTE_SYNTAX);
return NULL;
}
}
route = nm_ip_route_new (family, dest, prefix, next_hop, metric, &local);
if (!route) {
g_set_error (error, 1, 0,
_("invalid route: %s. %s"), local->message, ROUTE_SYNTAX);
g_clear_error (&local);
return NULL;
}
if (attrs) {
GHashTableIter iter;
char *name;
GVariant *variant;
g_hash_table_iter_init (&iter, attrs);
while (g_hash_table_iter_next (&iter, (gpointer *) &name, (gpointer *) &variant))
nm_ip_route_set_attribute (route, name, variant);
}
return route;
}
static char *
_dump_team_link_watcher (NMTeamLinkWatcher *watcher)
{
const char *name;
NMTeamLinkWatcherArpPingFlags flags;
GString *w_dump;
if (!watcher)
return NULL;
w_dump = g_string_new (NULL);
name = nm_team_link_watcher_get_name (watcher);
g_string_append_printf (w_dump, "name=%s", name);
#define DUMP_WATCHER_INT(str, watcher, name, key) \
G_STMT_START { \
int _val = nm_team_link_watcher_get_##key (watcher); \
\
if (_val) \
g_string_append_printf (str, " %s=%d", name, _val); \
} G_STMT_END;
if (nm_streq (name, NM_TEAM_LINK_WATCHER_ETHTOOL)) {
DUMP_WATCHER_INT (w_dump, watcher, "delay-up", delay_up);
DUMP_WATCHER_INT (w_dump, watcher, "delay-down", delay_down);
return g_string_free (w_dump, FALSE);
}
/* NM_TEAM_LINK_WATCHER_NSNA_PING and NM_TEAM_LINK_WATCHER_ARP_PING */
DUMP_WATCHER_INT (w_dump, watcher, "init-wait", init_wait);
DUMP_WATCHER_INT (w_dump, watcher, "interval", interval);
DUMP_WATCHER_INT (w_dump, watcher, "missed-max", missed_max);
g_string_append_printf (w_dump, " target-host=%s",
nm_team_link_watcher_get_target_host (watcher));
if (nm_streq (name, NM_TEAM_LINK_WATCHER_NSNA_PING))
return g_string_free (w_dump, FALSE);
DUMP_WATCHER_INT (w_dump, watcher, "vlanid", vlanid);
#undef DUMP_WATCHER_INT
g_string_append_printf (w_dump, " source-host=%s",
nm_team_link_watcher_get_source_host (watcher));
flags = nm_team_link_watcher_get_flags (watcher);
if (flags & NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE)
g_string_append_printf (w_dump, " validate-active=true");
if (flags & NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE)
g_string_append_printf (w_dump, " validate-inactive=true");
if (flags & NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS)
g_string_append_printf (w_dump, "send-always=true");
return g_string_free (w_dump, FALSE);
}
static NMTeamLinkWatcher *
_parse_team_link_watcher (const char *str,
GError **error)
{
gs_free const char **watcherv = NULL;
gs_free char *str_clean_free = NULL;
const char *str_clean;
guint i;
gs_free const char *name = NULL;
int val1 = 0, val2 = 0, val3 = 3, val4 = -1;
gs_free const char *target_host = NULL;
gs_free const char *source_host = NULL;
NMTeamLinkWatcherArpPingFlags flags = 0;
nm_assert (str);
nm_assert (!error || !*error);
str_clean = nm_strstrip_avoid_copy_a (300, str, &str_clean_free);
watcherv = nm_utils_strsplit_set (str_clean, " \t");
if (!watcherv) {
g_set_error (error, 1, 0, "'%s' is not valid", str);
return NULL;
}
for (i = 0; watcherv[i]; i++) {
gs_free const char **pair = NULL;
pair = nm_utils_strsplit_set (watcherv[i], "=");
if (!pair) {
g_set_error (error, 1, 0, "'%s' is not valid: %s", watcherv[i],
"properties should be specified as 'key=value'");
return NULL;
}
if (!pair[1]) {
g_set_error (error, 1, 0, "'%s' is not valid: %s", watcherv[i],
"missing key value");
return NULL;
}
if (pair[2]) {
g_set_error (error, 1, 0, "'%s' is not valid: %s", watcherv[i],
"properties should be specified as 'key=value'");
return NULL;
}
if (nm_streq (pair[0], "name"))
name = g_strdup (pair[1]);
else if ( nm_streq (pair[0], "delay-up")
|| nm_streq (pair[0], "init-wait"))
val1 = _nm_utils_ascii_str_to_int64 (pair[1], 10, 0, G_MAXINT32, -1);
else if ( nm_streq (pair[0], "delay-down")
|| nm_streq (pair[0], "interval"))
val2 = _nm_utils_ascii_str_to_int64 (pair[1], 10, 0, G_MAXINT32, -1);
else if (nm_streq (pair[0], "missed-max"))
val3 = _nm_utils_ascii_str_to_int64 (pair[1], 10, 0, G_MAXINT32, -1);
else if (nm_streq (pair[0], "vlanid"))
val4 = _nm_utils_ascii_str_to_int64 (pair[1], 10, -1, 4094, -2);
else if (nm_streq (pair[0], "target-host"))
target_host = g_strdup (pair[1]);
else if (nm_streq (pair[0], "source-host"))
source_host = g_strdup (pair[1]);
else if (nm_streq (pair[0], "validate-active")) {
if (nm_streq (pair[1], "true"))
flags |= NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE;
} else if (nm_streq (pair[0], "validate-inactive")) {
if (nm_streq (pair[1], "true"))
flags |= NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE;
} else if (nm_streq (pair[0], "send-always")) {
if (nm_streq (pair[1], "true"))
flags |= NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS;
} else {
g_set_error (error, 1, 0, "'%s' is not valid: %s", watcherv[i],
"unknown key");
return NULL;
}
if ((val1 < 0) || (val2 < 0) || (val3 < 0)) {
g_set_error (error, 1, 0, "'%s' is not valid: %s", watcherv[i],
"value is not a valid number [0, MAXINT]");
return NULL;
}
if (val4 < -1) {
g_set_error (error, 1, 0, "'%s' is not valid: %s", watcherv[i],
"value is not a valid number [-1, 4094]");
return NULL;
}
}
if (nm_streq0 (name, NM_TEAM_LINK_WATCHER_ETHTOOL))
return nm_team_link_watcher_new_ethtool (val1, val2, error);
else if (nm_streq0 (name, NM_TEAM_LINK_WATCHER_NSNA_PING))
return nm_team_link_watcher_new_nsna_ping (val1, val2, val3, target_host, error);
else if (nm_streq0 (name, NM_TEAM_LINK_WATCHER_ARP_PING))
return nm_team_link_watcher_new_arp_ping2 (val1, val2, val3, val4, target_host, source_host, flags, error);
if (!name)
g_set_error (error, 1, 0, "link watcher name missing");
else
g_set_error (error, 1, 0, "unknown link watcher name: '%s'", name);
return NULL;
}
/* Max priority values from libnm-core/nm-setting-vlan.c */
#define MAX_SKB_PRIO G_MAXUINT32
#define MAX_8021P_PRIO 7 /* Max 802.1p priority */
/*
* nmc_proxy_check_script:
* @script: file name with PAC script, or raw PAC Script data
* @out_script: raw PAC Script (with removed new-line characters)
* @error: location to store error, or %NULL
*
* Check PAC Script from @script parameter and return the checked/sanitized
* config in @out_script.
*
* Returns: %TRUE if the script is valid, %FALSE if it is invalid
*/
static gboolean
nmc_proxy_check_script (const char *script, char **out_script, GError **error)
{
enum {
_PAC_SCRIPT_TYPE_GUESS,
_PAC_SCRIPT_TYPE_FILE,
_PAC_SCRIPT_TYPE_JSON,
} desired_type = _PAC_SCRIPT_TYPE_GUESS;
const char *filename = NULL;
size_t c_len = 0;
gs_free char *script_clone = NULL;
*out_script = NULL;
if (!script || !script[0])
return TRUE;
if (g_str_has_prefix (script, "file://")) {
script += NM_STRLEN ("file://");
desired_type = _PAC_SCRIPT_TYPE_FILE;
} else if (g_str_has_prefix (script, "js://")) {
script += NM_STRLEN ("js://");
desired_type = _PAC_SCRIPT_TYPE_JSON;
}
if (NM_IN_SET (desired_type, _PAC_SCRIPT_TYPE_FILE, _PAC_SCRIPT_TYPE_GUESS)) {
gs_free char *contents = NULL;
if (!g_file_get_contents (script, &contents, &c_len, NULL)) {
if (desired_type == _PAC_SCRIPT_TYPE_FILE) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("cannot read pac-script from file '%s'"),
script);
return FALSE;
}
} else {
if (c_len != strlen (contents)) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("file '%s' contains non-valid utf-8"),
script);
return FALSE;
}
filename = script;
script = script_clone = g_steal_pointer (&contents);
}
}
if ( !strstr (script, "FindProxyForURL")
|| !g_utf8_validate (script, -1, NULL)) {
if (filename) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' does not contain a valid PAC Script"), filename);
} else {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("Not a valid PAC Script"));
}
return FALSE;
}
*out_script = (script == script_clone)
? g_steal_pointer (&script_clone)
: g_strdup (script);
return TRUE;
}
/*
* nmc_team_check_config:
* @config: file name with team config, or raw team JSON config data
* @out_config: raw team JSON config data
* The value must be freed with g_free().
* @error: location to store error, or %NUL
*
* Check team config from @config parameter and return the checked
* config in @out_config.
*
* Returns: %TRUE if the config is valid, %FALSE if it is invalid
*/
static gboolean
nmc_team_check_config (const char *config, char **out_config, GError **error)
{
enum {
_TEAM_CONFIG_TYPE_GUESS,
_TEAM_CONFIG_TYPE_FILE,
_TEAM_CONFIG_TYPE_JSON,
} desired_type = _TEAM_CONFIG_TYPE_GUESS;
const char *filename = NULL;
size_t c_len = 0;
gs_free char *config_clone = NULL;
*out_config = NULL;
if (!config || !config[0])
return TRUE;
if (g_str_has_prefix (config, "file://")) {
config += NM_STRLEN ("file://");
desired_type = _TEAM_CONFIG_TYPE_FILE;
} else if (g_str_has_prefix (config, "json://")) {
config += NM_STRLEN ("json://");
desired_type = _TEAM_CONFIG_TYPE_JSON;
}
if (NM_IN_SET (desired_type, _TEAM_CONFIG_TYPE_FILE, _TEAM_CONFIG_TYPE_GUESS)) {
gs_free char *contents = NULL;
if (!g_file_get_contents (config, &contents, &c_len, NULL)) {
if (desired_type == _TEAM_CONFIG_TYPE_FILE) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("cannot read team config from file '%s'"),
config);
return FALSE;
}
} else {
if (c_len != strlen (contents)) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("team config file '%s' contains non-valid utf-8"),
config);
return FALSE;
}
filename = config;
config = config_clone = g_steal_pointer (&contents);
}
}
if (!nm_utils_is_json_object (config, NULL)) {
if (filename) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' does not contain a valid team configuration"), filename);
} else {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("team configuration must be a JSON object"));
}
return FALSE;
}
*out_config = (config == config_clone)
? g_steal_pointer (&config_clone)
: g_strdup (config);
return TRUE;
}
static const char *
_get_text_hidden (NMMetaAccessorGetType get_type)
{
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _(NM_META_TEXT_HIDDEN);
return NM_META_TEXT_HIDDEN;
}
/*****************************************************************************/
G_GNUC_PRINTF (4, 5)
static void
_env_warn_fcn (const NMMetaEnvironment *environment,
gpointer environment_user_data,
NMMetaEnvWarnLevel warn_level,
const char *fmt_l10n,
...)
{
va_list ap;
if (!environment || !environment->warn_fcn)
return;
va_start (ap, fmt_l10n);
environment->warn_fcn (environment,
environment_user_data,
warn_level,
fmt_l10n,
ap);
va_end (ap);
}
/*****************************************************************************/
#define ARGS_DESCRIBE_FCN \
const NMMetaPropertyInfo *property_info, char **out_to_free
#define ARGS_GET_FCN \
const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, NMMetaAccessorGetType get_type, NMMetaAccessorGetFlags get_flags, NMMetaAccessorGetOutFlags *out_flags, gboolean *out_is_default, gpointer *out_to_free
#define ARGS_SET_FCN \
const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, char modifier, const char *value, GError **error
#define ARGS_REMOVE_FCN \
const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, const char *value, GError **error
#define ARGS_COMPLETE_FCN \
const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, const NMMetaOperationContext *operation_context, const char *text, char ***out_to_free
#define ARGS_VALUES_FCN \
const NMMetaPropertyInfo *property_info, char ***out_to_free
#define ARGS_SETTING_INIT_FCN \
const NMMetaSettingInfoEditor *setting_info, NMSetting *setting, NMMetaAccessorSettingInitType init_type
static gboolean
_SET_FCN_DO_RESET_DEFAULT (const NMMetaPropertyInfo *property_info, char modifier, const char *value)
{
nm_assert (property_info);
nm_assert (!property_info->property_type->set_supports_remove);
nm_assert (NM_IN_SET (modifier, '\0', '+'));
nm_assert (value || modifier == '\0');
return value == NULL;
}
static gboolean
_SET_FCN_DO_RESET_DEFAULT_WITH_SUPPORTS_REMOVE (const NMMetaPropertyInfo *property_info, char modifier, const char *value)
{
nm_assert (property_info);
nm_assert (property_info->property_type->set_supports_remove);
nm_assert (NM_IN_SET (modifier, '\0', '+', '-'));
nm_assert (value || modifier == '\0');
return value == NULL;
}
static gboolean
_SET_FCN_DO_SET_ALL (char modifier, const char *value)
{
nm_assert (NM_IN_SET (modifier, '\0', '+', '-'));
nm_assert (value);
return modifier == '\0';
}
static gboolean
_SET_FCN_DO_REMOVE (char modifier, const char *value)
{
nm_assert (NM_IN_SET (modifier, '\0', '+', '-'));
nm_assert (value);
return modifier == '-';
}
#define RETURN_UNSUPPORTED_GET_TYPE() \
G_STMT_START { \
if (!NM_IN_SET (get_type, \
NM_META_ACCESSOR_GET_TYPE_PARSABLE, \
NM_META_ACCESSOR_GET_TYPE_PRETTY)) { \
nm_assert_not_reached (); \
return NULL; \
} \
} G_STMT_END;
#define RETURN_STR_TO_FREE(val) \
G_STMT_START { \
char *_val = (val); \
return ((*(out_to_free)) = _val); \
} G_STMT_END
static gboolean
_gobject_property_is_default (NMSetting *setting, const char *prop_name)
{
nm_auto_unset_gvalue GValue v = G_VALUE_INIT;
GParamSpec *pspec;
GHashTable *ht;
char **strv;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)),
prop_name);
if (!G_IS_PARAM_SPEC (pspec))
g_return_val_if_reached (FALSE);
g_value_init (&v, pspec->value_type);
g_object_get_property (G_OBJECT (setting), prop_name, &v);
if (pspec->value_type == G_TYPE_STRV) {
strv = g_value_get_boxed (&v);
return !strv || !strv[0];
} else if (pspec->value_type == G_TYPE_HASH_TABLE) {
ht = g_value_get_boxed (&v);
return !ht || !g_hash_table_size (ht);
}
return g_param_value_defaults (pspec, &v);
}
static gboolean
_gobject_property_reset (NMSetting *setting,
const char *prop_name,
gboolean reset_default)
{
nm_auto_unset_gvalue GValue v = G_VALUE_INIT;
GParamSpec *pspec;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)),
prop_name);
if (!G_IS_PARAM_SPEC (pspec))
g_return_val_if_reached (FALSE);
g_value_init (&v, pspec->value_type);
if (reset_default)
g_param_value_defaults (pspec, &v);
g_object_set_property (G_OBJECT (setting), prop_name, &v);
return TRUE;
}
static gboolean
_gobject_property_reset_default (NMSetting *setting, const char *prop_name)
{
return _gobject_property_reset (setting, prop_name, TRUE);
}
static gconstpointer
_get_fcn_gobject_impl (const NMMetaPropertyInfo *property_info,
NMSetting *setting,
NMMetaAccessorGetType get_type,
gboolean *out_is_default,
gpointer *out_to_free)
{
const char *cstr;
GType gtype_prop;
nm_auto_unset_gvalue GValue val = G_VALUE_INIT;
RETURN_UNSUPPORTED_GET_TYPE ();
NM_SET_OUT (out_is_default, _gobject_property_is_default (setting, property_info->property_name));
if ( property_info->property_typ_data
&& property_info->property_typ_data->is_default_fcn
&& property_info->property_typ_data->is_default_fcn (setting)) {
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _("(default)");
return "";
}
gtype_prop = _gobject_property_get_gtype (G_OBJECT (setting), property_info->property_name);
if (gtype_prop == G_TYPE_BOOLEAN) {
gboolean b;
g_value_init (&val, gtype_prop);
g_object_get_property (G_OBJECT (setting), property_info->property_name, &val);
b = g_value_get_boolean (&val);
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
cstr = b ? _("yes") : _("no");
else
cstr = b ? "yes" : "no";
return cstr;
} else {
char *str;
/* Note that we register certain transform functions in nmc_value_transforms_register().
* This makes G_TYPE_STRV working.
*
* FIXME: that is particularly ugly because it's non-obvious which code relies
* on nmc_value_transforms_register(). Also, nmc_value_transforms_register() is
* in clients/cli, while we are here in clients/common. */
g_value_init (&val, G_TYPE_STRING);
g_object_get_property (G_OBJECT (setting), property_info->property_name, &val);
cstr = g_value_get_string (&val);
if ( property_info->property_typ_data
&& property_info->property_typ_data->is_default_fcn) {
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) {
str = cstr
? g_strdup_printf ("\"%s\"", cstr)
: g_strdup ("");
} else
str = g_strdup (cstr && cstr[0] ? cstr : " ");
} else
str = cstr ? g_strdup (cstr) : NULL;
RETURN_STR_TO_FREE (str);
}
}
static gconstpointer
_get_fcn_gobject (ARGS_GET_FCN)
{
return _get_fcn_gobject_impl (property_info, setting, get_type, out_is_default, out_to_free);
}
static gconstpointer
_get_fcn_gobject_int (ARGS_GET_FCN)
{
GParamSpec *pspec;
nm_auto_unset_gvalue GValue gval = G_VALUE_INIT;
gboolean is_uint64 = FALSE;
NMMetaSignUnsignInt64 v;
guint base = 10;
const NMMetaUtilsIntValueInfo *value_infos;
char *return_str;
RETURN_UNSUPPORTED_GET_TYPE ();
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), property_info->property_name);
if (!G_IS_PARAM_SPEC (pspec))
g_return_val_if_reached (FALSE);
g_value_init (&gval, pspec->value_type);
g_object_get_property (G_OBJECT (setting), property_info->property_name, &gval);
NM_SET_OUT (out_is_default, g_param_value_defaults (pspec, &gval));
switch (pspec->value_type) {
case G_TYPE_INT:
v.i64 = g_value_get_int (&gval);
break;
case G_TYPE_UINT:
v.u64 = g_value_get_uint (&gval);
is_uint64 = TRUE;
break;
case G_TYPE_INT64:
v.i64 = g_value_get_int64 (&gval);
break;
case G_TYPE_UINT64:
v.u64 = g_value_get_uint64 (&gval);
is_uint64 = TRUE;
break;
default:
g_return_val_if_reached (NULL);
break;
}
if ( property_info->property_typ_data
&& property_info->property_typ_data->subtype.gobject_int.base > 0) {
base = property_info->property_typ_data->subtype.gobject_int.base;
}
switch (base) {
case 10:
if (is_uint64)
return_str = g_strdup_printf ("%"G_GUINT64_FORMAT, v.u64);
else
return_str = g_strdup_printf ("%"G_GINT64_FORMAT, v.i64);
break;
case 16:
if (is_uint64)
return_str = g_strdup_printf ("0x%"G_GINT64_MODIFIER"x", v.u64);
else
return_str = g_strdup_printf ("0x%"G_GINT64_MODIFIER"x", (guint64) v.i64);
break;
default:
return_str = NULL;
g_assert_not_reached ();
}
if ( get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY
&& property_info->property_typ_data
&& (value_infos = property_info->property_typ_data->subtype.gobject_int.value_infos)) {
for (; value_infos->nick; value_infos++) {
if ( ( is_uint64 && value_infos->value.u64 == v.u64)
|| (!is_uint64 && value_infos->value.i64 == v.i64)) {
gs_free char *old_str = return_str;
return_str = g_strdup_printf ("%s (%s)", old_str, value_infos->nick);
break;
}
}
}
RETURN_STR_TO_FREE (return_str);
}
static gconstpointer
_get_fcn_gobject_mtu (ARGS_GET_FCN)
{
guint32 mtu;
RETURN_UNSUPPORTED_GET_TYPE ();
if ( !property_info->property_typ_data
|| !property_info->property_typ_data->subtype.mtu.get_fcn)
return _get_fcn_gobject_impl (property_info, setting, get_type, out_is_default, out_to_free);
mtu = property_info->property_typ_data->subtype.mtu.get_fcn (setting);
if (mtu == 0) {
NM_SET_OUT (out_is_default, TRUE);
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _("auto");
return "auto";
}
RETURN_STR_TO_FREE (g_strdup_printf ("%u", (unsigned) mtu));
}
static gconstpointer
_get_fcn_gobject_secret_flags (ARGS_GET_FCN)
{
guint v;
GValue val = G_VALUE_INIT;
RETURN_UNSUPPORTED_GET_TYPE ();
g_value_init (&val, G_TYPE_UINT);
g_object_get_property (G_OBJECT (setting), property_info->property_name, &val);
v = g_value_get_uint (&val);
g_value_unset (&val);
RETURN_STR_TO_FREE (secret_flags_to_string (v, get_type));
}
static gconstpointer
_get_fcn_gobject_enum (ARGS_GET_FCN)
{
GType gtype = 0;
nm_auto_unref_gtypeclass GTypeClass *gtype_class = NULL;
nm_auto_unref_gtypeclass GTypeClass *gtype_prop_class = NULL;
const struct _NMUtilsEnumValueInfo *value_infos = NULL;
gboolean has_gtype = FALSE;
nm_auto_unset_gvalue GValue gval = G_VALUE_INIT;
gint64 v;
gboolean format_numeric = FALSE;
gboolean format_numeric_hex = FALSE;
gboolean format_numeric_hex_unknown = FALSE;
gboolean format_text = FALSE;
gboolean format_text_l10n = FALSE;
gs_free char *s = NULL;
char s_numeric[64];
GParamSpec *pspec;
RETURN_UNSUPPORTED_GET_TYPE ();
if (property_info->property_typ_data) {
if (property_info->property_typ_data->subtype.gobject_enum.get_gtype) {
gtype = property_info->property_typ_data->subtype.gobject_enum.get_gtype ();
has_gtype = TRUE;
}
}
if ( property_info->property_typ_data
&& get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY
&& NM_FLAGS_ANY (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC_HEX
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT_L10N)) {
format_numeric_hex = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC_HEX);
format_numeric = format_numeric_hex || NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC);
format_text_l10n = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT_L10N);
format_text = format_text_l10n || NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT);
} else if ( property_info->property_typ_data
&& get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY
&& NM_FLAGS_ANY (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC_HEX
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT)) {
format_numeric_hex = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC_HEX);
format_numeric = format_numeric && NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC);
format_text = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT);
} else if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) {
/* by default, output in format "%u (%s)" (with hex for flags and l10n). */
format_numeric = TRUE;
format_numeric_hex_unknown = TRUE;
format_text = TRUE;
format_text_l10n = TRUE;
} else {
/* by default, output only numeric (with hex for flags). */
format_numeric = TRUE;
format_numeric_hex_unknown = TRUE;
}
nm_assert (format_text || format_numeric);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), property_info->property_name);
g_return_val_if_fail (pspec, NULL);
g_value_init (&gval, pspec->value_type);
g_object_get_property (G_OBJECT (setting), property_info->property_name, &gval);
NM_SET_OUT (out_is_default, g_param_value_defaults (pspec, &gval));
if ( pspec->value_type == G_TYPE_INT
|| ( G_TYPE_IS_CLASSED (pspec->value_type)
&& G_IS_ENUM_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (pspec->value_type)))))) {
if (pspec->value_type == G_TYPE_INT) {
if (!has_gtype)
g_return_val_if_reached (NULL);
v = g_value_get_int (&gval);
} else
v = g_value_get_enum (&gval);
} else if ( pspec->value_type == G_TYPE_UINT
|| ( G_TYPE_IS_CLASSED (pspec->value_type)
&& G_IS_FLAGS_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (pspec->value_type)))))) {
if (pspec->value_type == G_TYPE_UINT) {
if (!has_gtype)
g_return_val_if_reached (NULL);
v = g_value_get_uint (&gval);
} else
v = g_value_get_flags (&gval);
} else
g_return_val_if_reached (NULL);
if (!has_gtype) {
gtype = pspec->value_type;
gtype_class = g_steal_pointer (>ype_prop_class);
}
nm_assert (({
nm_auto_unref_gtypeclass GTypeClass *t = NULL;
( G_TYPE_IS_CLASSED (gtype)
&& (t = g_type_class_ref (gtype))
&& (G_IS_ENUM_CLASS (t) || G_IS_FLAGS_CLASS (t)));
}));
if (format_numeric && !format_text) {
s = format_numeric_hex
|| ( format_numeric_hex_unknown
&& !G_IS_ENUM_CLASS (gtype_class ?: (gtype_class = g_type_class_ref (gtype))))
? g_strdup_printf ("0x%"G_GINT64_FORMAT, v)
: g_strdup_printf ("%"G_GINT64_FORMAT, v);
RETURN_STR_TO_FREE (g_steal_pointer (&s));
}
/* the gobject_enum.value_infos are currently ignored for the getter. They
* only declare additional aliases for the setter. */
if (property_info->property_typ_data)
value_infos = property_info->property_typ_data->subtype.gobject_enum.value_infos_get;
s = _nm_utils_enum_to_str_full (gtype, (int) v, ", ", value_infos);
if (!format_numeric)
RETURN_STR_TO_FREE (g_steal_pointer (&s));
if ( format_numeric_hex
|| ( format_numeric_hex_unknown
&& !G_IS_ENUM_CLASS (gtype_class ?: (gtype_class = g_type_class_ref (gtype)))))
nm_sprintf_buf (s_numeric, "0x%"G_GINT64_FORMAT, v);
else
nm_sprintf_buf (s_numeric, "%"G_GINT64_FORMAT, v);
if (nm_streq0 (s, s_numeric))
RETURN_STR_TO_FREE (g_steal_pointer (&s));
if (format_text_l10n)
RETURN_STR_TO_FREE (g_strdup_printf (_("%s (%s)"), s_numeric, s));
else
RETURN_STR_TO_FREE (g_strdup_printf ("%s (%s)", s_numeric, s));
}
/*****************************************************************************/
static gboolean
_set_fcn_gobject_string (ARGS_SET_FCN)
{
gs_free char *to_free = NULL;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (property_info->property_typ_data) {
if (property_info->property_typ_data->subtype.gobject_string.validate_fcn) {
value = property_info->property_typ_data->subtype.gobject_string.validate_fcn (value, &to_free, error);
if (!value)
return FALSE;
} else if (property_info->property_typ_data->values_static) {
value = nmc_string_is_valid (value,
(const char **) property_info->property_typ_data->values_static,
error);
if (!value)
return FALSE;
}
}
g_object_set (setting, property_info->property_name, value, NULL);
return TRUE;
}
static gboolean
_set_fcn_gobject_bool (ARGS_SET_FCN)
{
gboolean val_bool;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!nmc_string_to_bool (value, &val_bool, error))
return FALSE;
g_object_set (setting, property_info->property_name, val_bool, NULL);
return TRUE;
}
static gboolean
_set_fcn_gobject_int (ARGS_SET_FCN)
{
int errsv;
const GParamSpec *pspec;
nm_auto_unset_gvalue GValue gval = G_VALUE_INIT;
gboolean is_uint64;
NMMetaSignUnsignInt64 v;
gboolean has_minmax = FALSE;
NMMetaSignUnsignInt64 min = { 0 };
NMMetaSignUnsignInt64 max = { 0 };
guint base = 10;
const NMMetaUtilsIntValueInfo *value_infos;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), property_info->property_name);
if (!G_IS_PARAM_SPEC (pspec))
g_return_val_if_reached (FALSE);
is_uint64 = NM_IN_SET (pspec->value_type, G_TYPE_UINT, G_TYPE_UINT64);
if (property_info->property_typ_data) {
if ( value
&& (value_infos = property_info->property_typ_data->subtype.gobject_int.value_infos)) {
gs_free char *vv_free = NULL;
const char *vv;
vv = nm_strstrip_avoid_copy_a (300, value, &vv_free);
for (; value_infos->nick; value_infos++) {
if (nm_streq (value_infos->nick, vv)) {
v = value_infos->value;
goto have_value_from_nick;
}
}
}
if (property_info->property_typ_data->subtype.gobject_int.base > 0)
base = property_info->property_typ_data->subtype.gobject_int.base;
if ( ( is_uint64
&& ( property_info->property_typ_data->subtype.gobject_int.min.u64
|| property_info->property_typ_data->subtype.gobject_int.max.u64))
|| ( !is_uint64
&& ( property_info->property_typ_data->subtype.gobject_int.min.i64
|| property_info->property_typ_data->subtype.gobject_int.max.i64))) {
min = property_info->property_typ_data->subtype.gobject_int.min;
max = property_info->property_typ_data->subtype.gobject_int.max;
has_minmax = TRUE;
}
}
if (!has_minmax) {
switch (pspec->value_type) {
case G_TYPE_INT:
{
const GParamSpecInt *p = (GParamSpecInt *) pspec;
min.i64 = p->minimum;
max.i64 = p->maximum;
}
break;
case G_TYPE_UINT:
{
const GParamSpecUInt *p = (GParamSpecUInt *) pspec;
min.u64 = p->minimum;
max.u64 = p->maximum;
}
break;
case G_TYPE_INT64:
{
const GParamSpecInt64 *p = (GParamSpecInt64 *) pspec;
min.i64 = p->minimum;
max.i64 = p->maximum;
}
break;
case G_TYPE_UINT64:
{
const GParamSpecUInt64 *p = (GParamSpecUInt64 *) pspec;
min.u64 = p->minimum;
max.u64 = p->maximum;
}
break;
default:
g_return_val_if_reached (FALSE);
}
}
if (is_uint64)
v.u64 = _nm_utils_ascii_str_to_uint64 (value, base, min.u64, max.u64, 0);
else
v.i64 = _nm_utils_ascii_str_to_int64 (value, base, min.i64, max.i64, 0);
if ((errsv = errno) != 0) {
if (errsv == ERANGE) {
if (is_uint64) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' is out of range [%"G_GUINT64_FORMAT", %"G_GUINT64_FORMAT"]"),
value, min.u64, max.u64);
} else {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' is out of range [%"G_GINT64_FORMAT", %"G_GINT64_FORMAT"]"),
value, min.i64, max.i64);
}
} else {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' is not a valid number"), value);
}
return FALSE;
}
have_value_from_nick:
g_value_init (&gval, pspec->value_type);
switch (pspec->value_type) {
case G_TYPE_INT:
g_value_set_int (&gval, v.i64);
break;
case G_TYPE_UINT:
g_value_set_uint (&gval, v.u64);
break;
case G_TYPE_INT64:
g_value_set_int64 (&gval, v.i64);
break;
case G_TYPE_UINT64:
g_value_set_uint64 (&gval, v.u64);
break;
default:
g_return_val_if_reached (FALSE);
break;
}
/* Validate the number according to the property spec */
if (!nm_g_object_set_property (G_OBJECT (setting),
property_info->property_name,
&gval,
error))
g_return_val_if_reached (FALSE);
return TRUE;
}
static gboolean
_set_fcn_gobject_mtu (ARGS_SET_FCN)
{
nm_auto_unset_gvalue GValue gval = G_VALUE_INIT;
const GParamSpec *pspec;
gint64 v;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (nm_streq (value, "auto"))
value = "0";
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)),
property_info->property_name);
if (!pspec || pspec->value_type != G_TYPE_UINT)
g_return_val_if_reached (FALSE);
v = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1);
if (v < 0) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' is out of range [0, %u]"), value, (unsigned) G_MAXUINT32);
return FALSE;
}
g_value_init (&gval, pspec->value_type);
g_value_set_uint (&gval, v);
if (!nm_g_object_set_property (G_OBJECT (setting),
property_info->property_name,
&gval,
error))
g_return_val_if_reached (FALSE);
return TRUE;
}
/* Ideally we'll be able to get this from a public header. */
#ifndef IEEE802154_ADDR_LEN
#define IEEE802154_ADDR_LEN 8
#endif
static gboolean
_set_fcn_gobject_mac (ARGS_SET_FCN)
{
NMMetaPropertyTypeMacMode mode;
gboolean valid;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (property_info->property_typ_data)
mode = property_info->property_typ_data->subtype.mac.mode;
else
mode = NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT;
if (mode == NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND) {
valid = nm_utils_hwaddr_valid (value, INFINIBAND_ALEN);
} else if (mode == NM_META_PROPERTY_TYPE_MAC_MODE_WPAN) {
valid = nm_utils_hwaddr_valid (value, IEEE802154_ADDR_LEN);
} else {
valid = nm_utils_hwaddr_valid (value, ETH_ALEN)
|| ( mode == NM_META_PROPERTY_TYPE_MAC_MODE_CLONED
&& NM_CLONED_MAC_IS_SPECIAL (value));
}
if (!valid) {
g_set_error (error, 1, 0, _("'%s' is not a valid Ethernet MAC"), value);
return FALSE;
}
g_object_set (setting, property_info->property_name, value, NULL);
return TRUE;
}
static gboolean
_set_fcn_gobject_enum (ARGS_SET_FCN)
{
GType gtype = 0;
GType gtype_prop;
gboolean has_gtype = FALSE;
nm_auto_unset_gvalue GValue gval = G_VALUE_INIT;
nm_auto_unref_gtypeclass GTypeClass *gtype_class = NULL;
gboolean is_flags;
int v;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (property_info->property_typ_data) {
if (property_info->property_typ_data->subtype.gobject_enum.get_gtype) {
gtype = property_info->property_typ_data->subtype.gobject_enum.get_gtype ();
has_gtype = TRUE;
}
}
gtype_prop = _gobject_property_get_gtype (G_OBJECT (setting), property_info->property_name);
if ( has_gtype
&& NM_IN_SET (gtype_prop,
G_TYPE_INT,
G_TYPE_UINT)
&& G_TYPE_IS_CLASSED (gtype)
&& (gtype_class = g_type_class_ref (gtype))
&& ( (is_flags = G_IS_FLAGS_CLASS (gtype_class))
|| G_IS_ENUM_CLASS (gtype_class))) {
/* valid */
} else if ( !has_gtype
&& G_TYPE_IS_CLASSED (gtype_prop)
&& (gtype_class = g_type_class_ref (gtype_prop))
&& ( (is_flags = G_IS_FLAGS_CLASS (gtype_class))
|| G_IS_ENUM_CLASS (gtype_class))) {
gtype = gtype_prop;
} else
g_return_val_if_reached (FALSE);
if (!_nm_utils_enum_from_str_full (gtype, value, &v, NULL,
property_info->property_typ_data
? property_info->property_typ_data->subtype.gobject_enum.value_infos
: NULL))
goto fail;
if ( property_info->property_typ_data
&& property_info->property_typ_data->subtype.gobject_enum.pre_set_notify) {
property_info->property_typ_data->subtype.gobject_enum.pre_set_notify (property_info,
environment,
environment_user_data,
setting,
v);
}
g_value_init (&gval, gtype_prop);
if (gtype_prop == G_TYPE_INT)
g_value_set_int (&gval, v);
else if (gtype_prop == G_TYPE_UINT)
g_value_set_uint (&gval, v);
else if (is_flags) {
nm_assert (G_IS_FLAGS_CLASS (gtype_class));
g_value_set_flags (&gval, v);
} else {
nm_assert (G_IS_ENUM_CLASS (gtype_class));
g_value_set_enum (&gval, v);
}
if (!nm_g_object_set_property (G_OBJECT (setting), property_info->property_name, &gval, NULL))
goto fail;
return TRUE;
fail:
if (error) {
gs_free const char **valid_all = NULL;
gs_free const char *valid_str = NULL;
gboolean has_minmax = FALSE;
int min = G_MININT;
int max = G_MAXINT;
if (property_info->property_typ_data) {
if ( property_info->property_typ_data->subtype.gobject_enum.min
|| property_info->property_typ_data->subtype.gobject_enum.max) {
min = property_info->property_typ_data->subtype.gobject_enum.min;
max = property_info->property_typ_data->subtype.gobject_enum.max;
has_minmax = TRUE;
}
}
if (!has_minmax && is_flags) {
min = 0;
max = (int) G_MAXUINT;
}
valid_all = nm_utils_enum_get_values (gtype, min, max);
valid_str = g_strjoinv (",", (char **) valid_all);
if (is_flags) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid option '%s', use a combination of [%s]"),
value,
valid_str);
} else {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid option '%s', use one of [%s]"),
value,
valid_str);
}
}
return FALSE;
}
/*****************************************************************************/
static const char *const*
_values_fcn_gobject_enum (ARGS_VALUES_FCN)
{
GType gtype = 0;
gboolean has_gtype = FALSE;
gboolean has_minmax = FALSE;
int min = G_MININT;
int max = G_MAXINT;
char **v;
if (property_info->property_typ_data) {
if ( property_info->property_typ_data->subtype.gobject_enum.min
|| property_info->property_typ_data->subtype.gobject_enum.max) {
min = property_info->property_typ_data->subtype.gobject_enum.min;
max = property_info->property_typ_data->subtype.gobject_enum.max;
has_minmax = TRUE;
}
if (property_info->property_typ_data->subtype.gobject_enum.get_gtype) {
gtype = property_info->property_typ_data->subtype.gobject_enum.get_gtype ();
has_gtype = TRUE;
}
}
if (!has_gtype) {
gtype = _gtype_property_get_gtype (property_info->setting_info->general->get_setting_gtype (),
property_info->property_name);
}
if ( !has_minmax
&& G_TYPE_IS_CLASSED (gtype)) {
nm_auto_unref_gtypeclass GTypeClass *class = NULL;
class = g_type_class_ref (gtype);
if (G_IS_FLAGS_CLASS (class)) {
min = 0;
max = (int) G_MAXUINT;
}
}
/* the gobject_enum.value_infos are currently ignored for the list of
* values. They only declare additional (hidden) aliases for the setter. */
v = nm_utils_strv_make_deep_copied (nm_utils_enum_get_values (gtype, min, max));
return (const char *const*) (*out_to_free = v);
}
/*****************************************************************************/
static const char *const*
_complete_fcn_gobject_bool (ARGS_COMPLETE_FCN)
{
static const char *const v[] = {
"true",
"false",
"on",
"off",
"1",
"0",
"yes",
"no",
NULL,
};
if (!text || !text[0])
return &v[6];
return v;
}
static const char *const*
_complete_fcn_gobject_devices (ARGS_COMPLETE_FCN)
{
NMDevice *const*devices = NULL;
guint i, j;
guint len = 0;
char **ifnames;
if ( environment
&& environment->get_nm_devices) {
devices = environment->get_nm_devices (environment,
environment_user_data,
&len);
}
if (len == 0)
return NULL;
ifnames = g_new (char *, len + 1);
for (i = 0, j = 0; i < len; i++) {
const char *ifname;
nm_assert (NM_IS_DEVICE (devices[i]));
ifname = nm_device_get_iface (devices[i]);
if (ifname)
ifnames[j++] = g_strdup (ifname);
}
ifnames[j++] = NULL;
*out_to_free = ifnames;
return (const char *const*) ifnames;
}
/*****************************************************************************/
static char *
wep_key_type_to_string (NMWepKeyType type)
{
switch (type) {
case NM_WEP_KEY_TYPE_KEY:
return g_strdup_printf (_("%d (key)"), type);
case NM_WEP_KEY_TYPE_PASSPHRASE:
return g_strdup_printf (_("%d (passphrase)"), type);
case NM_WEP_KEY_TYPE_UNKNOWN:
default:
return g_strdup_printf (_("%d (unknown)"), type);
}
}
static char *
bytes_to_string (GBytes *bytes)
{
const guint8 *data;
gsize len;
if (!bytes)
return NULL;
data = g_bytes_get_data (bytes, &len);
return nm_utils_bin2hexstr_full (data,
len,
'\0',
TRUE,
NULL);
}
static char *
vlan_flags_to_string (guint32 flags, NMMetaAccessorGetType get_type)
{
GString *flag_str;
if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY)
return g_strdup_printf ("%u", flags);
if (flags == 0)
return g_strdup (_("0 (NONE)"));
flag_str = g_string_new (NULL);
g_string_printf (flag_str, "%d (", flags);
if (flags & NM_VLAN_FLAG_REORDER_HEADERS)
g_string_append (flag_str, _("REORDER_HEADERS, "));
if (flags & NM_VLAN_FLAG_GVRP)
g_string_append (flag_str, _("GVRP, "));
if (flags & NM_VLAN_FLAG_LOOSE_BINDING)
g_string_append (flag_str, _("LOOSE_BINDING, "));
if (flags & NM_VLAN_FLAG_MVRP)
g_string_append (flag_str, _("MVRP, "));
if (flag_str->str[flag_str->len-1] == '(')
g_string_append (flag_str, _("unknown"));
else
g_string_truncate (flag_str, flag_str->len-2); /* chop off trailing ', ' */
g_string_append_c (flag_str, ')');
return g_string_free (flag_str, FALSE);
}
static char *
vlan_priorities_to_string (NMSettingVlan *s_vlan, NMVlanPriorityMap map)
{
GString *priorities;
int i;
priorities = g_string_new (NULL);
for (i = 0; i < nm_setting_vlan_get_num_priorities (s_vlan, map); i++) {
guint32 from, to;
if (nm_setting_vlan_get_priority (s_vlan, map, i, &from, &to))
g_string_append_printf (priorities, "%d:%d,", from, to);
}
if (priorities->len)
g_string_truncate (priorities, priorities->len-1); /* chop off trailing ',' */
return g_string_free (priorities, FALSE);
}
static char *
secret_flags_to_string (guint32 flags, NMMetaAccessorGetType get_type)
{
GString *flag_str;
if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY)
return g_strdup_printf ("%u", flags);
if (flags == 0)
return g_strdup (_("0 (none)"));
flag_str = g_string_new (NULL);
g_string_printf (flag_str, "%u (", flags);
if (flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED)
g_string_append (flag_str, _("agent-owned, "));
if (flags & NM_SETTING_SECRET_FLAG_NOT_SAVED)
g_string_append (flag_str, _("not saved, "));
if (flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
g_string_append (flag_str, _("not required, "));
if (flag_str->str[flag_str->len-1] == '(')
g_string_append (flag_str, _("unknown"));
else
g_string_truncate (flag_str, flag_str->len-2); /* chop off trailing ', ' */
g_string_append_c (flag_str, ')');
return g_string_free (flag_str, FALSE);
}
static void
vpn_data_item (const char *key, const char *value, gpointer user_data)
{
GString *ret_str = (GString *) user_data;
if (ret_str->len != 0)
g_string_append (ret_str, ", ");
g_string_append_printf (ret_str, "%s = %s", key, value);
}
static const char *
_multilist_do_validate (const NMMetaPropertyInfo *property_info,
NMSetting *setting,
const char *item,
GError **error)
{
if (property_info->property_typ_data->values_static) {
nm_assert (!property_info->property_typ_data->subtype.multilist.validate_fcn);
return nmc_string_is_valid (item,
(const char **) property_info->property_typ_data->values_static,
error);
}
if (property_info->property_typ_data->subtype.multilist.validate_fcn) {
return property_info->property_typ_data->subtype.multilist.validate_fcn (item,
error);
}
if (property_info->property_typ_data->subtype.multilist.validate2_fcn) {
return property_info->property_typ_data->subtype.multilist.validate2_fcn (setting,
item,
error);
}
return item;
}
static gboolean
_set_fcn_multilist (ARGS_SET_FCN)
{
gs_free const char **strv = NULL;
gsize i, j, nstrv;
if (_SET_FCN_DO_RESET_DEFAULT_WITH_SUPPORTS_REMOVE (property_info, modifier, value)) {
if (property_info->property_typ_data->subtype.multilist.clear_all_fcn) {
property_info->property_typ_data->subtype.multilist.clear_all_fcn (setting);
return TRUE;
}
return _gobject_property_reset (setting, property_info->property_name, FALSE);
}
if ( _SET_FCN_DO_REMOVE (modifier, value)
&& ( property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_u32
|| property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_s
|| property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_u)) {
gs_free gint64 *indexes = NULL;
indexes = _value_str_as_index_list (value, &nstrv);
if (indexes) {
gint64 num;
if (property_info->property_typ_data->subtype.multilist.get_num_fcn_u32)
num = property_info->property_typ_data->subtype.multilist.get_num_fcn_u32 (setting);
else
num = property_info->property_typ_data->subtype.multilist.get_num_fcn_u (setting);
for (i = 0; i < nstrv; i++) {
gint64 idx = indexes[i];
if (idx >= num)
continue;
if (property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_u32)
property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_u32 (setting, idx);
else if (property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_s)
property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_s (setting, idx);
else
property_info->property_typ_data->subtype.multilist.remove_by_idx_fcn_u (setting, idx);
}
return TRUE;
}
}
strv = _value_strsplit (value,
property_info->property_typ_data->subtype.multilist.strsplit_plain
? VALUE_STRSPLIT_MODE_MULTILIST
: ( property_info->property_typ_data->subtype.multilist.strsplit_with_escape
? VALUE_STRSPLIT_MODE_MULTILIST_WITH_ESCAPE
: VALUE_STRSPLIT_MODE_ESCAPED_TOKENS),
&nstrv);
j = 0;
for (i = 0; i < nstrv; i++) {
const char *item = strv[i];
item = _multilist_do_validate (property_info,
setting,
item,
error);
if (!item)
return FALSE;
strv[j++] = item;
}
nstrv = j;
if (_SET_FCN_DO_SET_ALL (modifier, value)) {
if (property_info->property_typ_data->subtype.multilist.clear_all_fcn)
property_info->property_typ_data->subtype.multilist.clear_all_fcn (setting);
else
_gobject_property_reset (setting, property_info->property_name, FALSE);
}
for (i = 0; i < nstrv; i++) {
if (_SET_FCN_DO_REMOVE (modifier, value)) {
property_info->property_typ_data->subtype.multilist.remove_by_value_fcn (setting,
strv[i]);
} else {
if (property_info->property_typ_data->subtype.multilist.add2_fcn)
property_info->property_typ_data->subtype.multilist.add2_fcn (setting, strv[i]);
else
property_info->property_typ_data->subtype.multilist.add_fcn (setting, strv[i]);
}
}
return TRUE;
}
static gboolean
_set_fcn_optionlist (ARGS_SET_FCN)
{
gs_free const char **strv = NULL;
gs_free const char **strv_val = NULL;
gsize i, nstrv;
nm_assert (!error || !*error);
if (_SET_FCN_DO_RESET_DEFAULT_WITH_SUPPORTS_REMOVE (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
nstrv = 0;
strv = nm_utils_strsplit_set (value, ",");
if (strv) {
strv_val = g_new (const char *, NM_PTRARRAY_LEN (strv));
for (i = 0; strv[i]; i++) {
const char *opt_name;
const char *opt_value;
opt_name = nm_str_skip_leading_spaces (strv[i]);
/* FIXME: support backslash escaping for the option list. */
opt_value = strchr (opt_name, '=');
if (opt_value) {
((char *) opt_value)[0] = '\0';
opt_value++;
opt_value = nm_str_skip_leading_spaces (opt_value);
g_strchomp ((char *) opt_value);
}
g_strchomp ((char *) opt_name);
if ( property_info->property_type->values_fcn
|| property_info->property_typ_data->values_static) {
gs_strfreev char **valid_options_to_free = NULL;
const char *const*valid_options;
if (property_info->property_type->values_fcn)
valid_options = property_info->property_type->values_fcn (property_info, &valid_options_to_free);
else
valid_options = property_info->property_typ_data->values_static;
opt_name = nmc_string_is_valid (opt_name, (const char **) valid_options, error);
if (!opt_name)
return FALSE;
}
if (opt_value) {
if (_SET_FCN_DO_REMOVE (modifier, value))
opt_value = NULL;
} else {
if (!_SET_FCN_DO_REMOVE (modifier, value)) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' is not valid; use <option>=<value>"),
opt_name);
return FALSE;
}
}
if ( opt_value
&& opt_value[0] == '\0'
&& property_info->property_typ_data->subtype.optionlist.no_empty_value) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("cannot set empty \"%s\" option"),
opt_name);
return FALSE;
}
strv[nstrv] = opt_name;
strv_val[nstrv] = opt_value;
nstrv++;
}
}
if (_SET_FCN_DO_SET_ALL (modifier, value))
_gobject_property_reset (setting, property_info->property_name, FALSE);
for (i = 0; i < nstrv; i++) {
if (!property_info->property_typ_data->subtype.optionlist.set_fcn (setting,
strv[i],
strv_val[i],
error))
return FALSE;
}
return TRUE;
}
static char *
flag_values_to_string (GFlagsValue *array, guint n)
{
GString *str;
guint i;
str = g_string_new (NULL);
for (i = 0; i < n; i++)
g_string_append_printf (str, "%u, ", array[i].value);
if (str->len)
g_string_truncate (str, str->len-2); /* chop off trailing ', ' */
return g_string_free (str, FALSE);
}
static gboolean
validate_flags (NMSetting *setting, const char* prop, guint val, GError **error)
{
GParamSpec *pspec;
GValue value = G_VALUE_INIT;
gboolean success = TRUE;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop);
g_assert (G_IS_PARAM_SPEC (pspec));
g_value_init (&value, pspec->value_type);
g_value_set_flags (&value, val);
if (g_param_value_validate (pspec, &value)) {
GParamSpecFlags *pspec_flags = (GParamSpecFlags *) pspec;
gs_free char *flag_values = NULL;
flag_values = flag_values_to_string (pspec_flags->flags_class->values,
pspec_flags->flags_class->n_values);
g_set_error (error, 1, 0, _("'%u' flags are not valid; use combination of %s"),
val, flag_values);
success = FALSE;
}
g_value_unset (&value);
return success;
}
static gboolean
_set_fcn_gobject_flags (ARGS_SET_FCN)
{
unsigned long val_int;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!nmc_string_to_uint (value, TRUE, 0, G_MAXUINT, &val_int)) {
g_set_error (error, 1, 0, _("'%s' is not a valid number (or out of range)"), value);
return FALSE;
}
/* Validate the flags according to the property spec */
if (!validate_flags (setting, property_info->property_name, (guint) val_int, error))
return FALSE;
g_object_set (setting, property_info->property_name, (guint) val_int, NULL);
return TRUE;
}
static gboolean
_set_fcn_gobject_ssid (ARGS_SET_FCN)
{
gs_unref_bytes GBytes *ssid = NULL;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (strlen (value) > 32) {
g_set_error (error, 1, 0, _("'%s' is not valid"), value);
return FALSE;
}
ssid = g_bytes_new (value, strlen (value));
g_object_set (setting, property_info->property_name, ssid, NULL);
return TRUE;
}
static gboolean
_set_fcn_gobject_ifname (ARGS_SET_FCN)
{
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!nm_utils_is_valid_iface_name (value, error))
return FALSE;
g_object_set (setting, property_info->property_name, value, NULL);
return TRUE;
}
static gboolean
_set_fcn_vpn_service_type (ARGS_SET_FCN)
{
gs_free char *service_name = NULL;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
service_name = nm_vpn_plugin_info_list_find_service_type (nm_vpn_get_plugin_infos (), value);
g_object_set (setting, property_info->property_name, service_name ?: value, NULL);
return TRUE;
}
static const char *const*
_complete_fcn_vpn_service_type (ARGS_COMPLETE_FCN)
{
gsize i, j;
char **values;
values = nm_vpn_plugin_info_list_get_service_types (nm_vpn_get_plugin_infos (), FALSE, TRUE);
if (!values)
return NULL;
if (!text || !*text) {
/* If the prompt text is empty or contains no '.',
* filter out full names. */
for (i = 0, j = 0; values[i]; i++) {
if (strchr (values[i], '.')) {
g_free (values[i]);
continue;
}
if (i != j)
values[j] = values[i];
j++;
}
if (j)
values[j++] = NULL;
else {
g_free (values);
values = NULL;
}
}
return (const char *const*) (*out_to_free = values);
}
static const char *
_multilist_validate_fcn_is_domain (const char *domain, GError **error)
{
//FIXME: implement
return domain;
}
static gboolean
_set_fcn_gobject_bytes (ARGS_SET_FCN)
{
gs_free char *val_strip_free = NULL;
gs_free const char **strv = NULL;
const char *val_strip;
const char **iter;
gs_unref_bytes GBytes *bytes = NULL;
GByteArray *array;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
val_strip = nm_strstrip_avoid_copy_a (300, value, &val_strip_free);
/* First try hex string in the format of AAbbCCDd */
bytes = nm_utils_hexstr2bin (val_strip);
if (bytes)
goto done;
if ( !property_info->property_typ_data
|| !property_info->property_typ_data->subtype.gobject_bytes.legacy_format) {
if (value && value[0]) {
g_set_error_literal (error, 1, 0, _("not a valid hex-string"));
return FALSE;
}
/* accept the empty word to reset the property to %NULL. */
goto done;
}
/* Otherwise, consider the following format: AA b 0xCc D */
strv = nm_utils_strsplit_set (value, " \t");
array = g_byte_array_sized_new (NM_PTRARRAY_LEN (strv));
for (iter = strv; iter && *iter; iter++) {
int v;
guint8 v8;
v = _nm_utils_ascii_str_to_int64 (*iter, 16, 0, 255, -1);
if (v == -1) {
g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter);
g_byte_array_free (array, TRUE);
return FALSE;
}
v8 = v;
g_byte_array_append (array, &v8, 1);
}
bytes = g_byte_array_free_to_bytes (array);
done:
g_object_set (setting, property_info->property_name, bytes, NULL);
return TRUE;
}
/*****************************************************************************/
static gconstpointer
_get_fcn_cert_8021x (ARGS_GET_FCN)
{
NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting);
const NMSetting8021xSchemeVtable *vtable;
char *str = NULL;
RETURN_UNSUPPORTED_GET_TYPE ();
vtable = &nm_setting_8021x_scheme_vtable[property_info->property_typ_data->subtype.cert_8021x.scheme_type];
switch (vtable->scheme_func (s_8021X)) {
case NM_SETTING_802_1X_CK_SCHEME_BLOB:
if ( vtable->is_secret
&& !NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS))
return _get_text_hidden (get_type);
str = bytes_to_string (vtable->blob_func (s_8021X));
break;
case NM_SETTING_802_1X_CK_SCHEME_PATH:
str = g_strdup (vtable->path_func (s_8021X));
break;
case NM_SETTING_802_1X_CK_SCHEME_PKCS11:
str = g_strdup (vtable->uri_func (s_8021X));
break;
case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN:
break;
}
NM_SET_OUT (out_is_default, !str || !str[0]);
RETURN_STR_TO_FREE (str);
}
static gboolean
_set_fcn_cert_8021x (ARGS_SET_FCN)
{
gs_free char *value_to_free = NULL;
NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_PATH;
const NMSetting8021xSchemeVtable *vtable;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
value = nm_strstrip_avoid_copy_a (300, value, &value_to_free);
if (strncmp (value, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11)) == 0)
scheme = NM_SETTING_802_1X_CK_SCHEME_PKCS11;
else if (strncmp (value, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0)
value += NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH);
vtable = &nm_setting_8021x_scheme_vtable[property_info->property_typ_data->subtype.cert_8021x.scheme_type];
if (vtable->is_secret) {
gs_free char *path = NULL;
nm_auto_free_secret char *password_free = NULL;
char *password;
path = g_strdup (value);
password = path + strcspn (path, " \t");
if (password[0] != '\0') {
password[0] = '\0';
while (nm_utils_is_separator (password[0]))
password++;
} else {
password_free = g_strdup (vtable->passwd_func (NM_SETTING_802_1X (setting)));
password = password_free;
}
return vtable->set_private_key_func (NM_SETTING_802_1X (setting),
path,
password,
scheme,
NULL,
error);
} else {
return vtable->set_cert_func (NM_SETTING_802_1X (setting),
value,
scheme,
NULL,
error);
}
}
static gconstpointer
_get_fcn_gobject_bytes (ARGS_GET_FCN)
{
gs_unref_bytes GBytes *bytes = NULL;
char *str;
RETURN_UNSUPPORTED_GET_TYPE ();
g_object_get (setting, property_info->property_name, &bytes, NULL);
str = bytes_to_string (bytes);
NM_SET_OUT (out_is_default, !str || !str[0]);
RETURN_STR_TO_FREE (str);
}
static gconstpointer
_get_fcn_bond_options (ARGS_GET_FCN)
{
NMSettingBond *s_bond = NM_SETTING_BOND (setting);
GString *bond_options_s;
int i;
RETURN_UNSUPPORTED_GET_TYPE ();
bond_options_s = g_string_new (NULL);
for (i = 0; i < nm_setting_bond_get_num_options (s_bond); i++) {
const char *key, *value;
gs_free char *tmp_value = NULL;
char *p;
nm_setting_bond_get_option (s_bond, i, &key, &value);
if (nm_streq0 (key, NM_SETTING_BOND_OPTION_ARP_IP_TARGET)) {
value = tmp_value = g_strdup (value);
for (p = tmp_value; p && *p; p++) {
if (*p == ',')
*p = ' ';
}
}
g_string_append_printf (bond_options_s, "%s=%s,", key, value);
}
g_string_truncate (bond_options_s, bond_options_s->len-1); /* chop off trailing ',' */
NM_SET_OUT (out_is_default, bond_options_s->len == 0);
RETURN_STR_TO_FREE (g_string_free (bond_options_s, FALSE));
}
static gboolean
_optionlist_set_fcn_bond_options (NMSetting *setting,
const char *name,
const char *value,
GError **error)
{
gs_free char *tmp_value = NULL;
char *p;
if (!value) {
nm_setting_bond_remove_option (NM_SETTING_BOND (setting), name);
return TRUE;
}
if (nm_streq (name, NM_SETTING_BOND_OPTION_MODE)) {
value = nmc_bond_validate_mode (value, error);
if (!value)
return FALSE;
} else if (nm_streq (name, NM_SETTING_BOND_OPTION_ARP_IP_TARGET)) {
value = tmp_value = g_strdup (value);
for (p = tmp_value; p && *p; p++)
if (*p == ' ')
*p = ',';
}
if (!nm_setting_bond_add_option (NM_SETTING_BOND (setting), name, value)) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("failed to set bond option \"%s\""),
name);
return FALSE;
}
return TRUE;
}
static const char *
_describe_fcn_bond_options (ARGS_DESCRIBE_FCN)
{
gs_free char *options_str = NULL;
const char **valid_options;
char *s;
valid_options = nm_setting_bond_get_valid_options (NULL);
options_str = g_strjoinv (", ", (char **) valid_options);
s = g_strdup_printf (_("Enter a list of bonding options formatted as:\n"
" option = <value>, option = <value>,... \n"
"Valid options are: %s\n"
"'mode' can be provided as a name or a number:\n"
"balance-rr = 0\n"
"active-backup = 1\n"
"balance-xor = 2\n"
"broadcast = 3\n"
"802.3ad = 4\n"
"balance-tlb = 5\n"
"balance-alb = 6\n\n"
"Example: mode=2,miimon=120\n"), options_str);
return (*out_to_free = s);
}
static const char *const*
_values_fcn_bond_options (ARGS_VALUES_FCN)
{
return nm_setting_bond_get_valid_options (NULL);
}
static gconstpointer
_get_fcn_connection_permissions (ARGS_GET_FCN)
{
NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting);
GString *perm = NULL;
const char *perm_item;
const char *perm_type;
guint i, n;
RETURN_UNSUPPORTED_GET_TYPE ();
n = nm_setting_connection_get_num_permissions (s_con);
for (i = 0; i < n; i++) {
if (!nm_setting_connection_get_permission (s_con, i, &perm_type, &perm_item, NULL))
continue;
if (!perm)
perm = g_string_new (NULL);
else
g_string_append_c (perm, ',');
g_string_append_printf (perm, "%s:%s", perm_type, perm_item);
}
NM_SET_OUT (out_is_default, !perm);
if (perm)
RETURN_STR_TO_FREE (g_string_free (perm, FALSE));
return NULL;
}
static gboolean
_set_fcn_connection_type (ARGS_SET_FCN)
{
gs_free char *uuid = NULL;
if (nm_setting_connection_get_uuid (NM_SETTING_CONNECTION (setting))) {
/* Don't allow setting type unless the connection is brand new.
* Just because it's a bad idea and the user wouldn't probably want that.
* No technical reason, really.
* Also, using uuid to see if the connection is brand new is a bit
* hacky: we can not see if the type is already set, because
* nmc_setting_set_property() is called only after the property
* we're setting (type) has been removed. */
g_set_error (error, 1, 0, _("Can not change the connection type"));
return FALSE;
}
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value)) {
g_object_set (G_OBJECT (setting), property_info->property_name, NULL, NULL);
return TRUE;
}
uuid = nm_utils_uuid_generate ();
g_object_set (G_OBJECT (setting),
NM_SETTING_CONNECTION_UUID, uuid,
NULL);
g_object_set (G_OBJECT (setting), property_info->property_name, value, NULL);
return TRUE;
}
static const char *const*
_complete_fcn_connection_type (ARGS_COMPLETE_FCN)
{
guint i, j;
char **result;
gsize text_len;
result = g_new (char *, _NM_META_SETTING_TYPE_NUM * 2 + 1);
text_len = text ? strlen (text) : 0;
for (i = 0, j = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
const NMMetaSettingInfoEditor *setting_info = &nm_meta_setting_infos_editor[i];
const char *v;
if (!setting_info->valid_parts)
continue;
v = setting_info->alias;
if (v) {
if (!text || strncmp (text, v, text_len) == 0)
result[j++] = g_strdup (v);
}
v = setting_info->general->setting_name;
if (!text || strncmp (text, v, text_len) == 0)
result[j++] = g_strdup (v);
}
if (j)
result[j++] = NULL;
else {
g_free (result);
result = NULL;
}
return (const char *const*) (*out_to_free = result);
}
#define PERM_USER_PREFIX "user:"
static const char *
_sanitize_connection_permission_user (const char *perm)
{
if (NM_STR_HAS_PREFIX (perm, PERM_USER_PREFIX))
perm += NM_STRLEN (PERM_USER_PREFIX);
if (perm[0] == '\0')
return NULL;
if (!g_utf8_validate (perm, -1, NULL))
return NULL;
return perm;
}
static const char *
_multilist_validate2_fcn_connection_permissions (NMSetting *setting,
const char *item,
GError **error)
{
if (!_sanitize_connection_permission_user (item)) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid permission \"%s\""),
item);
return NULL;
}
return item;
}
static gboolean
_multilist_set_fcn_connection_permissions (NMSetting *setting,
const char *item)
{
item = _sanitize_connection_permission_user (item);
nm_setting_connection_add_permission (NM_SETTING_CONNECTION (setting), "user", item, NULL);
return TRUE;
}
static gboolean
_multilist_remove_by_value_fcn_connection_permissions (NMSetting *setting,
const char *item)
{
const char *sanitized;
sanitized = _sanitize_connection_permission_user (item);
nm_setting_connection_remove_permission_by_value (NM_SETTING_CONNECTION (setting), "user", sanitized ?: item, NULL);
return TRUE;
}
static gboolean
_set_fcn_connection_master (ARGS_SET_FCN)
{
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
value = NULL;
else if (!*value)
value = NULL;
else if ( !nm_utils_is_valid_iface_name (value, NULL)
&& !nm_utils_is_uuid (value)) {
g_set_error (error, 1, 0,
_("'%s' is not valid master; use ifname or connection UUID"),
value);
return FALSE;
}
g_object_set (setting, property_info->property_name, value, NULL);
return TRUE;
}
static const char *const*
_complete_fcn_connection_master (ARGS_COMPLETE_FCN)
{
NMRemoteConnection *const*connections = NULL;
guint len = 0;
guint i, j;
char **result;
NMSettingConnection *s_con;
const char *expected_type = NULL;
gsize text_len;
if ( environment
&& environment->get_nm_connections) {
connections = environment->get_nm_connections (environment,
environment_user_data,
&len);
}
if (!len)
return NULL;
if ( (!text || !*text)
&& operation_context
&& operation_context->connection) {
/* if we have no text yet, initially only complete for matching
* slave-type. */
s_con = nm_connection_get_setting_connection (operation_context->connection);
if (s_con)
expected_type = nm_setting_connection_get_slave_type (s_con);
}
text_len = text ? strlen (text) : 0;
result = g_new (char *, (2 * len) + 1);
for (i = 0, j = 0; i < len; i++) {
const char *v;
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connections[i]));
if (!s_con)
continue;
if ( expected_type
&& !nm_streq0 (nm_setting_connection_get_connection_type (s_con),
expected_type))
continue;
if (text && text[0]) {
/* if we have text, also complete for the UUID. */
v = nm_setting_connection_get_uuid (s_con);
if (v && (!text || strncmp (text, v, text_len) == 0))
result[j++] = g_strdup (v);
}
v = nm_setting_connection_get_interface_name (s_con);
if (v && (!text || strncmp (text, v, text_len) == 0))
result[j++] = g_strdup (v);
}
if (j)
result[j++] = NULL;
else {
g_free (result);
result = NULL;
}
return (const char *const*) (*out_to_free = result);
}
static const char *
_multilist_validate2_fcn_uuid (NMSetting *setting,
const char *item,
GError **error)
{
if (!nm_utils_is_uuid (item)) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("the value '%s' is not a valid UUID"),
item);
return NULL;
}
return item;
}
static gconstpointer
_get_fcn_connection_metered (ARGS_GET_FCN)
{
NMSettingConnection *s_conn = NM_SETTING_CONNECTION (setting);
const char *s;
RETURN_UNSUPPORTED_GET_TYPE ();
switch (nm_setting_connection_get_metered (s_conn)) {
case NM_METERED_YES:
s = N_("yes");
break;
case NM_METERED_NO:
s = N_("no");
break;
case NM_METERED_UNKNOWN:
default:
NM_SET_OUT (out_is_default, TRUE);
s = N_("unknown");
break;
}
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _(s);
return s;
}
static gboolean
_set_fcn_connection_metered (ARGS_SET_FCN)
{
NMMetered metered;
NMTernary ts_val;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!nmc_string_to_ternary (value, &ts_val, error))
return FALSE;
switch (ts_val) {
case NM_TERNARY_TRUE:
metered = NM_METERED_YES;
break;
case NM_TERNARY_FALSE:
metered = NM_METERED_NO;
break;
case NM_TERNARY_DEFAULT:
metered = NM_METERED_UNKNOWN;
break;
default:
g_assert_not_reached();
}
g_object_set (setting, property_info->property_name, metered, NULL);
return TRUE;
}
static char *
dcb_flags_to_string (NMSettingDcbFlags flags)
{
GString *flag_str;
if (flags == 0)
return g_strdup (_("0 (disabled)"));
flag_str = g_string_new (NULL);
g_string_printf (flag_str, "%d (", flags);
if (flags & NM_SETTING_DCB_FLAG_ENABLE)
g_string_append (flag_str, _("enabled, "));
if (flags & NM_SETTING_DCB_FLAG_ADVERTISE)
g_string_append (flag_str, _("advertise, "));
if (flags & NM_SETTING_DCB_FLAG_WILLING)
g_string_append (flag_str, _("willing, "));
if (flag_str->str[flag_str->len-1] == '(')
g_string_append (flag_str, _("unknown"));
else
g_string_truncate (flag_str, flag_str->len-2); /* chop off trailing ', ' */
g_string_append_c (flag_str, ')');
return g_string_free (flag_str, FALSE);
}
static gconstpointer
_get_fcn_dcb (ARGS_GET_FCN)
{
NMSettingDcb *s_dcb = NM_SETTING_DCB (setting);
GString *str;
guint i;
RETURN_UNSUPPORTED_GET_TYPE ();
str = g_string_new (NULL);
for (i = 0; i < 8; i++) {
guint v;
v = property_info->property_typ_data->subtype.dcb.get_fcn (s_dcb, i);
if (i > 0)
g_string_append_c (str, ',');
g_string_append_printf (str, "%u", v);
}
RETURN_STR_TO_FREE (g_string_free (str, FALSE));
}
#define DCB_ALL_FLAGS (NM_SETTING_DCB_FLAG_ENABLE | NM_SETTING_DCB_FLAG_ADVERTISE | NM_SETTING_DCB_FLAG_WILLING)
static gconstpointer
_get_fcn_dcb_flags (ARGS_GET_FCN)
{
nm_auto_unset_gvalue GValue val = G_VALUE_INIT;
guint v;
RETURN_UNSUPPORTED_GET_TYPE ();
g_value_init (&val, G_TYPE_UINT);
g_object_get_property (G_OBJECT (setting), property_info->property_name, &val);
v = g_value_get_uint (&val);
RETURN_STR_TO_FREE (dcb_flags_to_string (v));
}
static gboolean
_set_fcn_dcb_flags (ARGS_SET_FCN)
{
NMSettingDcbFlags flags = NM_SETTING_DCB_FLAG_NONE;
long int t;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
/* Check for overall hex numeric value */
t = _nm_utils_ascii_str_to_int64 (value, 0, 0, DCB_ALL_FLAGS, -1);
if (t != -1)
flags = (guint) t;
else {
gs_free const char **strv = NULL;
const char *const*iter;
/* Check for individual flag numbers */
strv = nm_utils_strsplit_set (value, " \t,");
for (iter = strv; iter && *iter; iter++) {
t = _nm_utils_ascii_str_to_int64 (*iter, 0, 0, DCB_ALL_FLAGS, -1);
if ( g_ascii_strcasecmp (*iter, "enable") == 0
|| g_ascii_strcasecmp (*iter, "enabled") == 0
|| t == NM_SETTING_DCB_FLAG_ENABLE)
flags |= NM_SETTING_DCB_FLAG_ENABLE;
else if ( g_ascii_strcasecmp (*iter, "advertise") == 0
|| t == NM_SETTING_DCB_FLAG_ADVERTISE)
flags |= NM_SETTING_DCB_FLAG_ADVERTISE;
else if ( g_ascii_strcasecmp (*iter, "willing") == 0
|| t == NM_SETTING_DCB_FLAG_WILLING)
flags |= NM_SETTING_DCB_FLAG_WILLING;
else if ( g_ascii_strcasecmp (*iter, "disable") == 0
|| g_ascii_strcasecmp (*iter, "disabled") == 0
|| t == 0) {
/* pass */
} else {
g_set_error (error, 1, 0, _("'%s' is not a valid DCB flag"), *iter);
return FALSE;
}
}
}
/* Validate the flags according to the property spec */
if (!validate_flags (setting, property_info->property_name, (guint) flags, error))
return FALSE;
g_object_set (setting, property_info->property_name, (guint) flags, NULL);
return TRUE;
}
static gboolean
dcb_parse_uint_array (const char *val,
guint max,
guint other,
guint out_array[static 8],
GError **error)
{
gs_free const char **items = NULL;
const char *const*iter;
gsize i;
items = nm_utils_strsplit_set_with_empty (val, ",");
if (NM_PTRARRAY_LEN (items) != 8) {
g_set_error_literal (error, 1, 0, _("must contain 8 comma-separated numbers"));
return FALSE;
}
i = 0;
for (iter = items; *iter; iter++) {
gint64 num;
num = _nm_utils_ascii_str_to_int64 (*iter, 10, 0, other ?: max, -1);
/* If number is greater than 'max' it must equal 'other' */
if ( num == -1
|| (other && (num > max) && (num != other))) {
if (other) {
g_set_error (error, 1, 0, _("'%s' not a number between 0 and %u (inclusive) or %u"),
*iter, max, other);
} else {
g_set_error (error, 1, 0, _("'%s' not a number between 0 and %u (inclusive)"),
*iter, max);
}
return FALSE;
}
nm_assert (i < 8);
out_array[i++] = (guint) num;
}
return TRUE;
}
static void
dcb_check_feature_enabled (const NMMetaEnvironment *environment, gpointer *environment_user_data, NMSettingDcb *s_dcb, const char *flags_prop)
{
NMSettingDcbFlags flags = NM_SETTING_DCB_FLAG_NONE;
g_object_get (s_dcb, flags_prop, &flags, NULL);
if (!(flags & NM_SETTING_DCB_FLAG_ENABLE)) {
_env_warn_fcn (environment, environment_user_data,
NM_META_ENV_WARN_LEVEL_WARN,
N_("changes will have no effect until '%s' includes 1 (enabled)"),
flags_prop);
}
}
static gboolean
_set_fcn_dcb (ARGS_SET_FCN)
{
guint i = 0;
guint nums[8] = { 0, };
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!dcb_parse_uint_array (value,
property_info->property_typ_data->subtype.dcb.max,
property_info->property_typ_data->subtype.dcb.other,
nums,
error))
return FALSE;
if (property_info->property_typ_data->subtype.dcb.is_percent) {
guint sum = 0;
for (i = 0; i < 8; i++) {
sum += nums[i];
if (nums[i] > 100 || sum > 100)
break;
}
if (sum != 100) {
g_set_error_literal (error, 1, 0, _("bandwidth percentages must total 100%%"));
return FALSE;
}
}
for (i = 0; i < 8; i++)
property_info->property_typ_data->subtype.dcb.set_fcn (NM_SETTING_DCB (setting), i, nums[i]);
dcb_check_feature_enabled (environment, environment_user_data, NM_SETTING_DCB (setting), NM_SETTING_DCB_PRIORITY_GROUP_FLAGS);
return TRUE;
}
static gconstpointer
_get_fcn_dcb_bool (ARGS_GET_FCN)
{
NMSettingDcb *s_dcb = NM_SETTING_DCB (setting);
GString *str;
guint i;
RETURN_UNSUPPORTED_GET_TYPE ();
str = g_string_new (NULL);
for (i = 0; i < 8; i++) {
gboolean v;
v = property_info->property_typ_data->subtype.dcb_bool.get_fcn (s_dcb, i);
if (i > 0)
g_string_append_c (str, ',');
g_string_append_c (str, v ? '1': '0');
}
RETURN_STR_TO_FREE (g_string_free (str, FALSE));
}
static gboolean
_set_fcn_dcb_bool (ARGS_SET_FCN)
{
guint i = 0;
guint nums[8] = { 0, };
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!dcb_parse_uint_array (value, 1, 0, nums, error))
return FALSE;
for (i = 0; i < 8; i++) {
property_info->property_typ_data->subtype.dcb_bool.set_fcn (NM_SETTING_DCB (setting),
i,
!!nums[i]);
}
dcb_check_feature_enabled (environment,
environment_user_data,
NM_SETTING_DCB (setting),
( property_info->property_typ_data->subtype.dcb_bool.with_flow_control_flags
? NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS
: NM_SETTING_DCB_PRIORITY_GROUP_FLAGS));
return TRUE;
}
static gboolean
_set_fcn_gsm_sim_operator_id (ARGS_SET_FCN)
{
const char *p = value;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!NM_IN_SET (strlen (value), 5, 6)) {
g_set_error_literal (error, 1, 0, _("SIM operator ID must be a 5 or 6 number MCCMNC code"));
return FALSE;
}
while (p && *p) {
if (!g_ascii_isdigit (*p++)) {
g_set_error_literal (error, 1, 0, _("SIM operator ID must be a 5 or 6 number MCCMNC code"));
return FALSE;
}
}
g_object_set (G_OBJECT (setting),
NM_SETTING_GSM_SIM_OPERATOR_ID,
value,
NULL);
return TRUE;
}
static gboolean
_set_fcn_infiniband_p_key (ARGS_SET_FCN)
{
gint64 p_key;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (nm_streq (value, "default"))
p_key = -1;
else {
p_key = _nm_utils_ascii_str_to_int64 (value, 0, -1, G_MAXUINT16, -2);
if (p_key == -2) {
g_set_error (error, 1, 0, _("'%s' is not a valid IBoIP P_Key"), value);
return FALSE;
}
}
g_object_set (setting, property_info->property_name, (int) p_key, NULL);
return TRUE;
}
static gconstpointer
_get_fcn_infiniband_p_key (ARGS_GET_FCN)
{
NMSettingInfiniband *s_infiniband = NM_SETTING_INFINIBAND (setting);
int p_key;
RETURN_UNSUPPORTED_GET_TYPE ();
p_key = nm_setting_infiniband_get_p_key (s_infiniband);
if (p_key == -1) {
NM_SET_OUT (out_is_default, TRUE);
if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY)
return "default";
else
return _("default");
}
RETURN_STR_TO_FREE (g_strdup_printf ("0x%04x", p_key));
}
static gconstpointer
_get_fcn_objlist (ARGS_GET_FCN)
{
GString *str = NULL;
guint num;
guint idx;
RETURN_UNSUPPORTED_GET_TYPE ();
num = property_info->property_typ_data->subtype.objlist.get_num_fcn (setting);
for (idx = 0; idx < num; idx++) {
gsize start_offset;
if (!str)
str = g_string_new (NULL);
else if (str->len > 0) {
if ( get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY
&& property_info->property_typ_data->subtype.objlist.delimit_pretty_with_semicolon)
g_string_append (str, "; ");
else {
G_STATIC_ASSERT_EXPR (ESCAPED_TOKENS_DELIMITER == ',');
g_string_append (str, ", ");
}
}
start_offset = str->len;
property_info->property_typ_data->subtype.objlist.obj_to_str_fcn (get_type,
setting,
idx,
str);
if (start_offset == str->len) {
/* nothing was appended. Remove the delimiter again. */
nm_assert_not_reached ();
if (str->len > 0)
g_string_truncate (str, str->len - 2);
continue;
}
#if NM_MORE_ASSERTS
nm_assert (start_offset < str->len);
if ( property_info->property_typ_data->subtype.objlist.strsplit_with_escape
&& get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) {
/* if the strsplit is done with VALUE_STRSPLIT_MODE_OBJLIST_WITH_ESCAPE, then the appended
* value must have no unescaped ','. */
for (; start_offset < str->len; ) {
if (str->str[start_offset] == '\\') {
start_offset++;
nm_assert (start_offset < str->len);
nm_assert (!NM_IN_SET (str->str[start_offset], '\0'));
} else
nm_assert (!NM_IN_SET (str->str[start_offset], '\0', ','));
start_offset++;
}
}
#endif
}
NM_SET_OUT (out_is_default, num == 0);
if (str)
RETURN_STR_TO_FREE (g_string_free (str, FALSE));
return NULL;
}
static void
_objlist_obj_to_str_fcn_ip_config_addresses (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
NMIPAddress *obj;
obj = nm_setting_ip_config_get_address (NM_SETTING_IP_CONFIG (setting),
idx);
g_string_append_printf (str,
"%s/%u",
nm_ip_address_get_address (obj),
nm_ip_address_get_prefix (obj));
}
static void
_objlist_obj_to_str_fcn_ip_config_routes (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
NMIPRoute *route;
gs_free char *attr_str = NULL;
gs_strfreev char **attr_names = NULL;
gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal);
int j;
route = nm_setting_ip_config_get_route (NM_SETTING_IP_CONFIG (setting), idx);
attr_names = nm_ip_route_get_attribute_names (route);
for (j = 0; attr_names && attr_names[j]; j++) {
g_hash_table_insert (hash, attr_names[j],
nm_ip_route_get_attribute (route, attr_names[j]));
}
attr_str = nm_utils_format_variant_attributes (hash, ' ', '=');
if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) {
g_string_append_printf (str, "%s/%u",
nm_ip_route_get_dest (route),
nm_ip_route_get_prefix (route));
if (nm_ip_route_get_next_hop (route))
g_string_append_printf (str, " %s", nm_ip_route_get_next_hop (route));
if (nm_ip_route_get_metric (route) != -1)
g_string_append_printf (str, " %u", (guint32) nm_ip_route_get_metric (route));
if (attr_str)
g_string_append_printf (str, " %s", attr_str);
} else {
g_string_append (str, "{ ");
g_string_append_printf (str, "ip = %s/%u",
nm_ip_route_get_dest (route),
nm_ip_route_get_prefix (route));
if (nm_ip_route_get_next_hop (route)) {
g_string_append_printf (str, ", nh = %s",
nm_ip_route_get_next_hop (route));
}
if (nm_ip_route_get_metric (route) != -1)
g_string_append_printf (str, ", mt = %u", (guint32) nm_ip_route_get_metric (route));
if (attr_str)
g_string_append_printf (str, " %s", attr_str);
g_string_append (str, " }");
}
}
static gboolean
_set_fcn_ip_config_method (ARGS_SET_FCN)
{
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
/* Silently accept "static" and convert to "manual" */
if ( strlen (value) > 1
&& matches (value, "static")) {
if (nm_setting_ip_config_get_addr_family (NM_SETTING_IP_CONFIG (setting)) == AF_INET)
value = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
else
value = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
}
value = nmc_string_is_valid (value,
(const char **) property_info->property_typ_data->values_static,
error);
if (!value)
return FALSE;
g_object_set (setting, property_info->property_name, value, NULL);
return TRUE;
}
static const char *
_multilist_validate2_fcn_ip_config_dns (NMSetting *setting,
const char *value,
GError **error)
{
int addr_family = nm_setting_ip_config_get_addr_family (NM_SETTING_IP_CONFIG (setting));
if (!nm_utils_parse_inaddr (addr_family, value, NULL)) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid IPv%c address '%s'"),
nm_utils_addr_family_to_char (addr_family),
value);
return NULL;
}
return value;
}
static gboolean
_multilist_add_fcn_ip_config_dns_options (NMSetting *setting,
const char *item)
{
NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting);
if (!nm_setting_ip_config_add_dns_option (s_ip, item)) {
/* maybe it failed, because the element already existed. *sigh*. */
nm_setting_ip_config_remove_dns_option_by_value (s_ip, item);
return nm_setting_ip_config_add_dns_option (s_ip, item);
}
return TRUE;
}
static gboolean
_set_fcn_objlist (ARGS_SET_FCN)
{
gs_free const char **strv = NULL;
gsize i, nstrv;
if (_SET_FCN_DO_RESET_DEFAULT_WITH_SUPPORTS_REMOVE (property_info, modifier, value)) {
if (property_info->property_typ_data->subtype.objlist.clear_all_fcn) {
property_info->property_typ_data->subtype.objlist.clear_all_fcn (setting);
return TRUE;
}
return _gobject_property_reset_default (setting, property_info->property_name);
}
if ( _SET_FCN_DO_REMOVE (modifier, value)
&& ( property_info->property_typ_data->subtype.objlist.remove_by_idx_fcn_u
|| property_info->property_typ_data->subtype.objlist.remove_by_idx_fcn_s)) {
gs_free gint64 *indexes = NULL;
indexes = _value_str_as_index_list (value, &nstrv);
if (indexes) {
gint64 num;
num = property_info->property_typ_data->subtype.objlist.get_num_fcn (setting);
for (i = 0; i < nstrv; i++) {
gint64 idx = indexes[i];
if (idx >= num)
continue;
if (property_info->property_typ_data->subtype.objlist.remove_by_idx_fcn_u)
property_info->property_typ_data->subtype.objlist.remove_by_idx_fcn_u (setting, idx);
else
property_info->property_typ_data->subtype.objlist.remove_by_idx_fcn_s (setting, idx);
}
return TRUE;
}
}
strv = _value_strsplit (value,
property_info->property_typ_data->subtype.objlist.strsplit_plain
? VALUE_STRSPLIT_MODE_OBJLIST
: ( property_info->property_typ_data->subtype.objlist.strsplit_with_escape
? VALUE_STRSPLIT_MODE_OBJLIST_WITH_ESCAPE
: VALUE_STRSPLIT_MODE_ESCAPED_TOKENS),
&nstrv);
if (_SET_FCN_DO_SET_ALL (modifier, value)) {
if (property_info->property_typ_data->subtype.objlist.clear_all_fcn)
property_info->property_typ_data->subtype.objlist.clear_all_fcn (setting);
else
_gobject_property_reset (setting, property_info->property_name, FALSE);
}
for (i = 0; i < nstrv; i++) {
/* FIXME: there is the problem here that set_fcn() might succed on the first item
* (modifying it), and fail to parse the second one.
*
* Optimally, we would first parse all input strings before starting the
* modify the setting. The setting should only be modified if (and only if)
* the entire operation succeeds to set all items.
*
* Currently, in interactive mode this leads to odd behavior.
*
* This does not only affect objlist.set_fcn() or _pt_objlist properties.
* E.g. we also call _gobject_property_reset() before validating the input. */
if (!property_info->property_typ_data->subtype.objlist.set_fcn (setting,
!_SET_FCN_DO_REMOVE (modifier, value),
strv[i],
error))
return FALSE;
}
return TRUE;
}
static gboolean
_objlist_set_fcn_ip_config_addresses (NMSetting *setting,
gboolean do_add,
const char *value,
GError **error)
{
int addr_family = nm_setting_ip_config_get_addr_family (NM_SETTING_IP_CONFIG (setting));
nm_auto_unref_ip_address NMIPAddress *addr = NULL;
addr = _parse_ip_address (addr_family, value, error);
if (!addr)
return FALSE;
if (do_add)
nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), addr);
else
nm_setting_ip_config_remove_address_by_value (NM_SETTING_IP_CONFIG (setting), addr);
return TRUE;
}
static gboolean
_set_fcn_ip_config_gateway (ARGS_SET_FCN)
{
gs_free char *value_to_free = NULL;
int addr_family = nm_setting_ip_config_get_addr_family (NM_SETTING_IP_CONFIG (setting));
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
value = nm_strstrip_avoid_copy_a (300, value, &value_to_free);
if (!nm_utils_ipaddr_valid (addr_family, value)) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("invalid gateway address '%s'"),
value);
return FALSE;
}
g_object_set (setting, property_info->property_name, value, NULL);
return TRUE;
}
static gboolean
_objlist_set_fcn_ip_config_routes (NMSetting *setting,
gboolean do_add,
const char *value,
GError **error)
{
int addr_family = nm_setting_ip_config_get_addr_family (NM_SETTING_IP_CONFIG (setting));
nm_auto_unref_ip_route NMIPRoute *route = NULL;
route = _parse_ip_route (addr_family, value, error);
if (!route)
return FALSE;
if (do_add)
nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), route);
else
nm_setting_ip_config_remove_route_by_value (NM_SETTING_IP_CONFIG (setting), route);
return TRUE;
}
static gboolean
_is_default_func_ip_config_dns_options (NMSetting *setting)
{
return nm_setting_ip_config_has_dns_options (NM_SETTING_IP_CONFIG (setting))
&& !nm_setting_ip_config_get_num_dns_options (NM_SETTING_IP_CONFIG (setting));
}
static void
_objlist_obj_to_str_fcn_ip_config_routing_rules (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
NMIPRoutingRule *rule;
gs_free char *s = NULL;
rule = nm_setting_ip_config_get_routing_rule (NM_SETTING_IP_CONFIG (setting), idx);
s = nm_ip_routing_rule_to_string (rule,
NM_IP_ROUTING_RULE_AS_STRING_FLAGS_NONE,
NULL,
NULL);
if (s)
nm_utils_escaped_tokens_escape_gstr (s, ESCAPED_TOKENS_DELIMITERS, str);
}
static gboolean
_objlist_set_fcn_ip_config_routing_rules (NMSetting *setting,
gboolean do_add,
const char *str,
GError **error)
{
NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting);
nm_auto_unref_ip_routing_rule NMIPRoutingRule *rule = NULL;
guint i, n;
rule = nm_ip_routing_rule_from_string (str,
( NM_IP_ROUTING_RULE_AS_STRING_FLAGS_VALIDATE
| ( NM_IS_SETTING_IP4_CONFIG (setting)
? NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET
: NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET6)),
NULL,
error);
if (!rule)
return FALSE;
/* also for @do_add, we first always search whether such a rule already exist
* and remove the first occurance.
*
* The effect is, that we don't add multiple times the same rule,
* and that if the rule already exists, it gets moved to the end (append).
*/
n = nm_setting_ip_config_get_num_routing_rules (s_ip);
for (i = 0; i < n; i++) {
NMIPRoutingRule *rr;
rr = nm_setting_ip_config_get_routing_rule (s_ip, i);
if (nm_ip_routing_rule_cmp (rule, rr) == 0) {
nm_setting_ip_config_remove_routing_rule (s_ip, i);
break;
}
}
if (do_add)
nm_setting_ip_config_add_routing_rule (s_ip, rule);
return TRUE;
}
static gconstpointer
_get_fcn_match_interface_name (ARGS_GET_FCN)
{
NMSettingMatch *s_match = NM_SETTING_MATCH (setting);
GString *str = NULL;
guint i, num;
RETURN_UNSUPPORTED_GET_TYPE ();
num = nm_setting_match_get_num_interface_names (s_match);
for (i = 0; i < num; i++) {
gs_free char *to_free = NULL;
const char *name;
name = nm_setting_match_get_interface_name (s_match, i);
if (!name || !name[0])
continue;
if (!str)
str = g_string_new ("");
else
g_string_append_c (str, ' ');
g_string_append (str, _value_strescape (name, &to_free));
}
NM_SET_OUT (out_is_default, num == 0);
if (!str)
return NULL;
RETURN_STR_TO_FREE (g_string_free (str, FALSE));
}
static gconstpointer
_get_fcn_olpc_mesh_ssid (ARGS_GET_FCN)
{
NMSettingOlpcMesh *s_olpc_mesh = NM_SETTING_OLPC_MESH (setting);
GBytes *ssid;
char *ssid_str = NULL;
RETURN_UNSUPPORTED_GET_TYPE ();
ssid = nm_setting_olpc_mesh_get_ssid (s_olpc_mesh);
if (ssid) {
ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL),
g_bytes_get_size (ssid));
}
NM_SET_OUT (out_is_default, !ssid_str);
RETURN_STR_TO_FREE (ssid_str);
}
static gboolean
_set_fcn_olpc_mesh_channel (ARGS_SET_FCN)
{
unsigned long chan_int;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!nmc_string_to_uint (value, TRUE, 1, 13, &chan_int)) {
g_set_error (error, 1, 0, _("'%s' is not a valid channel; use <1-13>"), value);
return FALSE;
}
g_object_set (setting, property_info->property_name, chan_int, NULL);
return TRUE;
}
static const char *
_validate_fcn_proxy_pac_script (const char *value, char **out_to_free, GError **error)
{
char *script = NULL;
if (!nmc_proxy_check_script (value, &script, error))
return NULL;
RETURN_STR_TO_FREE (script);
}
static void
_objlist_obj_to_str_fcn_sriov_vfs (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
gs_free char *s = NULL;
NMSriovVF *vf;
vf = nm_setting_sriov_get_vf (NM_SETTING_SRIOV (setting), idx);
s = nm_utils_sriov_vf_to_str (vf, FALSE, NULL);
if (s)
g_string_append (str, s);
}
static void
_objlist_obj_to_str_fcn_tc_config_qdiscs (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
gs_free char *s = NULL;
NMTCQdisc *qdisc;
qdisc = nm_setting_tc_config_get_qdisc (NM_SETTING_TC_CONFIG (setting), idx);
s = nm_utils_tc_qdisc_to_str (qdisc, NULL);
if (s)
g_string_append (str, s);
}
static void
_objlist_obj_to_str_fcn_bridge_vlans (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
gs_free char *s = NULL;
NMBridgeVlan *vlan;
if (NM_IS_SETTING_BRIDGE (setting))
vlan = nm_setting_bridge_get_vlan (NM_SETTING_BRIDGE (setting), idx);
else
vlan = nm_setting_bridge_port_get_vlan (NM_SETTING_BRIDGE_PORT (setting), idx);
s = nm_bridge_vlan_to_str (vlan, NULL);
if (s)
nm_utils_escaped_tokens_escape_gstr_assert (s, ESCAPED_TOKENS_DELIMITERS, str);
}
static gboolean
_objlist_set_fcn_sriov_vfs (NMSetting *setting,
gboolean do_add,
const char *value,
GError **error)
{
nm_auto_unref_sriov_vf NMSriovVF *vf = NULL;
gs_free_error GError *local = NULL;
vf = nm_utils_sriov_vf_from_str (value, &local);
if (!vf) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
"%s. %s",
local->message,
_("The valid syntax is: vf [attribute=value]... [,vf [attribute=value]...]"));
return FALSE;
}
if (do_add)
nm_setting_sriov_add_vf (NM_SETTING_SRIOV (setting), vf);
else
nm_setting_sriov_remove_vf_by_index (NM_SETTING_SRIOV (setting), nm_sriov_vf_get_index (vf));
return TRUE;
}
static gboolean
_objlist_set_fcn_tc_config_qdiscs (NMSetting *setting,
gboolean do_add,
const char *value,
GError **error)
{
nm_auto_unref_tc_qdisc NMTCQdisc *tc_qdisc = NULL;
gs_free_error GError *local = NULL;
tc_qdisc = nm_utils_tc_qdisc_from_str (value, &local);
if (!tc_qdisc) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
"%s. %s",
local->message,
_("The valid syntax is: '[root | parent <handle>] [handle <handle>] <kind>'"));
return FALSE;
}
if (do_add)
nm_setting_tc_config_add_qdisc (NM_SETTING_TC_CONFIG (setting), tc_qdisc);
else
nm_setting_tc_config_remove_qdisc_by_value (NM_SETTING_TC_CONFIG (setting), tc_qdisc);
return TRUE;
}
static gboolean
_objlist_set_fcn_bridge_vlans (NMSetting *setting,
gboolean do_add,
const char *value,
GError **error)
{
nm_auto_unref_bridge_vlan NMBridgeVlan *vlan = NULL;
gs_free_error GError *local = NULL;
guint16 vid_start, vid_end;
vlan = nm_bridge_vlan_from_str (value, &local);
if (!vlan) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
"%s. %s",
local->message,
_("The valid syntax is: '<vid>[-<vid>] [pvid] [untagged]'"));
return FALSE;
}
if (NM_IS_SETTING_BRIDGE (setting)) {
if (do_add)
nm_setting_bridge_add_vlan (NM_SETTING_BRIDGE (setting), vlan);
else {
nm_bridge_vlan_get_vid_range (vlan, &vid_start, &vid_end);
nm_setting_bridge_remove_vlan_by_vid (NM_SETTING_BRIDGE (setting),
vid_start, vid_end);
}
} else {
if (do_add)
nm_setting_bridge_port_add_vlan (NM_SETTING_BRIDGE_PORT (setting), vlan);
else {
nm_bridge_vlan_get_vid_range (vlan, &vid_start, &vid_end);
nm_setting_bridge_port_remove_vlan_by_vid (NM_SETTING_BRIDGE_PORT (setting),
vid_start,
vid_end);
}
}
return TRUE;
}
static void
_objlist_obj_to_str_fcn_tc_config_tfilters (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
NMTCTfilter *tfilter;
gs_free char *s = NULL;
tfilter = nm_setting_tc_config_get_tfilter (NM_SETTING_TC_CONFIG (setting), idx);
s = nm_utils_tc_tfilter_to_str (tfilter, NULL);
if (s)
g_string_append (str, s);
}
static gboolean
_objlist_set_fcn_tc_config_tfilters (NMSetting *setting,
gboolean do_add,
const char *value,
GError **error)
{
gs_free_error GError *local = NULL;
nm_auto_unref_tc_tfilter NMTCTfilter *tc_tfilter = NULL;
tc_tfilter = nm_utils_tc_tfilter_from_str (value, &local);
if (!tc_tfilter) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
"%s. %s",
local->message,
_("The valid syntax is: '[root | parent <handle>] [handle <handle>] <kind>'"));
return FALSE;
}
if (do_add)
nm_setting_tc_config_add_tfilter (NM_SETTING_TC_CONFIG (setting), tc_tfilter);
else
nm_setting_tc_config_remove_tfilter_by_value (NM_SETTING_TC_CONFIG (setting), tc_tfilter);
return TRUE;
}
static const char *
_validate_fcn_team_config (const char *value, char **out_to_free, GError **error)
{
char *json = NULL;
if (!nmc_team_check_config (value, &json, error))
return NULL;
RETURN_STR_TO_FREE (json);
}
static void
_multilist_clear_all_fcn_team_runner_tx_hash (NMSetting *setting)
{
/* Workaround libnm bug (confirmed against version 1.16.0).
* We need to both clear the GObject property and call the libnm API.
*
* This workaround was added in nmcli as [1]. This needs fixing in libnm.
*
* Without this, CI test "team_abs_set_runner_tx_hash" fails.
* Try (without the following workaround): */
#if 0
$ (nmcli connection delete team0 ; :); \
nmcli connection add type team con-name team0 ifname team0 autoconnect no \
team.runner lacp && \
echo ">>> FIRST:" && \
PAGER= nmcli -o connection show team0 && \
nmcli connection modify team0 team.runner-tx-hash l3 && \
echo ">>> AFTER:" && \
PAGER= nmcli -o connection show team0
#endif
/* See also:
*
* - https://github.com/NetworkManager/NetworkManager/pull/318
* - https://bugzilla.redhat.com/show_bug.cgi?id=1691619
*
* [1] https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=350dbb55abf3a80267c398e6f64c2cee4645475a
*/
/* it appears, we don't really need _gobject_property_reset(). Just to be sure
* also call it. */
_gobject_property_reset (setting, NM_SETTING_TEAM_RUNNER_TX_HASH, FALSE);
while (nm_setting_team_get_num_runner_tx_hash (NM_SETTING_TEAM (setting)))
nm_setting_team_remove_runner_tx_hash (NM_SETTING_TEAM (setting), 0);
}
static void
_objlist_clear_all_fcn_team_link_watchers (NMSetting *setting)
{
/* the same workaround as _multilist_clear_all_fcn_team_runner_tx_hash() above.
*
* Reproduce with: */
#if 0
$ (nmcli connection delete team0 ; :); \
nmcli connection add type team con-name team0 ifname team0 autoconnect no \
team.link-watchers 'name=arp_ping source-host=172.16.1.1 target-host=172.16.1.254, name=ethtool delay-up=3' && \
echo ">>> FIRST:" && \
PAGER= nmcli -o connection show team0 && \
nmcli connection modify team0 team.link-watchers 'name=ethtool delay-up=4' && \
echo ">>> AFTER:" && \
PAGER= nmcli -o connection show team0
(nmcli connection delete team0-slave ; :); \
nmcli connection add type ethernet con-name team0-slave master team0 slave-type team ifname eth0 autoconnect no \
team-port.link-watchers 'name=arp_ping source-host=172.16.1.1 target-host=172.16.1.254, name=ethtool delay-up=3' && \
echo ">>> FIRST:" && \
PAGER= nmcli -o connection show team0-slave && \
nmcli connection modify team0-slave team.link-watchers 'name=ethtool delay-up=4' && \
echo ">>> AFTER:" && \
PAGER= nmcli -o connection show team0-slave
#endif
/* See also:
*
* - https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=72bf38cad6ca6033d0117bf67b0e726001922d8f
* - https://github.com/NetworkManager/NetworkManager/pull/318
* - https://bugzilla.redhat.com/show_bug.cgi?id=1691619
*/
/* In this case, it appears both GObject reset and nm_setting_team*_clear_link_watchers()
* work (on their own). So, we might not need the workaround.
* Just to be sure, as something is not right with libnm here. */
if (NM_IS_SETTING_TEAM (setting)) {
_gobject_property_reset (setting, NM_SETTING_TEAM_LINK_WATCHERS, FALSE);
nm_setting_team_clear_link_watchers (NM_SETTING_TEAM (setting));
} else {
_gobject_property_reset (setting, NM_SETTING_TEAM_PORT_LINK_WATCHERS, FALSE);
nm_setting_team_port_clear_link_watchers (NM_SETTING_TEAM_PORT (setting));
}
}
static void
_objlist_obj_to_str_fcn_team_link_watchers (NMMetaAccessorGetType get_type,
NMSetting *setting,
guint idx,
GString *str)
{
NMTeamLinkWatcher *watcher;
gs_free char *s = NULL;
if (NM_IS_SETTING_TEAM (setting))
watcher = nm_setting_team_get_link_watcher (NM_SETTING_TEAM (setting), idx);
else
watcher = nm_setting_team_port_get_link_watcher (NM_SETTING_TEAM_PORT (setting), idx);
s = _dump_team_link_watcher (watcher);
if (s)
g_string_append (str, s);
}
static gboolean
_objlist_set_fcn_team_link_watchers (NMSetting *setting,
gboolean do_add,
const char *value,
GError **error)
{
nm_auto_unref_team_link_watcher NMTeamLinkWatcher *watcher = NULL;
watcher = _parse_team_link_watcher (value, error);
if (!watcher)
return FALSE;
if (NM_IS_SETTING_TEAM (setting)) {
if (do_add)
nm_setting_team_add_link_watcher (NM_SETTING_TEAM (setting), watcher);
else
nm_setting_team_remove_link_watcher_by_value (NM_SETTING_TEAM (setting), watcher);
} else {
if (do_add)
nm_setting_team_port_add_link_watcher (NM_SETTING_TEAM_PORT (setting), watcher);
else
nm_setting_team_port_remove_link_watcher_by_value (NM_SETTING_TEAM_PORT (setting), watcher);
}
return TRUE;
}
static gconstpointer
_get_fcn_vlan_flags (ARGS_GET_FCN)
{
NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
guint32 flags;
RETURN_UNSUPPORTED_GET_TYPE ();
flags = nm_setting_vlan_get_flags (s_vlan);
NM_SET_OUT (out_is_default, flags == 0);
RETURN_STR_TO_FREE (vlan_flags_to_string (flags, get_type));
}
static NMVlanPriorityMap
_vlan_priority_map_type_from_property_info (const NMMetaPropertyInfo *property_info)
{
nm_assert (property_info);
nm_assert (property_info->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_VLAN]);
nm_assert (NM_IN_STRSET (property_info->property_name, NM_SETTING_VLAN_INGRESS_PRIORITY_MAP,
NM_SETTING_VLAN_EGRESS_PRIORITY_MAP));
return nm_streq (property_info->property_name, NM_SETTING_VLAN_INGRESS_PRIORITY_MAP)
? NM_VLAN_INGRESS_MAP
: NM_VLAN_EGRESS_MAP;
}
static gconstpointer
_get_fcn_vlan_xgress_priority_map (ARGS_GET_FCN)
{
NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
char *str;
RETURN_UNSUPPORTED_GET_TYPE ();
str = vlan_priorities_to_string (s_vlan, _vlan_priority_map_type_from_property_info (property_info));
NM_SET_OUT (out_is_default, !str || !str[0]);
RETURN_STR_TO_FREE (str);
}
static gboolean
_set_fcn_vlan_xgress_priority_map (ARGS_SET_FCN)
{
NMVlanPriorityMap map_type = _vlan_priority_map_type_from_property_info (property_info);
gs_free const char **prio_map = NULL;
gsize i, len;
if (_SET_FCN_DO_RESET_DEFAULT_WITH_SUPPORTS_REMOVE (property_info, modifier, value)) {
nm_setting_vlan_clear_priorities (NM_SETTING_VLAN (setting), map_type);
return TRUE;
}
prio_map = _value_strsplit (value, VALUE_STRSPLIT_MODE_STRIPPED, &len);
for (i = 0; i < len; i++) {
if (!nm_utils_vlan_priority_map_parse_str (map_type,
prio_map[i],
_SET_FCN_DO_REMOVE (modifier, value),
NULL,
NULL,
NULL)) {
g_set_error (error, 1, 0, _("invalid priority map '%s'"), prio_map[i]);
return FALSE;
}
}
if (_SET_FCN_DO_SET_ALL (modifier, value))
nm_setting_vlan_clear_priorities (NM_SETTING_VLAN (setting), map_type);
for (i = 0; i < len; i++) {
if (_SET_FCN_DO_REMOVE (modifier, value)) {
nm_setting_vlan_remove_priority_str_by_value (NM_SETTING_VLAN (setting),
map_type,
prio_map[i]);
} else {
nm_setting_vlan_add_priority_str (NM_SETTING_VLAN (setting),
map_type,
prio_map[i]);
}
}
return TRUE;
}
static gconstpointer
_get_fcn_vpn_data (ARGS_GET_FCN)
{
NMSettingVpn *s_vpn = NM_SETTING_VPN (setting);
GString *data_item_str;
RETURN_UNSUPPORTED_GET_TYPE ();
data_item_str = g_string_new (NULL);
nm_setting_vpn_foreach_data_item (s_vpn, &vpn_data_item, data_item_str);
NM_SET_OUT (out_is_default, data_item_str->len == 0);
RETURN_STR_TO_FREE (g_string_free (data_item_str, FALSE));
}
static gconstpointer
_get_fcn_vpn_secrets (ARGS_GET_FCN)
{
NMSettingVpn *s_vpn = NM_SETTING_VPN (setting);
GString *secret_str;
RETURN_UNSUPPORTED_GET_TYPE ();
secret_str = g_string_new (NULL);
nm_setting_vpn_foreach_secret (s_vpn, &vpn_data_item, secret_str);
NM_SET_OUT (out_is_default, secret_str->len == 0);
RETURN_STR_TO_FREE (g_string_free (secret_str, FALSE));
}
static gboolean
_optionlist_set_fcn_vpn_data (NMSetting *setting,
const char *option,
const char *value,
GError **error)
{
if (value)
nm_setting_vpn_add_data_item (NM_SETTING_VPN (setting), option, value);
else
nm_setting_vpn_remove_data_item (NM_SETTING_VPN (setting), option);
return TRUE;
}
static gboolean
_optionlist_set_fcn_vpn_secrets (NMSetting *setting,
const char *option,
const char *value,
GError **error)
{
if (value)
nm_setting_vpn_add_secret (NM_SETTING_VPN (setting), option, value);
else
nm_setting_vpn_remove_secret (NM_SETTING_VPN (setting), option);
return TRUE;
}
static gboolean
_set_fcn_wired_s390_subchannels (ARGS_SET_FCN)
{
gs_free const char **strv = NULL;
gsize len;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
strv = nm_utils_strsplit_set (value, " ,\t");
len = NM_PTRARRAY_LEN (strv);
if (len != 2 && len != 3) {
g_set_error (error, 1, 0, _("'%s' is not valid; 2 or 3 strings should be provided"),
value);
return FALSE;
}
g_object_set (setting, property_info->property_name, strv, NULL);
return TRUE;
}
static gboolean
_optionlist_set_fcn_wired_s390_options (NMSetting *setting,
const char *name,
const char *value,
GError **error)
{
if (value)
nm_setting_wired_add_s390_option (NM_SETTING_WIRED (setting), name, value);
else
nm_setting_wired_remove_s390_option (NM_SETTING_WIRED (setting), name);
return TRUE;
}
static const char *const*
_values_fcn_wired_s390_options (ARGS_VALUES_FCN)
{
return nm_setting_wired_get_valid_s390_options (NULL);
}
static const char *
_describe_fcn_wired_s390_options (ARGS_DESCRIBE_FCN)
{
gs_free char *options_str = NULL;
const char **valid_options;
char *s;
valid_options = nm_setting_wired_get_valid_s390_options (NULL);
options_str = g_strjoinv (", ", (char **) valid_options);
s = g_strdup_printf (_("Enter a list of S/390 options formatted as:\n"
" option = <value>, option = <value>,...\n"
"Valid options are: %s\n"),
options_str);
return (*out_to_free = s);
}
static gconstpointer
_get_fcn_wireless_ssid (ARGS_GET_FCN)
{
NMSettingWireless *s_wireless = NM_SETTING_WIRELESS (setting);
GBytes *ssid;
char *ssid_str = NULL;
RETURN_UNSUPPORTED_GET_TYPE ();
ssid = nm_setting_wireless_get_ssid (s_wireless);
if (ssid) {
ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL),
g_bytes_get_size (ssid));
}
NM_SET_OUT (out_is_default, !ssid_str || !ssid_str[0]);
RETURN_STR_TO_FREE (ssid_str);
}
static gboolean
_set_fcn_wireless_channel (ARGS_SET_FCN)
{
unsigned long chan_int;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value))
return _gobject_property_reset_default (setting, property_info->property_name);
if (!nmc_string_to_uint (value, FALSE, 0, 0, &chan_int)) {
g_set_error (error, 1, 0, _("'%s' is not a valid channel"), value);
return FALSE;
}
if ( !nm_utils_wifi_is_channel_valid (chan_int, "a")
&& !nm_utils_wifi_is_channel_valid (chan_int, "bg")) {
g_set_error (error, 1, 0, _("'%ld' is not a valid channel"), chan_int);
return FALSE;
}
g_object_set (setting, property_info->property_name, chan_int, NULL);
return TRUE;
}
static const char *
_multilist_validate2_fcn_mac_addr (NMSetting *setting,
const char *item,
GError **error)
{
guint8 buf[ETH_ALEN];
if (!nm_utils_hwaddr_aton (item, buf, ETH_ALEN)) {
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' is not a valid MAC address"), item);
return NULL;
}
return item;
}
static gconstpointer
_get_fcn_wireless_security_wep_key (ARGS_GET_FCN)
{
NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting);
char *key;
guint index;
RETURN_UNSUPPORTED_GET_TYPE ();
nm_assert (g_str_has_prefix (property_info->property_name, "wep-key"));
nm_assert (NM_IN_SET (property_info->property_name[7], '0', '1', '2', '3'));
nm_assert (property_info->property_name[8] == '\0');
index = property_info->property_name[7] - '0';
key = g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, index));
NM_SET_OUT (out_is_default, !key);
RETURN_STR_TO_FREE (key);
}
static gboolean
_set_fcn_wireless_wep_key (ARGS_SET_FCN)
{
NMWepKeyType guessed_type = NM_WEP_KEY_TYPE_UNKNOWN;
NMWepKeyType type;
guint32 prev_idx, idx;
nm_assert (!error || !*error);
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value)) {
g_object_set (setting, property_info->property_name, NULL, NULL);
return TRUE;
}
/* Get currently set type */
type = nm_setting_wireless_security_get_wep_key_type (NM_SETTING_WIRELESS_SECURITY (setting));
/* Guess key type */
if (nm_utils_wep_key_valid (value, NM_WEP_KEY_TYPE_KEY))
guessed_type = NM_WEP_KEY_TYPE_KEY;
else if (nm_utils_wep_key_valid (value, NM_WEP_KEY_TYPE_PASSPHRASE))
guessed_type = NM_WEP_KEY_TYPE_PASSPHRASE;
if (guessed_type == NM_WEP_KEY_TYPE_UNKNOWN) {
g_set_error (error, 1, 0, _("'%s' is not valid"), value);
return FALSE;
}
if (type != NM_WEP_KEY_TYPE_UNKNOWN && type != guessed_type) {
if (nm_utils_wep_key_valid (value, type))
guessed_type = type;
else {
g_set_error (error, 1, 0,
_("'%s' not compatible with %s '%s', please change the key or set the right %s first."),
value, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, wep_key_type_to_string (type),
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE);
return FALSE;
}
}
prev_idx = nm_setting_wireless_security_get_wep_tx_keyidx (NM_SETTING_WIRELESS_SECURITY (setting));
idx = property_info->property_name[strlen (property_info->property_name) - 1] - '0';
_env_warn_fcn (environment, environment_user_data,
NM_META_ENV_WARN_LEVEL_INFO,
N_("WEP key is guessed to be of '%s'"),
wep_key_type_to_string (guessed_type));
if (idx != prev_idx) {
_env_warn_fcn (environment, environment_user_data,
NM_META_ENV_WARN_LEVEL_INFO,
N_("WEP key index set to '%d'"),
idx);
}
g_object_set (setting, property_info->property_name, value, NULL);
g_object_set (setting, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, guessed_type, NULL);
if (idx != prev_idx)
g_object_set (setting, NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, idx, NULL);
return TRUE;
}
static void
_gobject_enum_pre_set_notify_fcn_wireless_security_wep_key_type (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
NMSetting *setting,
int value)
{
guint i;
const char *key;
const char *keynames[] = {
NM_SETTING_WIRELESS_SECURITY_WEP_KEY0,
NM_SETTING_WIRELESS_SECURITY_WEP_KEY1,
NM_SETTING_WIRELESS_SECURITY_WEP_KEY2,
NM_SETTING_WIRELESS_SECURITY_WEP_KEY3,
};
/* Check type compatibility with set keys */
if (!NM_IN_SET (value,
NM_WEP_KEY_TYPE_UNKNOWN,
NM_WEP_KEY_TYPE_KEY,
NM_WEP_KEY_TYPE_PASSPHRASE))
return;
for (i = 0; i < 4; i++) {
key = nm_setting_wireless_security_get_wep_key (NM_SETTING_WIRELESS_SECURITY (setting), i);
if (key && !nm_utils_wep_key_valid (key, value)) {
_env_warn_fcn (environment, environment_user_data,
NM_META_ENV_WARN_LEVEL_WARN,
N_("'%s' is not compatible with '%s' type, please change or delete the key."),
keynames[i], wep_key_type_to_string (value));
}
}
}
/*****************************************************************************/
static gconstpointer
_get_fcn_ethtool (ARGS_GET_FCN)
{
const char *s;
NMTernary val;
NMEthtoolID ethtool_id = property_info->property_typ_data->subtype.ethtool.ethtool_id;
RETURN_UNSUPPORTED_GET_TYPE ();
val = nm_setting_ethtool_get_feature (NM_SETTING_ETHTOOL (setting),
nm_ethtool_data[ethtool_id]->optname);
if (val == NM_TERNARY_TRUE)
s = N_("on");
else if (val == NM_TERNARY_FALSE)
s = N_("off");
else {
s = NULL;
NM_SET_OUT (out_is_default, TRUE);
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE;
}
if (s && get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
s = gettext (s);
return s;
}
static gboolean
_set_fcn_ethtool (ARGS_SET_FCN)
{
gs_free char *value_to_free = NULL;
NMTernary val;
NMEthtoolID ethtool_id = property_info->property_typ_data->subtype.ethtool.ethtool_id;
if (_SET_FCN_DO_RESET_DEFAULT (property_info, modifier, value)) {
val = NM_TERNARY_DEFAULT;
goto set;
}
value = nm_strstrip_avoid_copy_a (300, value, &value_to_free);
if (NM_IN_STRSET (value, "1", "yes", "true", "on"))
val = NM_TERNARY_TRUE;
else if (NM_IN_STRSET (value, "0", "no", "false", "off"))
val = NM_TERNARY_FALSE;
else if (NM_IN_STRSET (value, "", "ignore", "default"))
val = NM_TERNARY_DEFAULT;
else {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT,
_("'%s' is not valid; use 'on', 'off', or 'ignore'"),
value);
return FALSE;
}
set:
nm_setting_ethtool_set_feature (NM_SETTING_ETHTOOL (setting),
nm_ethtool_data[ethtool_id]->optname,
val);
return TRUE;
}
static const char *const*
_complete_fcn_ethtool (ARGS_COMPLETE_FCN)
{
static const char *const v[] = {
"true",
"false",
"1",
"0",
"yes",
"no",
"default",
"on",
"off",
"ignore",
NULL,
};
if (!text || !text[0])
return &v[7];
return v;
}
/*****************************************************************************/
static const NMMetaPropertyInfo property_info_BOND_OPTIONS;
#define NESTED_PROPERTY_INFO_BOND(...) \
.parent_info = &property_info_BOND_OPTIONS, \
.base = { \
.meta_type = &nm_meta_type_nested_property_info, \
.setting_info = &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_BOND], \
__VA_ARGS__ \
}
static const NMMetaNestedPropertyInfo meta_nested_property_infos_bond[] = {
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "mode",
.prompt = NM_META_TEXT_PROMPT_BOND_MODE,
.def_hint = "[balance-rr]",
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "primary",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = N_("Bonding primary interface [none]"),
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
/* this is a virtual property, only needed during "ask" mode. */
.prompt = N_("Bonding monitoring mode"),
.def_hint = NM_META_TEXT_PROMPT_BOND_MON_MODE_CHOICES,
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "miimon",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = N_("Bonding miimon [100]"),
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "downdelay",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = N_("Bonding downdelay [0]"),
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "updelay",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = N_("Bonding updelay [0]"),
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "arp-interval",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = N_("Bonding arp-interval [0]"),
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "arp-ip-target",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = N_("Bonding arp-ip-target [none]"),
)
},
{
NESTED_PROPERTY_INFO_BOND (
.property_name = NM_SETTING_BOND_OPTIONS,
.property_alias = "lacp-rate",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = N_("LACP rate ('slow' or 'fast') [slow]"),
)
},
};
const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond = {
.nested = meta_nested_property_infos_bond,
.nested_len = G_N_ELEMENTS (meta_nested_property_infos_bond),
};
/*****************************************************************************/
#define DEFINE_PROPERTY_TYPE(...) \
(&((NMMetaPropertyType) { __VA_ARGS__ } ))
#define DEFINE_PROPERTY_TYP_DATA(...) \
(&((NMMetaPropertyTypData) { __VA_ARGS__ } ))
#define PROPERTY_TYP_DATA_SUBTYPE(stype, ...) \
.subtype = { \
.stype = { __VA_ARGS__ }, \
}
#define DEFINE_PROPERTY_TYP_DATA_SUBTYPE(stype, ...) \
DEFINE_PROPERTY_TYP_DATA ( \
PROPERTY_TYP_DATA_SUBTYPE (stype, __VA_ARGS__), \
)
static const NMMetaPropertyType _pt_gobject_readonly = {
.get_fcn = _get_fcn_gobject,
};
static const NMMetaPropertyType _pt_gobject_string = {
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_gobject_string,
};
static const NMMetaPropertyType _pt_gobject_bool = {
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_gobject_bool,
.complete_fcn = _complete_fcn_gobject_bool,
};
static const NMMetaPropertyType _pt_gobject_int = {
.get_fcn = _get_fcn_gobject_int,
.set_fcn = _set_fcn_gobject_int,
};
static const NMMetaPropertyType _pt_gobject_mtu = {
.get_fcn = _get_fcn_gobject_mtu,
.set_fcn = _set_fcn_gobject_mtu,
};
static const NMMetaPropertyType _pt_gobject_bytes = {
.get_fcn = _get_fcn_gobject_bytes,
.set_fcn = _set_fcn_gobject_bytes,
};
static const NMMetaPropertyType _pt_gobject_mac = {
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_gobject_mac,
};
static const NMMetaPropertyType _pt_gobject_secret_flags = {
.get_fcn = _get_fcn_gobject_secret_flags,
.set_fcn = _set_fcn_gobject_enum,
.values_fcn = _values_fcn_gobject_enum,
};
static const NMMetaPropertyType _pt_gobject_enum = {
.get_fcn = _get_fcn_gobject_enum,
.set_fcn = _set_fcn_gobject_enum,
.values_fcn = _values_fcn_gobject_enum,
};
static const NMMetaPropertyType _pt_gobject_devices = {
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_gobject_string,
.complete_fcn = _complete_fcn_gobject_devices,
};
static const NMMetaPropertyType _pt_dcb_flags = {
.get_fcn = _get_fcn_dcb_flags,
.set_fcn = _set_fcn_dcb_flags,
};
static const NMMetaPropertyType _pt_dcb_bool = {
.get_fcn = _get_fcn_dcb_bool,
.set_fcn = _set_fcn_dcb_bool,
};
static const NMMetaPropertyType _pt_dcb = {
.get_fcn = _get_fcn_dcb,
.set_fcn = _set_fcn_dcb,
};
static const NMMetaPropertyType _pt_cert_8021x = {
.get_fcn = _get_fcn_cert_8021x,
.set_fcn = _set_fcn_cert_8021x,
};
static const NMMetaPropertyType _pt_ethtool = {
.get_fcn = _get_fcn_ethtool,
.set_fcn = _set_fcn_ethtool,
.complete_fcn = _complete_fcn_ethtool,
};
static const NMMetaPropertyType _pt_multilist = {
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_multilist,
.set_supports_remove = TRUE,
};
static const NMMetaPropertyType _pt_objlist = {
.get_fcn = _get_fcn_objlist,
.set_fcn = _set_fcn_objlist,
.set_supports_remove = TRUE,
};
#define MULTILIST_GET_NUM_FCN_U32(type, func) (((func) == ((guint32 (*) (type * )) (func))) ? ((guint32 (*) (NMSetting * )) (func)) : NULL)
#define MULTILIST_GET_NUM_FCN_U(type, func) (((func) == ((guint (*) (type * )) (func))) ? ((guint (*) (NMSetting * )) (func)) : NULL)
#define MULTILIST_ADD_FCN(type, func) (((func) == ((gboolean (*) (type *, const char *)) (func))) ? ((gboolean (*) (NMSetting *, const char *)) (func)) : NULL)
#define MULTILIST_ADD2_FCN(type, func) (((func) == ((void (*) (type *, const char *)) (func))) ? ((void (*) (NMSetting *, const char *)) (func)) : NULL)
#define MULTILIST_REMOVE_BY_IDX_FCN_U32(type, func) (((func) == ((void (*) (type *, guint32 )) (func))) ? ((void (*) (NMSetting *, guint32 )) (func)) : NULL)
#define MULTILIST_REMOVE_BY_IDX_FCN_S(type, func) (((func) == ((void (*) (type *, int )) (func))) ? ((void (*) (NMSetting *, int )) (func)) : NULL)
#define MULTILIST_REMOVE_BY_IDX_FCN_U(type, func) (((func) == ((void (*) (type *, guint )) (func))) ? ((void (*) (NMSetting *, guint )) (func)) : NULL)
#define MULTILIST_REMOVE_BY_VALUE_FCN(type, func) (((func) == ((gboolean (*) (type *, const char *)) (func))) ? ((gboolean (*) (NMSetting *, const char *)) (func)) : NULL)
#define OBJLIST_GET_NUM_FCN(type, func) (((func) == ((guint (*) (type * )) (func))) ? ((guint (*) (NMSetting * )) (func)) : NULL)
#define OBJLIST_CLEAR_ALL_FCN(type, func) (((func) == ((void (*) (type * )) (func))) ? ((void (*) (NMSetting * )) (func)) : NULL)
#define OBJLIST_REMOVE_BY_IDX_FCN_U(type, func) (((func) == ((void (*) (type *, guint )) (func))) ? ((void (*) (NMSetting *, guint )) (func)) : NULL)
#define OBJLIST_REMOVE_BY_IDX_FCN_S(type, func) (((func) == ((void (*) (type *, int )) (func))) ? ((void (*) (NMSetting *, int )) (func)) : NULL)
/*****************************************************************************/
#include "settings-docs.h"
/*****************************************************************************/
#define PROPERTY_INFO_INIT(name, doc, ...) \
{ \
.meta_type = &nm_meta_type_property_info, \
.setting_info = &nm_meta_setting_infos_editor[_CURRENT_NM_META_SETTING_TYPE], \
.property_name = name, \
.describe_doc = doc, \
__VA_ARGS__ \
}
#define PROPERTY_INFO(name, doc, ...) \
(&((const NMMetaPropertyInfo) PROPERTY_INFO_INIT (name, doc, __VA_ARGS__)))
#define PROPERTY_INFO_WITH_DESC(name, ...) \
PROPERTY_INFO (name, DESCRIBE_DOC_##name, ##__VA_ARGS__)
#define ENUM_VALUE_INFOS(...) (((const NMUtilsEnumValueInfo []) { __VA_ARGS__ { .nick = NULL, }, }))
#define INT_VALUE_INFOS(...) (((const NMMetaUtilsIntValueInfo []) { __VA_ARGS__ { .nick = NULL, }, }))
#define MTU_GET_FCN(type, func) \
/* macro that returns @func as const (guint32(*)(NMSetting*)) type, but checks
* that the actual type is (guint32(*)(type *)). */ \
((guint32 (*) (NMSetting *)) ((sizeof (func == ((guint32 (*) (type *)) func))) ? func : func) )
#define TEAM_DESCRIBE_MESSAGE \
N_("nmcli can accepts both direct JSON configuration data and a file name containing " \
"the configuration. In the latter case the file is read and the contents is put " \
"into this property.\n\n" \
"Examples: set team.config " \
"{ \"device\": \"team0\", \"runner\": {\"name\": \"roundrobin\"}, \"ports\": {\"eth1\": {}, \"eth2\": {}} }\n" \
" set team.config /etc/my-team.conf\n")
#define TEAM_LINK_WATCHERS_DESCRIBE_MESSAGE \
N_("Enter a list of link watchers formatted as dictionaries where the keys " \
"are teamd properties. Dictionary pairs are in the form: key=value and pairs " \
"are separated by ' '. Dictionaries are separated with ','.\n" \
"The keys allowed/required in the dictionary change on the basis of the link " \
"watcher type, while the only property common to all the link watchers is " \
" 'name'*, which defines the link watcher to be specified.\n\n" \
"Properties available for the 'ethtool' link watcher:\n" \
" 'delay-up', 'delay-down'\n\n" \
"Properties available for the 'nsna_ping' link watcher:\n" \
" 'init-wait', 'interval', 'missed-max', 'target-host'*\n\n" \
"Properties available for the 'arp_ping' include all the ones for 'nsna_ping' and:\n" \
" 'source-host'*, 'validate-active', 'validate-inactive', 'send-always'.\n\n" \
"Properties flagged with a '*' are mandatory.\n\n" \
"Example:\n" \
" name=arp_ping source-host=172.16.1.1 target-host=172.16.1.254, name=ethtool delay-up=3\n")
#define DEFINE_DCB_PROPRITY_PROPERTY_TYPE \
.property_type = &_pt_gobject_int, \
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.value_infos = INT_VALUE_INFOS ( \
{ \
.value.i64 = -1, \
.nick = "unset", \
}, \
), \
),
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_6LOWPAN
static const NMMetaPropertyInfo *const property_infos_6LOWPAN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_6LOWPAN_PARENT,
.is_cli_option = TRUE,
.property_alias = "dev",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("IEEE 802.15.4 (WPAN) parent device or connection UUID"),
.property_type = &_pt_gobject_string,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_802_1X
static const NMMetaPropertyInfo *const property_infos_802_1X[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_EAP,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSetting8021x, nm_setting_802_1x_get_num_eap_methods),
.add_fcn = MULTILIST_ADD_FCN (NMSetting8021x, nm_setting_802_1x_add_eap_method),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSetting8021x, nm_setting_802_1x_remove_eap_method),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSetting8021x, nm_setting_802_1x_remove_eap_method_by_value),
.strsplit_plain = TRUE,
),
.values_static = NM_MAKE_STRV ("leap", "md5", "tls", "peap", "ttls", "sim", "fast", "pwd"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_IDENTITY,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_ANONYMOUS_IDENTITY,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PAC_FILE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_CERT,
.describe_message =
N_("Enter file path to CA certificate (optionally prefixed with file://).\n"
" [file://]<file path>\n"
"Note that nmcli does not support specifying certificates as raw blob data.\n"
"Example: /home/cimrman/cacert.crt\n"),
.property_type = &_pt_cert_8021x,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (cert_8021x,
.scheme_type = NM_SETTING_802_1X_SCHEME_TYPE_CA_CERT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_CERT_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_CERT_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_PATH,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_SUBJECT_MATCH,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_ALTSUBJECT_MATCHES,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSetting8021x, nm_setting_802_1x_get_num_altsubject_matches),
.add_fcn = MULTILIST_ADD_FCN (NMSetting8021x, nm_setting_802_1x_add_altsubject_match),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSetting8021x, nm_setting_802_1x_remove_altsubject_match),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSetting8021x, nm_setting_802_1x_remove_altsubject_match_by_value),
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CLIENT_CERT,
.describe_message =
N_("Enter file path to client certificate (optionally prefixed with file://).\n"
" [file://]<file path>\n"
"Note that nmcli does not support specifying certificates as raw blob data.\n"
"Example: /home/cimrman/jara.crt\n"),
.property_type = &_pt_cert_8021x,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (cert_8021x,
.scheme_type = NM_SETTING_802_1X_SCHEME_TYPE_CLIENT_CERT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CLIENT_CERT_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CLIENT_CERT_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_PEAPVER,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("0", "1"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_PEAPLABEL,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("0", "1"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("0", "1", "2", "3"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_AUTH_FLAGS,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_802_1x_auth_flags_get_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_AUTH,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("pap", "chap", "mschap", "mschapv2", "gtc", "otp", "md5", "tls"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_AUTHEAP,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("md5", "mschapv2", "otp", "gtc", "tls"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_CERT,
.describe_message =
N_("Enter file path to CA certificate for inner authentication (optionally prefixed\n"
"with file://).\n"
" [file://]<file path>\n"
"Note that nmcli does not support specifying certificates as raw blob data.\n"
"Example: /home/cimrman/ca-zweite-phase.crt\n"),
.property_type = &_pt_cert_8021x,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (cert_8021x,
.scheme_type = NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_CA_CERT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_PATH,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSetting8021x, nm_setting_802_1x_get_num_phase2_altsubject_matches),
.add_fcn = MULTILIST_ADD_FCN (NMSetting8021x, nm_setting_802_1x_add_phase2_altsubject_match),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSetting8021x, nm_setting_802_1x_remove_phase2_altsubject_match),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSetting8021x, nm_setting_802_1x_remove_phase2_altsubject_match_by_value),
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CLIENT_CERT,
.describe_message =
N_("Enter file path to client certificate for inner authentication (optionally prefixed\n"
"with file://).\n"
" [file://]<file path>\n"
"Note that nmcli does not support specifying certificates as raw blob data.\n"
"Example: /home/cimrman/jara-zweite-phase.crt\n"),
.property_type = &_pt_cert_8021x,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (cert_8021x,
.scheme_type = NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_CLIENT_CERT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD_RAW,
.is_secret = TRUE,
.describe_message =
N_("Enter bytes as a list of hexadecimal values.\n"
"Two formats are accepted:\n"
"(a) a string of hexadecimal digits, where each two digits represent one byte\n"
"(b) space-separated list of bytes written as hexadecimal digits "
"(with optional 0x/0X prefix, and optional leading 0).\n\n"
"Examples: ab0455a6ea3a74C2\n"
" ab 4 55 0xa6 ea 3a 74 C2\n"),
.property_type = &_pt_gobject_bytes,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_bytes,
.legacy_format = TRUE,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD_RAW_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PRIVATE_KEY,
.describe_message =
N_("Enter path to a private key and the key password (if not set yet):\n"
" [file://]<file path> [<password>]\n"
"Note that nmcli does not support specifying private key as raw blob data.\n"
"Example: /home/cimrman/jara-priv-key Dardanely\n"),
.property_type = &_pt_cert_8021x,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (cert_8021x,
.scheme_type = NM_SETTING_802_1X_SCHEME_TYPE_PRIVATE_KEY,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY,
.describe_message =
N_("Enter path to a private key and the key password (if not set yet):\n"
" [file://]<file path> [<password>]\n"
"Note that nmcli does not support specifying private key as raw blob data.\n"
"Example: /home/cimrman/jara-priv-key Dardanely\n"),
.property_type = &_pt_cert_8021x,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (cert_8021x,
.scheme_type = NM_SETTING_802_1X_SCHEME_TYPE_PHASE2_PRIVATE_KEY,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PIN,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PIN_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_SYSTEM_CA_CERTS,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_AUTH_TIMEOUT,
.property_type = &_pt_gobject_int,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_ADSL
static const NMMetaPropertyInfo *const property_infos_ADSL[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_USERNAME,
.is_cli_option = TRUE,
.property_alias = "username",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("Username"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_PASSWORD,
.is_cli_option = TRUE,
.property_alias = "password",
.prompt = N_("Password [none]"),
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_PROTOCOL,
.is_cli_option = TRUE,
.property_alias = "protocol",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = NM_META_TEXT_PROMPT_ADSL_PROTO,
.def_hint = NM_META_TEXT_PROMPT_ADSL_PROTO_CHOICES,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_ADSL_PROTOCOL_PPPOA,
NM_SETTING_ADSL_PROTOCOL_PPPOE,
NM_SETTING_ADSL_PROTOCOL_IPOATM),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_ENCAPSULATION,
.is_cli_option = TRUE,
.property_alias = "encapsulation",
.prompt = NM_META_TEXT_PROMPT_ADSL_ENCAP,
.def_hint = NM_META_TEXT_PROMPT_ADSL_ENCAP_CHOICES,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_ADSL_ENCAPSULATION_VCMUX,
NM_SETTING_ADSL_ENCAPSULATION_LLC),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_VPI,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_VCI,
.property_type = &_pt_gobject_int,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BLUETOOTH
static const NMMetaPropertyInfo *const property_infos_BLUETOOTH[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_BLUETOOTH_BDADDR,
.is_cli_option = TRUE,
.property_alias = "addr",
.prompt = N_("Bluetooth device address"),
.property_type = &_pt_gobject_mac,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BLUETOOTH_TYPE,
.is_cli_option = TRUE,
.property_alias = "bt-type",
.prompt = NM_META_TEXT_PROMPT_BT_TYPE,
.def_hint = NM_META_TEXT_PROMPT_BT_TYPE_CHOICES,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_BLUETOOTH_TYPE_DUN,
NM_SETTING_BLUETOOTH_TYPE_PANU,
NM_SETTING_BLUETOOTH_TYPE_NAP),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BOND
static const NMMetaPropertyInfo property_info_BOND_OPTIONS =
PROPERTY_INFO_INIT (NM_SETTING_BOND_OPTIONS, DESCRIBE_DOC_NM_SETTING_BOND_OPTIONS,
.property_type = DEFINE_PROPERTY_TYPE (
.describe_fcn = _describe_fcn_bond_options,
.get_fcn = _get_fcn_bond_options,
.set_fcn = _set_fcn_optionlist,
.set_supports_remove = TRUE,
.values_fcn = _values_fcn_bond_options,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (optionlist,
.set_fcn = _optionlist_set_fcn_bond_options,
),
.nested = &nm_meta_property_typ_data_bond,
),
);
static const NMMetaPropertyInfo *const property_infos_BOND[] = {
&property_info_BOND_OPTIONS,
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BRIDGE
static const NMMetaPropertyInfo *const property_infos_BRIDGE[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MAC_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "mac",
.prompt = N_("MAC [none]"),
.property_type = &_pt_gobject_mac,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_STP,
.is_cli_option = TRUE,
.property_alias = "stp",
.prompt = N_("Enable STP [no]"),
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PRIORITY,
.is_cli_option = TRUE,
.property_alias = "priority",
.prompt = N_("STP priority [32768]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_FORWARD_DELAY,
.is_cli_option = TRUE,
.property_alias = "forward-delay",
.prompt = N_("Forward delay [15]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_HELLO_TIME,
.is_cli_option = TRUE,
.property_alias = "hello-time",
.prompt = N_("Hello time [2]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MAX_AGE,
.is_cli_option = TRUE,
.property_alias = "max-age",
.prompt = N_("Max age [20]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_AGEING_TIME,
.is_cli_option = TRUE,
.property_alias = "ageing-time",
.prompt = N_("MAC address ageing time [300]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_GROUP_FORWARD_MASK,
.is_cli_option = TRUE,
.property_alias = "group-forward-mask",
.prompt = N_("Group forward mask [0]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MULTICAST_SNOOPING,
.is_cli_option = TRUE,
.property_alias = "multicast-snooping",
.prompt = N_("Enable IGMP snooping [no]"),
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_VLAN_FILTERING,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_VLAN_DEFAULT_PVID,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_VLANS,
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingBridge, nm_setting_bridge_get_num_vlans),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingBridge, nm_setting_bridge_clear_vlans),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_bridge_vlans,
.set_fcn = _objlist_set_fcn_bridge_vlans,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BRIDGE_PORT
static const NMMetaPropertyInfo *const property_infos_BRIDGE_PORT[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PORT_PRIORITY,
.is_cli_option = TRUE,
.property_alias = "priority",
.prompt = N_("Bridge port priority [32]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PORT_PATH_COST,
.is_cli_option = TRUE,
.property_alias = "path-cost",
.prompt = N_("Bridge port STP path cost [100]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE,
.is_cli_option = TRUE,
.property_alias = "hairpin",
.prompt = N_("Hairpin [no]"),
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PORT_VLANS,
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingBridgePort, nm_setting_bridge_port_get_num_vlans),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingBridgePort, nm_setting_bridge_port_clear_vlans),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_bridge_vlans,
.set_fcn = _objlist_set_fcn_bridge_vlans,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_CDMA
static const NMMetaPropertyInfo *const property_infos_CDMA[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_NUMBER,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_USERNAME,
.is_cli_option = TRUE,
.property_alias = "user",
.prompt = N_("Username [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_PASSWORD,
.is_cli_option = TRUE,
.property_alias = "password",
.prompt = N_("Password [none]"),
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_MTU,
.property_type = &_pt_gobject_mtu,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu,
.get_fcn = MTU_GET_FCN (NMSettingCdma, nm_setting_cdma_get_mtu),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_CONNECTION
static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_ID,
.is_cli_option = TRUE,
.property_alias = "con-name",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_UUID,
.property_type = DEFINE_PROPERTY_TYPE ( .get_fcn = _get_fcn_gobject ),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_STABLE_ID,
.property_type = &_pt_gobject_string,
),
[_NM_META_PROPERTY_TYPE_CONNECTION_TYPE] =
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_TYPE,
.is_cli_option = TRUE,
.property_alias = "type",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = NM_META_TEXT_PROMPT_CON_TYPE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_connection_type,
.complete_fcn = _complete_fcn_connection_type,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_INTERFACE_NAME,
.is_cli_option = TRUE,
.property_alias = "ifname",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = NM_META_TEXT_PROMPT_IFNAME,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_gobject_ifname,
.complete_fcn = _complete_fcn_gobject_devices,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT,
.is_cli_option = TRUE,
.property_alias = "autoconnect",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = -1,
.nick = "default",
},
{
.value.i64 = 0,
.nick = "forever",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_MULTI_CONNECT,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_connection_multi_connect_get_type,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTH_RETRIES,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_TIMESTAMP,
.property_type = &_pt_gobject_readonly,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_READ_ONLY,
.property_type = &_pt_gobject_readonly,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_PERMISSIONS,
.describe_message =
N_("Enter a list of user permissions. This is a list of user names formatted as:\n"
" [user:]<user name 1>, [user:]<user name 2>,...\n"
"The items can be separated by commas or spaces.\n\n"
"Example: alice bob charlie\n"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_connection_permissions,
.set_fcn = _set_fcn_multilist,
.set_supports_remove = TRUE,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSettingConnection, nm_setting_connection_get_num_permissions),
.add_fcn = _multilist_set_fcn_connection_permissions,
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSettingConnection, nm_setting_connection_remove_permission),
.remove_by_value_fcn = _multilist_remove_by_value_fcn_connection_permissions,
.validate2_fcn = _multilist_validate2_fcn_connection_permissions,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_ZONE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_MASTER,
.is_cli_option = TRUE,
.property_alias = "master",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.prompt = NM_META_TEXT_PROMPT_MASTER,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_connection_master,
.complete_fcn = _complete_fcn_connection_master,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_SLAVE_TYPE,
.is_cli_option = TRUE,
.property_alias = "slave-type",
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_BOND_SETTING_NAME,
NM_SETTING_BRIDGE_SETTING_NAME,
NM_SETTING_OVS_BRIDGE_SETTING_NAME,
NM_SETTING_OVS_PORT_SETTING_NAME,
NM_SETTING_TEAM_SETTING_NAME),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
.property_type = &_pt_gobject_enum,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_SECONDARIES,
.describe_message =
N_("Enter secondary connections that should be activated when this connection is\n"
"activated. Connections can be specified either by UUID or ID (name). nmcli\n"
"transparently translates names to UUIDs. Note that NetworkManager only supports\n"
"VPNs as secondary connections at the moment.\n"
"The items can be separated by commas or spaces.\n\n"
"Example: private-openvpn, fe6ba5d8-c2fc-4aae-b2e3-97efddd8d9a7\n"),
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSettingConnection, nm_setting_connection_get_num_secondaries),
.add_fcn = MULTILIST_ADD_FCN (NMSettingConnection, nm_setting_connection_add_secondary),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSettingConnection, nm_setting_connection_remove_secondary),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingConnection, nm_setting_connection_remove_secondary_by_value),
.validate2_fcn = _multilist_validate2_fcn_uuid,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_METERED,
.describe_message =
N_("Enter a value which indicates whether the connection is subject to a data\n"
"quota, usage costs or other limitations. Accepted options are:\n"
"'true','yes','on' to set the connection as metered\n"
"'false','no','off' to set the connection as not metered\n"
"'unknown' to let NetworkManager choose a value using some heuristics\n"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_connection_metered,
.set_fcn = _set_fcn_connection_metered,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("yes", "no", "unknown"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_LLDP,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_connection_lldp_get_type,
.value_infos = ENUM_VALUE_INFOS (
{
.value = NM_SETTING_CONNECTION_LLDP_ENABLE_RX,
.nick = "enable",
},
),
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_MDNS,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_connection_mdns_get_type,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_LLMNR,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_connection_llmnr_get_type,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_DCB
static const NMMetaPropertyInfo *const property_infos_DCB[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_FLAGS,
.property_type = &_pt_dcb_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_PRIORITY,
DEFINE_DCB_PROPRITY_PROPERTY_TYPE
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_MODE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_DCB_FCOE_MODE_FABRIC,
NM_SETTING_DCB_FCOE_MODE_VN2VN),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_ISCSI_FLAGS,
.property_type = &_pt_dcb_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_ISCSI_PRIORITY,
DEFINE_DCB_PROPRITY_PROPERTY_TYPE
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FIP_FLAGS,
.property_type = &_pt_dcb_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FIP_PRIORITY,
DEFINE_DCB_PROPRITY_PROPERTY_TYPE
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS,
.property_type = &_pt_dcb_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL,
.property_type = &_pt_dcb_bool,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (dcb_bool,
.get_fcn = nm_setting_dcb_get_priority_flow_control,
.set_fcn = nm_setting_dcb_set_priority_flow_control,
.with_flow_control_flags = TRUE,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_GROUP_FLAGS,
.property_type = &_pt_dcb_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_GROUP_ID,
.property_type = &_pt_dcb,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (dcb,
.get_fcn = nm_setting_dcb_get_priority_group_id,
.set_fcn = nm_setting_dcb_set_priority_group_id,
.max = 7,
.other = 15,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH,
.property_type = &_pt_dcb,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (dcb,
.get_fcn = nm_setting_dcb_get_priority_group_bandwidth,
.set_fcn = nm_setting_dcb_set_priority_group_bandwidth,
.max = 100,
.other = 0,
.is_percent = TRUE,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_BANDWIDTH,
.property_type = &_pt_dcb,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (dcb,
.get_fcn = nm_setting_dcb_get_priority_bandwidth,
.set_fcn = nm_setting_dcb_set_priority_bandwidth,
.max = 100,
.other = 0,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH,
.property_type = &_pt_dcb_bool,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (dcb_bool,
.get_fcn = nm_setting_dcb_get_priority_strict_bandwidth,
.set_fcn = nm_setting_dcb_set_priority_strict_bandwidth,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS,
.property_type = &_pt_dcb,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (dcb,
.get_fcn = nm_setting_dcb_get_priority_traffic_class,
.set_fcn = nm_setting_dcb_set_priority_traffic_class,
.max = 7,
.other = 0,
),
),
NULL
};
#define PROPERTY_INFO_ETHTOOL(xname) \
PROPERTY_INFO (NM_ETHTOOL_OPTNAME_##xname, NULL, \
.property_type = &_pt_ethtool, \
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (ethtool, \
.ethtool_id = NM_ETHTOOL_ID_##xname, \
), \
)
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_ETHTOOL
static const NMMetaPropertyInfo *const property_infos_ETHTOOL[] = {
PROPERTY_INFO_ETHTOOL (FEATURE_ESP_HW_OFFLOAD),
PROPERTY_INFO_ETHTOOL (FEATURE_ESP_TX_CSUM_HW_OFFLOAD),
PROPERTY_INFO_ETHTOOL (FEATURE_FCOE_MTU),
PROPERTY_INFO_ETHTOOL (FEATURE_GRO),
PROPERTY_INFO_ETHTOOL (FEATURE_GSO),
PROPERTY_INFO_ETHTOOL (FEATURE_HIGHDMA),
PROPERTY_INFO_ETHTOOL (FEATURE_HW_TC_OFFLOAD),
PROPERTY_INFO_ETHTOOL (FEATURE_L2_FWD_OFFLOAD),
PROPERTY_INFO_ETHTOOL (FEATURE_LOOPBACK),
PROPERTY_INFO_ETHTOOL (FEATURE_LRO),
PROPERTY_INFO_ETHTOOL (FEATURE_NTUPLE),
PROPERTY_INFO_ETHTOOL (FEATURE_RX),
PROPERTY_INFO_ETHTOOL (FEATURE_RXHASH),
PROPERTY_INFO_ETHTOOL (FEATURE_RXVLAN),
PROPERTY_INFO_ETHTOOL (FEATURE_RX_ALL),
PROPERTY_INFO_ETHTOOL (FEATURE_RX_FCS),
PROPERTY_INFO_ETHTOOL (FEATURE_RX_GRO_HW),
PROPERTY_INFO_ETHTOOL (FEATURE_RX_UDP_TUNNEL_PORT_OFFLOAD),
PROPERTY_INFO_ETHTOOL (FEATURE_RX_VLAN_FILTER),
PROPERTY_INFO_ETHTOOL (FEATURE_RX_VLAN_STAG_FILTER),
PROPERTY_INFO_ETHTOOL (FEATURE_RX_VLAN_STAG_HW_PARSE),
PROPERTY_INFO_ETHTOOL (FEATURE_SG),
PROPERTY_INFO_ETHTOOL (FEATURE_TLS_HW_RECORD),
PROPERTY_INFO_ETHTOOL (FEATURE_TLS_HW_TX_OFFLOAD),
PROPERTY_INFO_ETHTOOL (FEATURE_TSO),
PROPERTY_INFO_ETHTOOL (FEATURE_TX),
PROPERTY_INFO_ETHTOOL (FEATURE_TXVLAN),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_CHECKSUM_FCOE_CRC),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_CHECKSUM_IPV4),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_CHECKSUM_IPV6),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_CHECKSUM_IP_GENERIC),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_CHECKSUM_SCTP),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_ESP_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_FCOE_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_GRE_CSUM_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_GRE_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_GSO_PARTIAL),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_GSO_ROBUST),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_IPXIP4_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_IPXIP6_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_NOCACHE_COPY),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_SCATTER_GATHER),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_SCATTER_GATHER_FRAGLIST),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_SCTP_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_TCP6_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_TCP_ECN_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_TCP_MANGLEID_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_TCP_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_UDP_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_UDP_TNL_CSUM_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_UDP_TNL_SEGMENTATION),
PROPERTY_INFO_ETHTOOL (FEATURE_TX_VLAN_STAG_HW_INSERT),
NULL,
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_GSM
static const NMMetaPropertyInfo *const property_infos_GSM[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_NUMBER,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_USERNAME,
.is_cli_option = TRUE,
.property_alias = "user",
.prompt = N_("Username [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PASSWORD,
.is_cli_option = TRUE,
.property_alias = "password",
.prompt = N_("Password [none]"),
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_APN,
.is_cli_option = TRUE,
.property_alias = "apn",
.prompt = N_("APN"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_NETWORK_ID,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PIN,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PIN_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_HOME_ONLY,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_DEVICE_ID,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_SIM_ID,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_SIM_OPERATOR_ID,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_gsm_sim_operator_id,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_MTU,
.property_type = &_pt_gobject_mtu,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu,
.get_fcn = MTU_GET_FCN (NMSettingGsm, nm_setting_gsm_get_mtu),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_INFINIBAND
static const NMMetaPropertyInfo *const property_infos_INFINIBAND[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_MAC_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "mac",
.prompt = N_("MAC [none]"),
.property_type = &_pt_gobject_mac,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac,
.mode = NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_MTU,
.is_cli_option = TRUE,
.property_alias = "mtu",
.prompt = N_("MTU [auto]"),
.property_type = &_pt_gobject_mtu,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu,
.get_fcn = MTU_GET_FCN (NMSettingInfiniband, nm_setting_infiniband_get_mtu),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_TRANSPORT_MODE,
.is_cli_option = TRUE,
.property_alias = "transport-mode",
.prompt = NM_META_TEXT_PROMPT_IB_MODE,
.def_hint = NM_META_TEXT_PROMPT_IB_MODE_CHOICES,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("datagram", "connected"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_P_KEY,
.is_cli_option = TRUE,
.property_alias = "p-key",
.prompt = N_("P_KEY [none]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_infiniband_p_key,
.set_fcn = _set_fcn_infiniband_p_key,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_PARENT,
.is_cli_option = TRUE,
.property_alias = "parent",
.prompt = N_("Parent interface [none]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_gobject_ifname,
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_IP4_CONFIG
static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = {
PROPERTY_INFO (NM_SETTING_IP_CONFIG_METHOD, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_ip_config_method,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL,
NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NM_SETTING_IP4_CONFIG_METHOD_SHARED,
NM_SETTING_IP4_CONFIG_METHOD_DISABLED),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS,
.describe_message =
N_("Enter a list of IPv4 addresses of DNS servers.\n\n"
"Example: 8.8.8.8, 8.8.4.4\n"),
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingIPConfig, nm_setting_ip_config_get_num_dns),
.add_fcn = MULTILIST_ADD_FCN (NMSettingIPConfig, nm_setting_ip_config_add_dns),
.remove_by_idx_fcn_s = MULTILIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_dns),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingIPConfig, nm_setting_ip_config_remove_dns_by_value),
.validate2_fcn = _multilist_validate2_fcn_ip_config_dns,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_SEARCH, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_SEARCH,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingIPConfig, nm_setting_ip_config_get_num_dns_searches),
.add_fcn = MULTILIST_ADD_FCN (NMSettingIPConfig, nm_setting_ip_config_add_dns_search),
.remove_by_idx_fcn_s = MULTILIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_dns_search),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingIPConfig, nm_setting_ip_config_remove_dns_search_by_value),
.validate_fcn = _multilist_validate_fcn_is_domain,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_OPTIONS, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_OPTIONS,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingIPConfig, nm_setting_ip_config_get_num_dns_options),
.add_fcn = _multilist_add_fcn_ip_config_dns_options,
.remove_by_idx_fcn_s = MULTILIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_dns_option),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingIPConfig, nm_setting_ip_config_remove_dns_option_by_value),
.strsplit_plain = TRUE,
),
.is_default_fcn = _is_default_func_ip_config_dns_options,
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_PRIORITY, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_PRIORITY,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ADDRESSES, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ADDRESSES,
.is_cli_option = TRUE,
.property_alias = "ip4",
.inf_flags = NM_META_PROPERTY_INF_FLAG_MULTI,
.prompt = N_("IPv4 address (IP[/plen]) [none]"),
.describe_message =
N_("Enter a list of IPv4 addresses formatted as:\n"
" ip[/prefix], ip[/prefix],...\n"
"Missing prefix is regarded as prefix of 32.\n\n"
"Example: 192.168.1.5/24, 10.0.0.11/24\n"),
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_addresses),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingIPConfig, nm_setting_ip_config_clear_addresses),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_addresses,
.set_fcn = _objlist_set_fcn_ip_config_addresses,
.remove_by_idx_fcn_s = OBJLIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_address),
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY,
.is_cli_option = TRUE,
.property_alias = "gw4",
.prompt = N_("IPv4 gateway [none]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_ip_config_gateway,
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTES, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTES,
.describe_message =
N_("Enter a list of IPv4 routes formatted as:\n"
" ip[/prefix] [next-hop] [metric],...\n\n"
"Missing prefix is regarded as a prefix of 32.\n"
"Missing next-hop is regarded as 0.0.0.0.\n"
"Missing metric means default (NM/kernel will set a default value).\n\n"
"Examples: 192.168.2.0/24 192.168.2.1 3, 10.1.0.0/16 10.0.0.254\n"
" 10.1.2.0/24\n"),
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_routes),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingIPConfig, nm_setting_ip_config_clear_routes),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_routes,
.set_fcn = _objlist_set_fcn_ip_config_routes,
.remove_by_idx_fcn_s = OBJLIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_route),
.delimit_pretty_with_semicolon = TRUE,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_TABLE, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "unspec",
},
{
.value.i64 = 254,
.nick = "main",
},
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTING_RULES, NULL,
.describe_message =
N_("Enter a list of IPv4 routing rules formatted as:\n"
" priority [prio] [from [src]] [to [dst]], ,...\n"
"\n"),
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_routing_rules),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingIPConfig, nm_setting_ip_config_clear_routing_rules),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_routing_rules,
.set_fcn = _objlist_set_fcn_ip_config_routing_rules,
.remove_by_idx_fcn_u = OBJLIST_REMOVE_BY_IDX_FCN_U (NMSettingIPConfig, nm_setting_ip_config_remove_routing_rule),
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "default",
},
{
.value.i64 = G_MAXINT32,
.nick = "infinity",
},
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP4_CONFIG_DHCP_FQDN,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NEVER_DEFAULT,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_MAY_FAIL, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_MAY_FAIL,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DAD_TIMEOUT, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = -1,
.nick = "default",
},
{
.value.i64 = 0,
.nick = "off",
},
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_IP6_CONFIG
static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = {
PROPERTY_INFO (NM_SETTING_IP_CONFIG_METHOD, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_METHOD,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_ip_config_method,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NM_SETTING_IP6_CONFIG_METHOD_DHCP,
NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL,
NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NM_SETTING_IP6_CONFIG_METHOD_SHARED),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS,
.describe_message =
N_("Enter a list of IPv6 addresses of DNS servers. If the IPv6 "
"configuration method is 'auto' these DNS servers are appended "
"to those (if any) returned by automatic configuration. DNS "
"servers cannot be used with the 'shared' or 'link-local' IPv6 "
"configuration methods, as there is no upstream network. In "
"all other IPv6 configuration methods, these DNS "
"servers are used as the only DNS servers for this connection.\n\n"
"Example: 2607:f0d0:1002:51::4, 2607:f0d0:1002:51::1\n"),
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingIPConfig, nm_setting_ip_config_get_num_dns),
.add_fcn = MULTILIST_ADD_FCN (NMSettingIPConfig, nm_setting_ip_config_add_dns),
.remove_by_idx_fcn_s = MULTILIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_dns),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingIPConfig, nm_setting_ip_config_remove_dns_by_value),
.validate2_fcn = _multilist_validate2_fcn_ip_config_dns,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_SEARCH, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_SEARCH,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingIPConfig, nm_setting_ip_config_get_num_dns_searches),
.add_fcn = MULTILIST_ADD_FCN (NMSettingIPConfig, nm_setting_ip_config_add_dns_search),
.remove_by_idx_fcn_s = MULTILIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_dns_search),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingIPConfig, nm_setting_ip_config_remove_dns_search_by_value),
.validate_fcn = _multilist_validate_fcn_is_domain,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_OPTIONS, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_OPTIONS,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingIPConfig, nm_setting_ip_config_get_num_dns_options),
.add_fcn = _multilist_add_fcn_ip_config_dns_options,
.remove_by_idx_fcn_s = MULTILIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_dns_option),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingIPConfig, nm_setting_ip_config_remove_dns_option_by_value),
.strsplit_plain = TRUE,
),
.is_default_fcn = _is_default_func_ip_config_dns_options,
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_PRIORITY, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_PRIORITY,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ADDRESSES, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDRESSES,
.is_cli_option = TRUE,
.property_alias = "ip6",
.inf_flags = NM_META_PROPERTY_INF_FLAG_MULTI,
.prompt = N_("IPv6 address (IP[/plen]) [none]"),
.describe_message =
N_("Enter a list of IPv6 addresses formatted as:\n"
" ip[/prefix], ip[/prefix],...\n"
"Missing prefix is regarded as prefix of 128.\n\n"
"Example: 2607:f0d0:1002:51::4/64, 1050:0:0:0:5:600:300c:326b\n"),
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_addresses),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingIPConfig, nm_setting_ip_config_clear_addresses),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_addresses,
.set_fcn = _objlist_set_fcn_ip_config_addresses,
.remove_by_idx_fcn_s = OBJLIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_address),
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY,
.is_cli_option = TRUE,
.property_alias = "gw6",
.prompt = N_("IPv6 gateway [none]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_ip_config_gateway,
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTES, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTES,
.describe_message =
N_("Enter a list of IPv6 routes formatted as:\n"
" ip[/prefix] [next-hop] [metric],...\n\n"
"Missing prefix is regarded as a prefix of 128.\n"
"Missing next-hop is regarded as \"::\".\n"
"Missing metric means default (NM/kernel will set a default value).\n\n"
"Examples: 2001:db8:beef:2::/64 2001:db8:beef::2, 2001:db8:beef:3::/64 2001:db8:beef::3 2\n"
" abbe::/64 55\n"),
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_routes),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingIPConfig, nm_setting_ip_config_clear_routes),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_routes,
.set_fcn = _objlist_set_fcn_ip_config_routes,
.remove_by_idx_fcn_s = OBJLIST_REMOVE_BY_IDX_FCN_S (NMSettingIPConfig, nm_setting_ip_config_remove_route),
.delimit_pretty_with_semicolon = TRUE,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_TABLE, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_TABLE,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "unspec",
},
{
.value.i64 = 254,
.nick = "main",
},
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTING_RULES, NULL,
.describe_message =
N_("Enter a list of IPv6 routing rules formatted as:\n"
" priority [prio] [from [src]] [to [dst]], ,...\n"
"\n"),
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingIPConfig, nm_setting_ip_config_get_num_routing_rules),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingIPConfig, nm_setting_ip_config_clear_routing_rules),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_ip_config_routing_rules,
.set_fcn = _objlist_set_fcn_ip_config_routing_rules,
.remove_by_idx_fcn_u = OBJLIST_REMOVE_BY_IDX_FCN_U (NMSettingIPConfig, nm_setting_ip_config_remove_routing_rule),
),
),
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NEVER_DEFAULT,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_MAY_FAIL, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MAY_FAIL,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP6_CONFIG_IP6_PRIVACY,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.value_infos_get = ENUM_VALUE_INFOS (
{
.value = NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR,
.nick = "enabled, prefer public IP",
},
{
.value = NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
.nick = "enabled, prefer temporary IP",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_ip6_config_addr_gen_mode_get_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO (NM_SETTING_IP6_CONFIG_DHCP_DUID, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_DUID,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP6_CONFIG_TOKEN,
.property_type = &_pt_gobject_string,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_IP_TUNNEL
static const NMMetaPropertyInfo *const property_infos_IP_TUNNEL[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_MODE,
.is_cli_option = TRUE,
.property_alias = "mode",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = NM_META_TEXT_PROMPT_IP_TUNNEL_MODE,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_ip_tunnel_mode_get_type,
.min = NM_IP_TUNNEL_MODE_UNKNOWN + 1,
.max = G_MAXINT,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_PARENT,
.is_cli_option = TRUE,
.property_alias = "dev",
.prompt = N_("Parent device [none]"),
.property_type = &_pt_gobject_devices,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_LOCAL,
.is_cli_option = TRUE,
.property_alias = "local",
.prompt = N_("Local endpoint [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_REMOTE,
.is_cli_option = TRUE,
.property_alias = "remote",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("Remote"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_TTL,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_TOS,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_INPUT_KEY,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_OUTPUT_KEY,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_FLOW_LABEL,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_MTU,
.property_type = &_pt_gobject_mtu,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_FLAGS,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_ip_tunnel_flags_get_type,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_MACSEC
static const NMMetaPropertyInfo *const property_infos_MACSEC[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_PARENT,
.is_cli_option = TRUE,
.property_alias = "dev",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("MACsec parent device or connection UUID"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MODE,
.is_cli_option = TRUE,
.property_alias = "mode",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = NM_META_TEXT_PROMPT_MACSEC_MODE,
.def_hint = NM_META_TEXT_PROMPT_MACSEC_MODE_CHOICES,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_macsec_mode_get_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_ENCRYPT,
.is_cli_option = TRUE,
.property_alias = "encrypt",
.prompt = N_("Enable encryption [yes]"),
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MKA_CAK,
.is_cli_option = TRUE,
.property_alias = "cak",
.prompt = N_("MKA CAK"),
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MKA_CAK_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MKA_CKN,
.is_cli_option = TRUE,
.property_alias = "ckn",
.prompt = N_("MKA_CKN"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_PORT,
.is_cli_option = TRUE,
.property_alias = "port",
.prompt = N_("SCI port [1]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_VALIDATION,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_macsec_validation_get_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_SEND_SCI,
.property_type = &_pt_gobject_bool,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_MACVLAN
static const NMMetaPropertyInfo *const property_infos_MACVLAN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_PARENT,
.is_cli_option = TRUE,
.property_alias = "dev",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("MACVLAN parent device or connection UUID"),
.property_type = &_pt_gobject_devices,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_MODE,
.is_cli_option = TRUE,
.property_alias = "mode",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = NM_META_TEXT_PROMPT_MACVLAN_MODE,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_macvlan_mode_get_type,
.min = NM_SETTING_MACVLAN_MODE_UNKNOWN + 1,
.max = G_MAXINT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_PROMISCUOUS,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_TAP,
.is_cli_option = TRUE,
.property_alias = "tap",
.prompt = N_("Tap [no]"),
.property_type = &_pt_gobject_bool,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_MATCH
static const NMMetaPropertyInfo *const property_infos_MATCH[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_MATCH_INTERFACE_NAME,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_match_interface_name,
.set_fcn = _set_fcn_multilist,
.set_supports_remove = TRUE,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingMatch, nm_setting_match_get_num_interface_names),
.add2_fcn = MULTILIST_ADD2_FCN (NMSettingMatch, nm_setting_match_add_interface_name),
.remove_by_idx_fcn_s = MULTILIST_REMOVE_BY_IDX_FCN_S (NMSettingMatch, nm_setting_match_remove_interface_name),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingMatch, nm_setting_match_remove_interface_name_by_value),
.strsplit_with_escape = TRUE,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OLPC_MESH
static const NMMetaPropertyInfo *const property_infos_OLPC_MESH[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_OLPC_MESH_SSID,
.is_cli_option = TRUE,
.property_alias = "ssid",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("SSID"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_olpc_mesh_ssid,
.set_fcn = _set_fcn_gobject_ssid,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OLPC_MESH_CHANNEL,
.is_cli_option = TRUE,
.property_alias = "channel",
.prompt = N_("OLPC Mesh channel [1]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_olpc_mesh_channel,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "dhcp-anycast",
.prompt = N_("DHCP anycast MAC address [none]"),
.property_type = &_pt_gobject_mac,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_BRIDGE
static const NMMetaPropertyInfo *const property_infos_OVS_BRIDGE[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_FAIL_MODE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("secure", "standalone"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_RSTP_ENABLE,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_STP_ENABLE,
.property_type = &_pt_gobject_bool,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_INTERFACE
static const NMMetaPropertyInfo *const property_infos_OVS_INTERFACE[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_INTERFACE_TYPE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("internal", "patch"),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_PATCH
static const NMMetaPropertyInfo *const property_infos_OVS_PATCH[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PATCH_PEER,
.property_type = &_pt_gobject_string,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_PORT
static const NMMetaPropertyInfo *const property_infos_OVS_PORT[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_VLAN_MODE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("access", "native-tagged", "native-untagged", "trunk"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_TAG,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_LACP,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("active", "off", "passive"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_MODE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("active-backup", "balance-slb", "balance-tcp"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_UPDELAY,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_DOWNDELAY,
.property_type = &_pt_gobject_int,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPP
static const NMMetaPropertyInfo *const property_infos_PPP[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NOAUTH,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_EAP,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_PAP,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_CHAP,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_MSCHAP,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_MSCHAPV2,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NOBSDCOMP,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NODEFLATE,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NO_VJ_COMP,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REQUIRE_MPPE,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REQUIRE_MPPE_128,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_MPPE_STATEFUL,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_CRTSCTS,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_BAUD,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_MRU,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_MTU,
.property_type = &_pt_gobject_mtu,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu,
.get_fcn = MTU_GET_FCN (NMSettingPpp, nm_setting_ppp_get_mtu),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_LCP_ECHO_FAILURE,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_LCP_ECHO_INTERVAL,
.property_type = &_pt_gobject_int,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPPOE
static const NMMetaPropertyInfo *const property_infos_PPPOE[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PARENT,
.is_cli_option = TRUE,
.property_alias = "parent",
.prompt = N_("PPPoE parent device"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_SERVICE,
.is_cli_option = TRUE,
.property_alias = "service",
.prompt = N_("Service [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_USERNAME,
.is_cli_option = TRUE,
.property_alias = "username",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("PPPoE username"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD,
.is_cli_option = TRUE,
.property_alias = "password",
.prompt = N_("Password [none]"),
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PROXY
static const NMMetaPropertyInfo *const property_infos_PROXY[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_METHOD,
.is_cli_option = TRUE,
.property_alias = "method",
.prompt = NM_META_TEXT_PROMPT_PROXY_METHOD,
.def_hint = NM_META_TEXT_PROMPT_PROXY_METHOD_CHOICES,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_proxy_method_get_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_BROWSER_ONLY,
.is_cli_option = TRUE,
.property_alias = "browser-only",
.prompt = N_("Browser only [no]"),
.property_type = &_pt_gobject_bool
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_PAC_URL,
.is_cli_option = TRUE,
.property_alias = "pac-url",
.prompt = N_("PAC URL"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_PAC_SCRIPT,
.is_cli_option = TRUE,
.property_alias = "pac-script",
.prompt = N_("PAC script"),
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string,
.validate_fcn = _validate_fcn_proxy_pac_script,
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_SERIAL
static const NMMetaPropertyInfo *const property_infos_SERIAL[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BAUD,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BITS,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_PARITY,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.value_infos = ENUM_VALUE_INFOS (
{
.value = NM_SETTING_SERIAL_PARITY_EVEN,
.nick = "E",
},
{
.value = NM_SETTING_SERIAL_PARITY_EVEN,
.nick = "e",
},
{
.value = NM_SETTING_SERIAL_PARITY_ODD,
.nick = "O",
},
{
.value = NM_SETTING_SERIAL_PARITY_ODD,
.nick = "o",
},
{
.value = NM_SETTING_SERIAL_PARITY_NONE,
.nick = "N",
},
{
.value = NM_SETTING_SERIAL_PARITY_NONE,
.nick = "n",
},
),
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_STOPBITS,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_SEND_DELAY,
.property_type = &_pt_gobject_int,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_SRIOV
static const NMMetaPropertyInfo *const property_infos_SRIOV[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_TOTAL_VFS,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_VFS,
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingSriov, nm_setting_sriov_get_num_vfs),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingSriov, nm_setting_sriov_clear_vfs),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_sriov_vfs,
.set_fcn = _objlist_set_fcn_sriov_vfs,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_AUTOPROBE_DRIVERS,
.property_type = &_pt_gobject_enum,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TC_CONFIG
static const NMMetaPropertyInfo *const property_infos_TC_CONFIG[] = {
PROPERTY_INFO (NM_SETTING_TC_CONFIG_QDISCS, DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS,
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTCConfig, nm_setting_tc_config_get_num_qdiscs),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingTCConfig, nm_setting_tc_config_clear_qdiscs),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_tc_config_qdiscs,
.set_fcn = _objlist_set_fcn_tc_config_qdiscs,
.remove_by_idx_fcn_u = OBJLIST_REMOVE_BY_IDX_FCN_U (NMSettingTCConfig, nm_setting_tc_config_remove_qdisc),
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO (NM_SETTING_TC_CONFIG_TFILTERS, DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS,
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTCConfig, nm_setting_tc_config_get_num_tfilters),
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingTCConfig, nm_setting_tc_config_clear_tfilters),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_tc_config_tfilters,
.set_fcn = _objlist_set_fcn_tc_config_tfilters,
.remove_by_idx_fcn_u = OBJLIST_REMOVE_BY_IDX_FCN_U (NMSettingTCConfig, nm_setting_tc_config_remove_tfilter),
.strsplit_plain = TRUE,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TEAM
static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_CONFIG,
.is_cli_option = TRUE,
.property_alias = "config",
.prompt = N_("Team JSON configuration [none]"),
.describe_message = TEAM_DESCRIBE_MESSAGE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string,
.validate_fcn = _validate_fcn_team_config,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_NOTIFY_PEERS_COUNT,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "disabled",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_NOTIFY_PEERS_INTERVAL,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_MCAST_REJOIN_COUNT,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "disabled",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_MCAST_REJOIN_INTERVAL,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_TEAM_RUNNER_BROADCAST,
NM_SETTING_TEAM_RUNNER_ROUNDROBIN,
NM_SETTING_TEAM_RUNNER_RANDOM,
NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP,
NM_SETTING_TEAM_RUNNER_LOADBALANCE,
NM_SETTING_TEAM_RUNNER_LACP),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_HWADDR_POLICY,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL,
NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_BY_ACTIVE,
NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_ONLY_ACTIVE),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_TX_HASH,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u = MULTILIST_GET_NUM_FCN_U (NMSettingTeam, nm_setting_team_get_num_runner_tx_hash),
.clear_all_fcn = _multilist_clear_all_fcn_team_runner_tx_hash,
.add_fcn = MULTILIST_ADD_FCN (NMSettingTeam, nm_setting_team_add_runner_tx_hash),
.remove_by_idx_fcn_u = MULTILIST_REMOVE_BY_IDX_FCN_U (NMSettingTeam, nm_setting_team_remove_runner_tx_hash),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingTeam, nm_setting_team_remove_runner_tx_hash_by_value),
.strsplit_plain = TRUE,
),
.values_static = NM_MAKE_STRV ("eth", "vlan", "ipv4", "ipv6", "ip",
"l3", "tcp", "udp", "sctp", "l4"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_TX_BALANCER,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("basic"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL_DEFAULT,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_ACTIVE,
.property_type = & _pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_FAST_RATE,
.property_type = & _pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_SYS_PRIO,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = NM_SETTING_TEAM_RUNNER_SYS_PRIO_DEFAULT,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_MIN_PORTS,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO,
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO_STABLE,
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_BANDWIDTH,
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_COUNT,
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_PORT_CONFIG),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_LINK_WATCHERS,
.describe_message = TEAM_LINK_WATCHERS_DESCRIBE_MESSAGE,
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTeam, nm_setting_team_get_num_link_watchers),
.clear_all_fcn = _objlist_clear_all_fcn_team_link_watchers,
.obj_to_str_fcn = _objlist_obj_to_str_fcn_team_link_watchers,
.set_fcn = _objlist_set_fcn_team_link_watchers,
.remove_by_idx_fcn_u = OBJLIST_REMOVE_BY_IDX_FCN_U (NMSettingTeam, nm_setting_team_remove_link_watcher),
.strsplit_plain = TRUE,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TEAM_PORT
static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_CONFIG,
.is_cli_option = TRUE,
.property_alias = "config",
.prompt = N_("Team JSON configuration [none]"),
.describe_message = TEAM_DESCRIBE_MESSAGE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string,
.validate_fcn = _validate_fcn_team_config,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_QUEUE_ID,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = NM_SETTING_TEAM_PORT_QUEUE_ID_DEFAULT,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_PRIO,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_STICKY,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_LACP_PRIO,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = NM_SETTING_TEAM_PORT_LACP_PRIO_DEFAULT,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_LACP_KEY,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = 0,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_LINK_WATCHERS,
.describe_message = TEAM_LINK_WATCHERS_DESCRIBE_MESSAGE,
.property_type = &_pt_objlist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (objlist,
.get_num_fcn = OBJLIST_GET_NUM_FCN (NMSettingTeamPort, nm_setting_team_port_get_num_link_watchers),
.clear_all_fcn = _objlist_clear_all_fcn_team_link_watchers,
.obj_to_str_fcn = _objlist_obj_to_str_fcn_team_link_watchers,
.set_fcn = _objlist_set_fcn_team_link_watchers,
.remove_by_idx_fcn_u = OBJLIST_REMOVE_BY_IDX_FCN_U (NMSettingTeamPort, nm_setting_team_port_remove_link_watcher),
.strsplit_plain = TRUE,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TUN
static const NMMetaPropertyInfo *const property_infos_TUN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_MODE,
.is_cli_option = TRUE,
.property_alias = "mode",
.prompt = NM_META_TEXT_PROMPT_TUN_MODE,
.def_hint = NM_META_TEXT_PROMPT_TUN_MODE_CHOICES,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_tun_mode_get_type,
.min = NM_SETTING_TUN_MODE_UNKNOWN + 1,
.max = G_MAXINT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_OWNER,
.is_cli_option = TRUE,
.property_alias = "owner",
.prompt = N_("User ID [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_GROUP,
.is_cli_option = TRUE,
.property_alias = "group",
.prompt = N_("Group ID [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_PI,
.is_cli_option = TRUE,
.property_alias = "pi",
.prompt = N_("Enable PI [no]"),
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_VNET_HDR,
.is_cli_option = TRUE,
.property_alias = "vnet-hdr",
.prompt = N_("Enable VNET header [no]"),
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_MULTI_QUEUE,
.is_cli_option = TRUE,
.property_alias = "multi-queue",
.prompt = N_("Enable multi queue [no]"),
.property_type = &_pt_gobject_bool,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VLAN
static const NMMetaPropertyInfo *const property_infos_VLAN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_PARENT,
.is_cli_option = TRUE,
.property_alias = "dev",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("VLAN parent device or connection UUID"),
.property_type = &_pt_gobject_devices,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_ID,
.is_cli_option = TRUE,
.property_alias = "id",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("VLAN ID (<0-4094>)"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_FLAGS,
.is_cli_option = TRUE,
.property_alias = "flags",
.prompt = N_("VLAN flags (<0-7>) [none]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_vlan_flags,
.set_fcn = _set_fcn_gobject_flags,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_INGRESS_PRIORITY_MAP,
.is_cli_option = TRUE,
.property_alias = "ingress",
.prompt = N_("Ingress priority maps [none]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_vlan_xgress_priority_map,
.set_fcn = _set_fcn_vlan_xgress_priority_map,
.set_supports_remove = TRUE,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_EGRESS_PRIORITY_MAP,
.is_cli_option = TRUE,
.property_alias = "egress",
.prompt = N_("Egress priority maps [none]"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_vlan_xgress_priority_map,
.set_fcn = _set_fcn_vlan_xgress_priority_map,
.set_supports_remove = TRUE,
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VPN
static const NMMetaPropertyInfo *const property_infos_VPN[] = {
[_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE] =
PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_SERVICE_TYPE,
.is_cli_option = TRUE,
.property_alias = "vpn-type",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = NM_META_TEXT_PROMPT_VPN_TYPE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_vpn_service_type,
.complete_fcn = _complete_fcn_vpn_service_type,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_USER_NAME,
.is_cli_option = TRUE,
.property_alias = "user",
.prompt = N_("Username [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_DATA,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_vpn_data,
.set_fcn = _set_fcn_optionlist,
.set_supports_remove = TRUE,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (optionlist,
.set_fcn = _optionlist_set_fcn_vpn_data,
.no_empty_value = TRUE,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_SECRETS,
.is_secret = TRUE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_vpn_secrets,
.set_fcn = _set_fcn_optionlist,
.set_supports_remove = TRUE,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (optionlist,
.set_fcn = _optionlist_set_fcn_vpn_secrets,
.no_empty_value = TRUE,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_PERSISTENT,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_TIMEOUT,
.property_type = &_pt_gobject_int,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VXLAN
static const NMMetaPropertyInfo *const property_infos_VXLAN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_PARENT,
.is_cli_option = TRUE,
.property_alias = "dev",
.prompt = N_("Parent device [none]"),
.property_type = &_pt_gobject_devices,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_ID,
.is_cli_option = TRUE,
.property_alias = "id",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("VXLAN ID"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_LOCAL,
.is_cli_option = TRUE,
.property_alias = "local",
.prompt = N_("Local address [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_REMOTE,
.is_cli_option = TRUE,
.property_alias = "remote",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("Remote"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_SOURCE_PORT_MIN,
.is_cli_option = TRUE,
.property_alias = "source-port-min",
.prompt = N_("Minimum source port [0]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_SOURCE_PORT_MAX,
.is_cli_option = TRUE,
.property_alias = "source-port-max",
.prompt = N_("Maximum source port [0]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_DESTINATION_PORT,
.is_cli_option = TRUE,
.property_alias = "destination-port",
.prompt = N_("Destination port [8472]"),
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_TOS,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_TTL,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_AGEING,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_LIMIT,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_LEARNING,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_PROXY,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_RSC,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_L2_MISS,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_L3_MISS,
.property_type = &_pt_gobject_bool,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIFI_P2P
static const NMMetaPropertyInfo *const property_infos_WIFI_P2P[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIFI_P2P_PEER,
.is_cli_option = TRUE,
.property_alias = "peer",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("Peer"),
.property_type = &_pt_gobject_mac,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIFI_P2P_WPS_METHOD,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_wireless_security_wps_method_get_type,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIFI_P2P_WFD_IES,
.property_type = &_pt_gobject_bytes,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIMAX
static const NMMetaPropertyInfo *const property_infos_WIMAX[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIMAX_MAC_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "mac",
.prompt = N_("MAC [none]"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIMAX_NETWORK_NAME,
.is_cli_option = TRUE,
.property_alias = "nsp",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("WiMAX NSP name"),
.property_type = &_pt_gobject_mac,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIRED
static const NMMetaPropertyInfo *const property_infos_WIRED[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_PORT,
/* Do not allow setting 'port' for now. It is not implemented in
* NM core, nor in ifcfg-rh plugin. Enable this when it gets done.
* wired_valid_ports[] = { "tp", "aui", "bnc", "mii", NULL };
*/
.property_type = &_pt_gobject_readonly,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_SPEED,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_DUPLEX,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("half", "full"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_AUTO_NEGOTIATE,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_MAC_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "mac",
.prompt = N_("MAC [none]"),
.property_type = &_pt_gobject_mac,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "cloned-mac",
.prompt = N_("Cloned MAC [none]"),
.property_type = &_pt_gobject_mac,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac,
.mode = NM_META_PROPERTY_TYPE_MAC_MODE_CLONED,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSettingWired, nm_setting_wired_get_num_mac_blacklist_items),
.add_fcn = MULTILIST_ADD_FCN (NMSettingWired, nm_setting_wired_add_mac_blacklist_item),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSettingWired, nm_setting_wired_remove_mac_blacklist_item),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingWired, nm_setting_wired_remove_mac_blacklist_item_by_value),
.validate2_fcn = _multilist_validate2_fcn_mac_addr,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_MTU,
.is_cli_option = TRUE,
.property_alias = "mtu",
.prompt = N_("MTU [auto]"),
.property_type = &_pt_gobject_mtu,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu,
.get_fcn = MTU_GET_FCN (NMSettingWired, nm_setting_wired_get_mtu),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_SUBCHANNELS,
.describe_message =
N_("Enter a list of subchannels (comma or space separated).\n\n"
"Example: 0.0.0e20 0.0.0e21 0.0.0e22\n"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_wired_s390_subchannels,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_NETTYPE,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("qeth", "lcs", "ctc"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_OPTIONS,
.property_type = DEFINE_PROPERTY_TYPE (
.describe_fcn = _describe_fcn_wired_s390_options,
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_optionlist,
.set_supports_remove = TRUE,
.values_fcn = _values_fcn_wired_s390_options,
),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (optionlist,
.set_fcn = _optionlist_set_fcn_wired_s390_options,
.no_empty_value = TRUE,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_WAKE_ON_LAN,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_wired_wake_on_lan_get_type,
.value_infos = ENUM_VALUE_INFOS (
{
.value = NM_SETTING_WIRED_WAKE_ON_LAN_NONE,
.nick = "none",
},
{
.value = NM_SETTING_WIRED_WAKE_ON_LAN_NONE,
.nick = "disable",
},
{
.value = NM_SETTING_WIRED_WAKE_ON_LAN_NONE,
.nick = "disabled",
},
),
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD,
.property_type = &_pt_gobject_mac,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIREGUARD
static const NMMetaPropertyInfo *const property_infos_WIREGUARD[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIREGUARD_PRIVATE_KEY,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIREGUARD_LISTEN_PORT,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIREGUARD_FWMARK,
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.base = 16,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIREGUARD_PEER_ROUTES,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIREGUARD_MTU,
.property_type = &_pt_gobject_mtu,
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIRELESS
static const NMMetaPropertyInfo *const property_infos_WIRELESS[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SSID,
.is_cli_option = TRUE,
.property_alias = "ssid",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("SSID"),
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_wireless_ssid,
.set_fcn = _set_fcn_gobject_ssid,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MODE,
.is_cli_option = TRUE,
.property_alias = "mode",
.prompt = NM_META_TEXT_PROMPT_WIFI_MODE,
.def_hint = NM_META_TEXT_PROMPT_WIFI_MODE_CHOICES,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV (NM_SETTING_WIRELESS_MODE_INFRA,
NM_SETTING_WIRELESS_MODE_ADHOC,
NM_SETTING_WIRELESS_MODE_AP),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_BAND,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("a", "bg"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_CHANNEL,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_gobject,
.set_fcn = _set_fcn_wireless_channel,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_BSSID,
.property_type = &_pt_gobject_mac,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_RATE,
/* Do not allow setting 'rate'. It is not implemented in NM core. */
.property_type = &_pt_gobject_readonly,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_TX_POWER,
/* Do not allow setting 'tx-power'. It is not implemented in NM core. */
.property_type = &_pt_gobject_readonly,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MAC_ADDRESS,
.property_type = &_pt_gobject_mac,
.is_cli_option = TRUE,
.property_alias = "mac",
.prompt = N_("MAC [none]"),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "cloned-mac",
.prompt = N_("Cloned MAC [none]"),
.property_type = &_pt_gobject_mac,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac,
.mode = NM_META_PROPERTY_TYPE_MAC_MODE_CLONED,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSettingWireless, nm_setting_wireless_get_num_mac_blacklist_items),
.add_fcn = MULTILIST_ADD_FCN (NMSettingWireless, nm_setting_wireless_add_mac_blacklist_item),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSettingWireless, nm_setting_wireless_remove_mac_blacklist_item),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingWireless, nm_setting_wireless_remove_mac_blacklist_item_by_value),
.validate2_fcn = _multilist_validate2_fcn_mac_addr,
.strsplit_plain = TRUE,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_mac_randomization_get_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MTU,
.is_cli_option = TRUE,
.property_alias = "mtu",
.prompt = N_("MTU [auto]"),
.property_type = &_pt_gobject_mtu,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu,
.get_fcn = MTU_GET_FCN (NMSettingWireless, nm_setting_wireless_get_mtu),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SEEN_BSSIDS,
.property_type = &_pt_gobject_readonly,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_HIDDEN,
.property_type = &_pt_gobject_bool,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_POWERSAVE,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_wireless_powersave_get_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_WAKE_ON_WLAN,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_wireless_wake_on_wlan_get_type,
.value_infos = ENUM_VALUE_INFOS (
{
.value = NM_SETTING_WIRELESS_WAKE_ON_WLAN_NONE,
.nick = "disabled",
},
),
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIRELESS_SECURITY
static const NMMetaPropertyInfo *const property_infos_WIRELESS_SECURITY[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap", "sae"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX,
.property_type = &_pt_gobject_int,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_AUTH_ALG,
.property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = NM_MAKE_STRV ("open", "shared", "leap"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PROTO,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSettingWirelessSecurity, nm_setting_wireless_security_get_num_protos),
.add_fcn = MULTILIST_ADD_FCN (NMSettingWirelessSecurity, nm_setting_wireless_security_add_proto),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSettingWirelessSecurity, nm_setting_wireless_security_remove_proto),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingWirelessSecurity, nm_setting_wireless_security_remove_proto_by_value),
.strsplit_plain = TRUE,
),
.values_static = NM_MAKE_STRV ("wpa", "rsn"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PAIRWISE,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSettingWirelessSecurity, nm_setting_wireless_security_get_num_pairwise),
.add_fcn = MULTILIST_ADD_FCN (NMSettingWirelessSecurity, nm_setting_wireless_security_add_pairwise),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSettingWirelessSecurity, nm_setting_wireless_security_remove_pairwise),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingWirelessSecurity, nm_setting_wireless_security_remove_pairwise_by_value),
.strsplit_plain = TRUE,
),
.values_static = NM_MAKE_STRV ("tkip", "ccmp"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_GROUP,
.property_type = &_pt_multilist,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (multilist,
.get_num_fcn_u32 = MULTILIST_GET_NUM_FCN_U32 (NMSettingWirelessSecurity, nm_setting_wireless_security_get_num_groups),
.add_fcn = MULTILIST_ADD_FCN (NMSettingWirelessSecurity, nm_setting_wireless_security_add_group),
.remove_by_idx_fcn_u32 = MULTILIST_REMOVE_BY_IDX_FCN_U32 (NMSettingWirelessSecurity, nm_setting_wireless_security_remove_group),
.remove_by_value_fcn = MULTILIST_REMOVE_BY_VALUE_FCN (NMSettingWirelessSecurity, nm_setting_wireless_security_remove_group_by_value),
.strsplit_plain = TRUE,
),
.values_static = NM_MAKE_STRV ("wep40", "wep104", "tkip", "ccmp"),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PMF,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_wireless_security_pmf_get_type,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY0,
.is_secret = TRUE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_wireless_security_wep_key,
.set_fcn = _set_fcn_wireless_wep_key,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY1,
.is_secret = TRUE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_wireless_security_wep_key,
.set_fcn = _set_fcn_wireless_wep_key,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY2,
.is_secret = TRUE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_wireless_security_wep_key,
.set_fcn = _set_fcn_wireless_wep_key,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY3,
.is_secret = TRUE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_wireless_security_wep_key,
.set_fcn = _set_fcn_wireless_wep_key,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE,
.describe_message =
N_("Enter the type of WEP keys. The accepted values are: "
"0 or unknown, 1 or key, and 2 or passphrase.\n"),
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.pre_set_notify = _gobject_enum_pre_set_notify_fcn_wireless_security_wep_key_type,
),
.typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT
| NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PSK,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD,
.is_secret = TRUE,
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS,
.property_type = &_pt_gobject_secret_flags,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_wireless_security_wps_method_get_type,
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_FILS,
.property_type = &_pt_gobject_enum,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
PROPERTY_TYP_DATA_SUBTYPE (gobject_enum,
.get_gtype = nm_setting_wireless_security_fils_get_type,
),
),
),
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WPAN
static const NMMetaPropertyInfo *const property_infos_WPAN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_MAC_ADDRESS,
.property_type = &_pt_gobject_mac,
.is_cli_option = TRUE,
.property_alias = "mac",
.prompt = N_("MAC [none]"),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac,
.mode = NM_META_PROPERTY_TYPE_MAC_MODE_WPAN,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_SHORT_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "short-addr",
.prompt = N_("Short address (<0x0000-0xffff>)"),
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.base = 16,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = G_MAXUINT16,
.nick = "unset",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_PAN_ID,
.is_cli_option = TRUE,
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.property_alias = "pan-id",
.prompt = N_("PAN Identifier (<0x0000-0xffff>)"),
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.base = 16,
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = G_MAXUINT16,
.nick = "unset",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_PAGE,
.is_cli_option = TRUE,
.property_alias = "page",
.prompt = N_("Page (<default|0-31>)"),
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = NM_SETTING_WPAN_PAGE_DEFAULT,
.nick = "default",
},
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_CHANNEL,
.is_cli_option = TRUE,
.property_alias = "channel",
.prompt = N_("Channel (<default|0-26>)"),
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.value_infos = INT_VALUE_INFOS (
{
.value.i64 = NM_SETTING_WPAN_CHANNEL_DEFAULT,
.nick = "default",
},
),
),
),
NULL
};
/*****************************************************************************/
static void
_setting_init_fcn_adsl (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
/* Initialize a protocol */
g_object_set (NM_SETTING_ADSL (setting),
NM_SETTING_ADSL_PROTOCOL, NM_SETTING_ADSL_PROTOCOL_PPPOE,
NULL);
}
}
static void
_setting_init_fcn_cdma (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
/* Initialize 'number' so that 'cdma' is valid */
g_object_set (NM_SETTING_CDMA (setting),
NM_SETTING_CDMA_NUMBER, "#777",
NULL);
}
}
static void
_setting_init_fcn_gsm (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
/* Initialize 'apn' so that 'gsm' is valid */
g_object_set (NM_SETTING_GSM (setting),
NM_SETTING_GSM_APN, "internet",
NULL);
}
}
static void
_setting_init_fcn_infiniband (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
/* Initialize 'transport-mode' so that 'infiniband' is valid */
g_object_set (NM_SETTING_INFINIBAND (setting),
NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram",
NULL);
}
}
static void
_setting_init_fcn_ip4_config (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
g_object_set (NM_SETTING_IP_CONFIG (setting),
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
}
}
static void
_setting_init_fcn_ip6_config (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
g_object_set (NM_SETTING_IP_CONFIG (setting),
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
}
}
static void
_setting_init_fcn_olpc_mesh (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
g_object_set (NM_SETTING_OLPC_MESH (setting),
NM_SETTING_OLPC_MESH_CHANNEL, 1,
NULL);
}
}
static void
_setting_init_fcn_proxy (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
g_object_set (NM_SETTING_PROXY (setting),
NM_SETTING_PROXY_METHOD, (int) NM_SETTING_PROXY_METHOD_NONE,
NULL);
}
}
static void
_setting_init_fcn_tun (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
g_object_set (NM_SETTING_TUN (setting),
NM_SETTING_TUN_MODE, NM_SETTING_TUN_MODE_TUN,
NULL);
}
}
static void
_setting_init_fcn_vlan (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
g_object_set (setting,
NM_SETTING_VLAN_ID, 1,
NULL);
}
}
static void
_setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN)
{
if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) {
/* For Wi-Fi set mode to "infrastructure". Even though mode == NULL
* is regarded as "infrastructure", explicit value makes no doubts.
*/
g_object_set (NM_SETTING_WIRELESS (setting),
NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_INFRA,
NULL);
}
}
/*****************************************************************************/
#define SETTING_PRETTY_NAME_6LOWPAN N_("6LOWPAN settings")
#define SETTING_PRETTY_NAME_802_1X N_("802-1x settings")
#define SETTING_PRETTY_NAME_ADSL N_("ADSL connection")
#define SETTING_PRETTY_NAME_BLUETOOTH N_("bluetooth connection")
#define SETTING_PRETTY_NAME_BOND N_("Bond device")
#define SETTING_PRETTY_NAME_BRIDGE N_("Bridge device")
#define SETTING_PRETTY_NAME_BRIDGE_PORT N_("Bridge port")
#define SETTING_PRETTY_NAME_CDMA N_("CDMA mobile broadband connection")
#define SETTING_PRETTY_NAME_CONNECTION N_("General settings")
#define SETTING_PRETTY_NAME_DCB N_("DCB settings")
#define SETTING_PRETTY_NAME_DUMMY N_("Dummy settings")
#define SETTING_PRETTY_NAME_ETHTOOL N_("Ethtool settings")
#define SETTING_PRETTY_NAME_GENERIC N_("Generic settings")
#define SETTING_PRETTY_NAME_GSM N_("GSM mobile broadband connection")
#define SETTING_PRETTY_NAME_INFINIBAND N_("InfiniBand connection")
#define SETTING_PRETTY_NAME_IP4_CONFIG N_("IPv4 protocol")
#define SETTING_PRETTY_NAME_IP6_CONFIG N_("IPv6 protocol")
#define SETTING_PRETTY_NAME_IP_TUNNEL N_("IP-tunnel settings")
#define SETTING_PRETTY_NAME_MACSEC N_("MACsec connection")
#define SETTING_PRETTY_NAME_MACVLAN N_("macvlan connection")
#define SETTING_PRETTY_NAME_MATCH N_("Match")
#define SETTING_PRETTY_NAME_OLPC_MESH N_("OLPC Mesh connection")
#define SETTING_PRETTY_NAME_OVS_BRIDGE N_("Open vSwitch bridge settings")
#define SETTING_PRETTY_NAME_OVS_INTERFACE N_("Open vSwitch interface settings")
#define SETTING_PRETTY_NAME_OVS_PATCH N_("Open vSwitch patch interface settings")
#define SETTING_PRETTY_NAME_OVS_PORT N_("Open vSwitch port settings")
#define SETTING_PRETTY_NAME_PPP N_("PPP settings")
#define SETTING_PRETTY_NAME_PPPOE N_("PPPoE")
#define SETTING_PRETTY_NAME_PROXY N_("Proxy")
#define SETTING_PRETTY_NAME_SERIAL N_("Serial settings")
#define SETTING_PRETTY_NAME_SRIOV N_("SR-IOV settings")
#define SETTING_PRETTY_NAME_TC_CONFIG N_("Traffic controls")
#define SETTING_PRETTY_NAME_TEAM N_("Team device")
#define SETTING_PRETTY_NAME_TEAM_PORT N_("Team port")
#define SETTING_PRETTY_NAME_TUN N_("Tun device")
#define SETTING_PRETTY_NAME_USER N_("User settings")
#define SETTING_PRETTY_NAME_VLAN N_("VLAN connection")
#define SETTING_PRETTY_NAME_VPN N_("VPN connection")
#define SETTING_PRETTY_NAME_VXLAN N_("VXLAN connection")
#define SETTING_PRETTY_NAME_WIFI_P2P N_("Wi-Fi P2P connection")
#define SETTING_PRETTY_NAME_WIMAX N_("WiMAX connection")
#define SETTING_PRETTY_NAME_WIRED N_("Wired Ethernet")
#define SETTING_PRETTY_NAME_WIREGUARD N_("WireGuard VPN settings")
#define SETTING_PRETTY_NAME_WIRELESS N_("Wi-Fi connection")
#define SETTING_PRETTY_NAME_WIRELESS_SECURITY N_("Wi-Fi security settings")
#define SETTING_PRETTY_NAME_WPAN N_("WPAN settings")
#define NM_META_SETTING_VALID_PARTS(...) \
((const NMMetaSettingValidPartItem *const[]) { __VA_ARGS__ NULL })
#define NM_META_SETTING_VALID_PART_ITEM(type, mand) \
(&((const NMMetaSettingValidPartItem) { \
.setting_info = &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_##type], \
.mandatory = mand, \
}))
const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = {
#define SETTING_INFO_EMPTY(type, ...) \
[NM_META_SETTING_TYPE_##type] = { \
.meta_type = &nm_meta_type_setting_info_editor, \
.general = &nm_meta_setting_infos[NM_META_SETTING_TYPE_##type], \
.pretty_name = SETTING_PRETTY_NAME_##type, \
__VA_ARGS__ \
}
#define SETTING_INFO(type, ...) \
[NM_META_SETTING_TYPE_##type] = { \
.meta_type = &nm_meta_type_setting_info_editor, \
.general = &nm_meta_setting_infos[NM_META_SETTING_TYPE_##type], \
.properties = property_infos_##type, \
.properties_num = G_N_ELEMENTS (property_infos_##type) - 1, \
.pretty_name = SETTING_PRETTY_NAME_##type, \
__VA_ARGS__ \
}
SETTING_INFO (6LOWPAN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (6LOWPAN, TRUE),
),
),
SETTING_INFO (802_1X),
SETTING_INFO (ADSL,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (ADSL, TRUE),
),
.setting_init_fcn = _setting_init_fcn_adsl,
),
SETTING_INFO (BLUETOOTH,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (BLUETOOTH, TRUE),
NM_META_SETTING_VALID_PART_ITEM (BRIDGE, FALSE),
NM_META_SETTING_VALID_PART_ITEM (GSM, FALSE),
NM_META_SETTING_VALID_PART_ITEM (CDMA, FALSE),
),
),
SETTING_INFO (BOND,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (BOND, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (BRIDGE,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (BRIDGE, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (BRIDGE_PORT),
SETTING_INFO (CDMA,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (CDMA, TRUE),
NM_META_SETTING_VALID_PART_ITEM (SERIAL, FALSE),
NM_META_SETTING_VALID_PART_ITEM (PPP, FALSE),
),
.setting_init_fcn = _setting_init_fcn_cdma,
),
SETTING_INFO (CONNECTION),
SETTING_INFO (DCB),
SETTING_INFO (ETHTOOL),
SETTING_INFO_EMPTY (DUMMY,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (DUMMY, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO_EMPTY (GENERIC,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (GENERIC, TRUE),
),
),
SETTING_INFO (GSM,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (GSM, TRUE),
NM_META_SETTING_VALID_PART_ITEM (SERIAL, FALSE),
NM_META_SETTING_VALID_PART_ITEM (PPP, FALSE),
),
.setting_init_fcn = _setting_init_fcn_gsm,
),
SETTING_INFO (INFINIBAND,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (INFINIBAND, TRUE),
NM_META_SETTING_VALID_PART_ITEM (SRIOV, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
.setting_init_fcn = _setting_init_fcn_infiniband,
),
SETTING_INFO (IP4_CONFIG,
.setting_init_fcn = _setting_init_fcn_ip4_config,
),
SETTING_INFO (IP6_CONFIG,
.setting_init_fcn = _setting_init_fcn_ip6_config,
),
SETTING_INFO (IP_TUNNEL,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (IP_TUNNEL, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (MACSEC,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (MACSEC, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (MACVLAN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (MACVLAN, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (MATCH),
SETTING_INFO (OLPC_MESH,
.alias = "olpc-mesh",
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (OLPC_MESH, TRUE),
),
.setting_init_fcn = _setting_init_fcn_olpc_mesh,
),
SETTING_INFO (OVS_BRIDGE,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (OVS_BRIDGE, TRUE),
),
),
SETTING_INFO (OVS_INTERFACE,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (OVS_INTERFACE, TRUE),
NM_META_SETTING_VALID_PART_ITEM (OVS_PATCH, FALSE),
NM_META_SETTING_VALID_PART_ITEM (IP4_CONFIG, FALSE),
NM_META_SETTING_VALID_PART_ITEM (IP6_CONFIG, FALSE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (OVS_PATCH),
SETTING_INFO (OVS_PORT,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (OVS_PORT, TRUE),
),
),
SETTING_INFO (PPPOE,
/* PPPoE is a base connection type from historical reasons.
* See libnm-core/nm-setting.c:_nm_setting_is_base_type()
*/
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (PPPOE, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, TRUE),
NM_META_SETTING_VALID_PART_ITEM (PPP, FALSE),
NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (PPP),
SETTING_INFO (PROXY,
.setting_init_fcn = _setting_init_fcn_proxy,
),
SETTING_INFO (SERIAL),
SETTING_INFO (SRIOV),
SETTING_INFO (TC_CONFIG),
SETTING_INFO (TEAM,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (TEAM, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (TEAM_PORT),
SETTING_INFO (TUN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (TUN, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
.setting_init_fcn = _setting_init_fcn_tun,
),
SETTING_INFO_EMPTY (USER),
SETTING_INFO (VLAN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (VLAN, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
.setting_init_fcn = _setting_init_fcn_vlan,
),
SETTING_INFO (VPN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (VPN, TRUE),
),
),
SETTING_INFO (VXLAN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (VXLAN, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (WIFI_P2P,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIFI_P2P, TRUE),
),
),
SETTING_INFO (WIMAX,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIMAX, TRUE),
),
),
SETTING_INFO (WIRED,
.alias = "ethernet",
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRED, TRUE),
NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE),
NM_META_SETTING_VALID_PART_ITEM (DCB, FALSE),
NM_META_SETTING_VALID_PART_ITEM (SRIOV, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
),
SETTING_INFO (WIREGUARD,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIREGUARD, TRUE),
),
),
SETTING_INFO (WIRELESS,
.alias = "wifi",
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRELESS, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WIRELESS_SECURITY, FALSE),
NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE),
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
),
.setting_init_fcn = _setting_init_fcn_wireless,
),
SETTING_INFO (WIRELESS_SECURITY,
.alias = "wifi-sec",
),
SETTING_INFO (WPAN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WPAN, TRUE),
),
),
};
/*****************************************************************************/
const NMMetaSettingValidPartItem *const nm_meta_setting_info_valid_parts_default[] = {
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NULL
};
/*****************************************************************************/
static const NMMetaSettingValidPartItem *const valid_settings_noslave[] = {
NM_META_SETTING_VALID_PART_ITEM (MATCH, FALSE),
NM_META_SETTING_VALID_PART_ITEM (IP4_CONFIG, FALSE),
NM_META_SETTING_VALID_PART_ITEM (IP6_CONFIG, FALSE),
NM_META_SETTING_VALID_PART_ITEM (TC_CONFIG, FALSE),
NM_META_SETTING_VALID_PART_ITEM (PROXY, FALSE),
NULL,
};
static const NMMetaSettingValidPartItem *const valid_settings_slave_bridge[] = {
NM_META_SETTING_VALID_PART_ITEM (BRIDGE_PORT, TRUE),
NULL,
};
static const NMMetaSettingValidPartItem *const valid_settings_slave_ovs_bridge[] = {
NM_META_SETTING_VALID_PART_ITEM (OVS_PORT, FALSE),
NULL,
};
static const NMMetaSettingValidPartItem *const valid_settings_slave_ovs_port[] = {
NM_META_SETTING_VALID_PART_ITEM (OVS_INTERFACE, FALSE),
NULL,
};
static const NMMetaSettingValidPartItem *const valid_settings_slave_team[] = {
NM_META_SETTING_VALID_PART_ITEM (TEAM_PORT, TRUE),
NULL,
};
const NMMetaSettingValidPartItem *const*
nm_meta_setting_info_valid_parts_for_slave_type (const char *slave_type, const char **out_slave_name)
{
if (!slave_type) {
NM_SET_OUT (out_slave_name, NULL);
return valid_settings_noslave;
}
if (nm_streq (slave_type, NM_SETTING_BOND_SETTING_NAME)) {
NM_SET_OUT (out_slave_name, "bond-slave");
return NM_PTRARRAY_EMPTY (const NMMetaSettingValidPartItem *);
}
if (nm_streq (slave_type, NM_SETTING_BRIDGE_SETTING_NAME)) {
NM_SET_OUT (out_slave_name, "bridge-slave");
return valid_settings_slave_bridge;
}
if (nm_streq (slave_type, NM_SETTING_OVS_BRIDGE_SETTING_NAME)) {
NM_SET_OUT (out_slave_name, "ovs-slave");
return valid_settings_slave_ovs_bridge;
}
if (nm_streq (slave_type, NM_SETTING_OVS_PORT_SETTING_NAME)) {
NM_SET_OUT (out_slave_name, "ovs-slave");
return valid_settings_slave_ovs_port;
}
if (nm_streq (slave_type, NM_SETTING_TEAM_SETTING_NAME)) {
NM_SET_OUT (out_slave_name, "team-slave");
return valid_settings_slave_team;
}
return NULL;
}
/*****************************************************************************/
static const char *
_meta_type_setting_info_editor_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header)
{
if (for_header)
return N_("name");
return ((const NMMetaSettingInfoEditor *) abstract_info)->general->setting_name;
}
static const char *
_meta_type_property_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header)
{
return ((const NMMetaPropertyInfo *) abstract_info)->property_name;
}
static gconstpointer
_meta_type_setting_info_editor_get_fcn (const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
gpointer target,
gpointer target_data,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gboolean *out_is_default,
gpointer *out_to_free)
{
const NMMetaSettingInfoEditor *info = (const NMMetaSettingInfoEditor *) abstract_info;
nm_assert (!out_to_free || !*out_to_free);
nm_assert (out_flags && !*out_flags);
nm_assert (!target_data);
if (!NM_IN_SET (get_type,
NM_META_ACCESSOR_GET_TYPE_PARSABLE,
NM_META_ACCESSOR_GET_TYPE_PRETTY))
return NULL;
nm_assert (out_to_free);
return info->general->setting_name;
}
static gconstpointer
_meta_type_property_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
gpointer target,
gpointer target_data,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags,
NMMetaAccessorGetOutFlags *out_flags,
gboolean *out_is_default,
gpointer *out_to_free)
{
const NMMetaPropertyInfo *info = (const NMMetaPropertyInfo *) abstract_info;
nm_assert (!out_to_free || !*out_to_free);
nm_assert (out_flags && !*out_flags);
if (!NM_IN_SET (get_type,
NM_META_ACCESSOR_GET_TYPE_PARSABLE,
NM_META_ACCESSOR_GET_TYPE_PRETTY))
return NULL;
nm_assert (out_to_free);
if ( info->is_secret
&& !NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS)) {
NM_SET_OUT (out_is_default, TRUE);
return _get_text_hidden (get_type);
}
return info->property_type->get_fcn (info,
environment,
environment_user_data,
target,
get_type,
get_flags,
out_flags,
out_is_default,
out_to_free);
}
static const NMMetaAbstractInfo *const*
_meta_type_setting_info_editor_get_nested (const NMMetaAbstractInfo *abstract_info,
guint *out_len,
gpointer *out_to_free)
{
const NMMetaSettingInfoEditor *info;
info = (const NMMetaSettingInfoEditor *) abstract_info;
NM_SET_OUT (out_len, info->properties_num);
return (const NMMetaAbstractInfo *const*) info->properties;
}
static const NMMetaAbstractInfo *const*
_meta_type_property_info_get_nested (const NMMetaAbstractInfo *abstract_info,
guint *out_len,
gpointer *out_to_free)
{
NM_SET_OUT (out_len, 0);
return NULL;
}
static const char *const*
_meta_type_property_info_complete_fcn (const NMMetaAbstractInfo *abstract_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
const NMMetaOperationContext *operation_context,
const char *text,
char ***out_to_free)
{
const NMMetaPropertyInfo *info = (const NMMetaPropertyInfo *) abstract_info;
nm_assert (out_to_free && !*out_to_free);
if (info->property_type->complete_fcn) {
return info->property_type->complete_fcn (info,
environment,
environment_user_data,
operation_context,
text,
out_to_free);
}
if (info->property_type->values_fcn) {
return info->property_type->values_fcn (info,
out_to_free);
}
if ( info->property_typ_data
&& info->property_typ_data->values_static)
return info->property_typ_data->values_static;
return NULL;
}
const NMMetaType nm_meta_type_setting_info_editor = {
.type_name = "setting_info_editor",
.get_name = _meta_type_setting_info_editor_get_name,
.get_nested = _meta_type_setting_info_editor_get_nested,
.get_fcn = _meta_type_setting_info_editor_get_fcn,
};
const NMMetaType nm_meta_type_property_info = {
.type_name = "property_info",
.get_name = _meta_type_property_info_get_name,
.get_nested = _meta_type_property_info_get_nested,
.get_fcn = _meta_type_property_info_get_fcn,
.complete_fcn = _meta_type_property_info_complete_fcn,
};
const NMMetaType nm_meta_type_nested_property_info = {
.type_name = "nested_property_info",
};
|