blob: c1cc952b97365af68f50aa8cbc65e72b19a294ee [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001#include <stdlib.h>
2#include <stdio.h>
3#include <string.h>
4#include <sys/ioctl.h>
5#include <fcntl.h>
6#include <getopt.h>
7#ifndef CONFIG_SUPPORT_OPENWRT
8#include <linux/autoconf.h>
9#endif
10#if defined CONFIG_COLGIN_SUPPORT
11#include "hnat_ioctl.h"
12#else
13#include "hwnat_ioctl.h"
14#endif
15
xj112b9672022-01-25 16:13:48 +080016int HwNatInvalEntry(unsigned int entry_num, unsigned int ppe_index)
xjb04a4022021-11-25 15:01:52 +080017{
18 struct hwnat_args opt;
19 int fd;
20
xj112b9672022-01-25 16:13:48 +080021 opt.entry_num = entry_num;
22 opt.debug = ppe_index;
xjb04a4022021-11-25 15:01:52 +080023
24 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
25 if (fd < 0)
26 {
27 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
28 return HWNAT_FAIL;
29 }
30
31 if(ioctl(fd, HW_NAT_INVALID_ENTRY, &opt)<0) {
32 printf("HW_NAT_API: ioctl error\n");
33 close(fd);
34 return HWNAT_FAIL;
35 }
36
37 close(fd);
38 return HWNAT_SUCCESS;
39}
40
41int HwNatDumpDport(void)
42{
43 int fd;
44 struct hwnat_args opt;
45
46 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
47 if (fd < 0)
48 {
49 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
50 return HWNAT_FAIL;
51 }
52 if(ioctl(fd, HW_NAT_DPORT, &opt)<0) {
53 printf("HW_NAT_API: ioctl error\n");
54 close(fd);
55 return HWNAT_FAIL;
56 }
57
58 close(fd);
59 return HWNAT_SUCCESS;
60}
61#if defined (CONFIG_HW_NAT_IPI)
62int HwNatIPICtrlFromExtIf(struct hwnat_ipi_args *opt)
63{
64 int fd;
65
66 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
67 if (fd < 0)
68 {
69 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
70 return HWNAT_FAIL;
71 }
72
73 if(ioctl(fd, HW_NAT_IPI_CTRL_FROM_EXTIF, opt)<0) {
74 printf("HW_NAT_API: ioctl error\n");
75 close(fd);
76 return HWNAT_FAIL;
77 }
78
79 close(fd);
80 return HWNAT_SUCCESS;
81}
82
83int HwNatIPICtrlFromPPEHit(struct hwnat_ipi_args *opt)
84{
85 int fd;
86
87 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
88 if (fd < 0)
89 {
90 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
91 return HWNAT_FAIL;
92 }
93
94 if(ioctl(fd, HW_NAT_IPI_CTRL_FROM_PPEHIT, opt)<0) {
95 printf("HW_NAT_API: ioctl error\n");
96 close(fd);
97 return HWNAT_FAIL;
98 }
99
100 close(fd);
101 return HWNAT_SUCCESS;
102}
103#endif
104
105int HwNatDelEntry(struct hwnat_tuple *opt)
106{
107 int fd;
108
109 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
110 if (fd < 0)
111 {
112 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
113 return HWNAT_FAIL;
114 }
115 if(ioctl(fd, HW_NAT_DEL_ENTRY, opt)<0) {
116 printf("HW_NAT_API: ioctl error\n");
117 close(fd);
118 return HWNAT_FAIL;
119 }
120
121 close(fd);
122 return HWNAT_SUCCESS;
123
124}
125
126int HwNatAddEntry(struct hwnat_tuple *opt)
127{
128 int fd;
129
130 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
131 if (fd < 0)
132 {
133 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
134 return HWNAT_FAIL;
135 }
136
137 if(ioctl(fd, HW_NAT_ADD_ENTRY, opt)<0) {
138 printf("HW_NAT_API: ioctl error\n");
139 close(fd);
140 return HWNAT_FAIL;
141 }
142
143 close(fd);
144 return HWNAT_SUCCESS;
145
146}
147
148int HwNatHookModify(struct hwnat_tuple *opt, int clear)
149{
150 int fd;
151
152 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
153 if (fd < 0)
154 {
155 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
156 return HWNAT_FAIL;
157 }
158 if(ioctl(fd, (clear == 1) ? HW_NAT_CLEAR_HOOK : HW_NAT_RESTORE_HOOK, opt)<0) {
159 printf("HW_NAT_API: ioctl error\n");
160 close(fd);
161 return HWNAT_FAIL;
162 }
163
164 close(fd);
165 return HWNAT_SUCCESS;
166
167}
168
169
170
171#if defined (CONFIG_PPE_MIB)
172int HwNatMibDumpEntry(unsigned int entry_num)
173{
174 struct hwnat_mib_args opt;
175 int fd;
176 opt.entry_num=entry_num;
177 printf("!!!!!!!!HwNatMibDumpEntry\n");
178 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
179 if (fd < 0)
180 {
181 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
182 return HWNAT_FAIL;
183 }
184
185 if(ioctl(fd, HW_NAT_MIB_DUMP, &opt)<0) {
186 printf("HW_NAT_API: ioctl error\n");
187 close(fd);
188 return HWNAT_FAIL;
189 }
190
191 close(fd);
192 return HWNAT_SUCCESS;
193}
194int HwNatMibDramDumpEntry(unsigned int entry_num)
195{
196 struct hwnat_mib_args opt;
197 int fd;
198
199 opt.entry_num=entry_num;
200
201 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
202 if (fd < 0)
203 {
204 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
205 return HWNAT_FAIL;
206 }
207
208 if(ioctl(fd, HW_NAT_MIB_DRAM_DUMP, &opt)<0) {
209 printf("HW_NAT_API: ioctl error\n");
210 close(fd);
211 return HWNAT_FAIL;
212 }
213
214 close(fd);
215 return HWNAT_SUCCESS;
216}
217
218int HwNatMibGet(struct hwnat_tuple *opt)
219{
220 int fd;
221
222 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
223 if (fd < 0)
224 {
225 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
226 return HWNAT_FAIL;
227 }
228
229 if(ioctl(fd, HW_NAT_MIB_GET, opt)<0) {
230 printf("HW_NAT_API: ioctl error\n");
231 close(fd);
232 return HWNAT_FAIL;
233 }
234
235 close(fd);
236 return HWNAT_SUCCESS;
237
238}
239#if defined CONFIG_COLGIN_SUPPORT
240int HwNatMibGetAllIP(struct hwnat_mib_all_ip_args *opt)
241{
242 int fd;
243
244 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
245 if (fd < 0)
246 {
247 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
248 return HWNAT_FAIL;
249 }
250
251 if(ioctl(fd, HW_NAT_MIB_GET_ALL_IP, opt)<0) {
252 printf("HW_NAT_API: ioctl error\n");
253 close(fd);
254 return HWNAT_FAIL;
255 }
256
257 close(fd);
258 return HWNAT_SUCCESS;
259}
260#endif
261#endif
262
263int HwNatTblClear(void)
264{
265 struct hwnat_args opt;
266 int fd;
267
268 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
269 if (fd < 0)
270 {
271 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
272 return HWNAT_FAIL;
273 }
274
275 if(ioctl(fd, HW_NAT_TBL_CLEAR, &opt)<0) {
276 printf("HW_NAT_API: ioctl error\n");
277 close(fd);
278 return HWNAT_FAIL;
279 }
280
281 close(fd);
282 return HWNAT_SUCCESS;
283}
284
xj112b9672022-01-25 16:13:48 +0800285int HwNatDumpEntry(unsigned int entry_num, unsigned int ppe_index)
xjb04a4022021-11-25 15:01:52 +0800286{
287 struct hwnat_args opt;
288 int fd;
289
xj112b9672022-01-25 16:13:48 +0800290 opt.entry_num = entry_num;
291 opt.debug = ppe_index;
xjb04a4022021-11-25 15:01:52 +0800292
293 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
294 if (fd < 0)
295 {
296 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
297 return HWNAT_FAIL;
298 }
299
300 if(ioctl(fd, HW_NAT_DUMP_ENTRY, &opt)<0) {
301 printf("HW_NAT_API: ioctl error\n");
302 close(fd);
303 return HWNAT_FAIL;
304 }
305
306 close(fd);
307 return HWNAT_SUCCESS;
308}
309
xj112b9672022-01-25 16:13:48 +0800310int HwNatBindEntry(unsigned int entry_num, unsigned int ppe_index)
xjb04a4022021-11-25 15:01:52 +0800311{
312 struct hwnat_args opt;
313 int fd;
314
xj112b9672022-01-25 16:13:48 +0800315 opt.entry_num = entry_num;
316 opt.debug = ppe_index;
xjb04a4022021-11-25 15:01:52 +0800317
318 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
319 if (fd < 0)
320 {
321 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
322 return HWNAT_FAIL;
323 }
324
325 if(ioctl(fd, HW_NAT_BIND_ENTRY, &opt)<0) {
326 printf("HW_NAT_API: ioctl error\n");
327 close(fd);
328 return HWNAT_FAIL;
329 }
330
331 close(fd);
332 return HWNAT_SUCCESS;
333}
334
xj112b9672022-01-25 16:13:48 +0800335int HwNatUnBindEntry(unsigned int entry_num, unsigned int ppe_index)
xjb04a4022021-11-25 15:01:52 +0800336{
337 struct hwnat_args opt;
338 int fd;
339
xj112b9672022-01-25 16:13:48 +0800340 opt.entry_num = entry_num;
341 opt.debug = ppe_index;
xjb04a4022021-11-25 15:01:52 +0800342
343 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
344 if (fd < 0)
345 {
346 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
347 return HWNAT_FAIL;
348 }
349
350 if(ioctl(fd, HW_NAT_UNBIND_ENTRY, &opt)<0) {
351 printf("HW_NAT_API: ioctl error\n");
352 close(fd);
353 return HWNAT_FAIL;
354 }
355
356 close(fd);
357 return HWNAT_SUCCESS;
358}
359
xj112b9672022-01-25 16:13:48 +0800360int HwNatDropEntry(unsigned int entry_num, unsigned int ppe_index)
xjb04a4022021-11-25 15:01:52 +0800361{
362 struct hwnat_args opt;
363 int fd;
364
xj112b9672022-01-25 16:13:48 +0800365 opt.entry_num = entry_num;
366 opt.debug = ppe_index;
xjb04a4022021-11-25 15:01:52 +0800367
368 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
369 if (fd < 0)
370 {
371 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
372 return HWNAT_FAIL;
373 }
374
375 if(ioctl(fd, HW_NAT_DROP_ENTRY, &opt)<0) {
376 printf("HW_NAT_API: ioctl error\n");
377 close(fd);
378 return HWNAT_FAIL;
379 }
380
381 close(fd);
382 return HWNAT_SUCCESS;
383}
384
385
386
xj112b9672022-01-25 16:13:48 +0800387int HwNatInvalidEntry(unsigned int entry_num, unsigned int ppe_index)
xjb04a4022021-11-25 15:01:52 +0800388{
389 struct hwnat_args opt;
390 int fd;
391
xj112b9672022-01-25 16:13:48 +0800392 opt.entry_num = entry_num;
393 opt.debug = ppe_index;
xjb04a4022021-11-25 15:01:52 +0800394
395 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
396 if (fd < 0)
397 {
398 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
399 return HWNAT_FAIL;
400 }
401
402 if(ioctl(fd, HW_NAT_INVALID_ENTRY, &opt)<0) {
403 printf("HW_NAT_API: ioctl error\n");
404 close(fd);
405 return HWNAT_FAIL;
406 }
407
408 close(fd);
409 return HWNAT_SUCCESS;
410}
411
412int HwNatCacheDumpEntry(void)
413{
414
415 struct hwnat_args opt;
416 int fd;
417
418 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
419 if (fd < 0)
420 {
421 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
422 return HWNAT_FAIL;
423 }
424 if(ioctl(fd, HW_NAT_DUMP_CACHE_ENTRY, &opt)<0) {
425
426
427 printf("HW_NAT_API: ioctl error\n");
428 close(fd);
429 return HWNAT_FAIL;
430 }
431
432 close(fd);
433 return HWNAT_SUCCESS;
434}
435
436int HwNatGetAGCnt(struct hwnat_ac_args *opt)
437{
438 int fd;
439
440 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
441 if (fd < 0)
442 {
443 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
444 return HWNAT_FAIL;
445 }
446
447 if(ioctl(fd, HW_NAT_GET_AC_CNT, opt)<0) {
448 printf("HW_NAT_API: ioctl error\n");
449 close(fd);
450 return HWNAT_FAIL;
451 }
452
453 close(fd);
454 return HWNAT_SUCCESS;
455
456}
457
458int HwNatSetBindThreshold(struct hwnat_config_args *opt)
459{
460 int fd;
461
462 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
463 if (fd < 0)
464 {
465 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
466 return HWNAT_FAIL;
467 }
468
469 if(ioctl(fd, HW_NAT_BIND_THRESHOLD, opt)<0) {
470 printf("HW_NAT_API: ioctl error\n");
471 close(fd);
472 return HWNAT_FAIL;
473 }
474
475 close(fd);
476 return HWNAT_SUCCESS;
477
478}
479
480int HwNatSetMaxEntryRateLimit(struct hwnat_config_args *opt)
481{
482 int fd;
483
484 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
485 if (fd < 0)
486 {
487 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
488 return HWNAT_FAIL;
489 }
490
491 if(ioctl(fd, HW_NAT_MAX_ENTRY_LMT, opt)<0) {
492 printf("HW_NAT_API: ioctl error\n");
493 close(fd);
494 return HWNAT_FAIL;
495 }
496
497 close(fd);
498 return HWNAT_SUCCESS;
499
500}
501
502
503int HwNatSetRuleSize(struct hwnat_config_args *opt)
504{
505 int fd;
506
507 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
508 if (fd < 0)
509 {
510 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
511 return HWNAT_FAIL;
512 }
513
514 if(ioctl(fd, HW_NAT_RULE_SIZE, opt)<0) {
515 printf("HW_NAT_API: ioctl error\n");
516 close(fd);
517 return HWNAT_FAIL;
518 }
519
520 close(fd);
521 return HWNAT_SUCCESS;
522
523}
524
525int HwNatSetKaInterval(struct hwnat_config_args *opt)
526{
527 int fd;
528
529 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
530 if (fd < 0)
531 {
532 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
533 return HWNAT_FAIL;
534 }
535
536 if(ioctl(fd, HW_NAT_KA_INTERVAL, opt)<0) {
537 printf("HW_NAT_API: ioctl error\n");
538 close(fd);
539 return HWNAT_FAIL;
540 }
541
542 close(fd);
543 return HWNAT_SUCCESS;
544
545}
546
547int HwNatSetUnbindLifeTime(struct hwnat_config_args *opt)
548{
549 int fd;
550
551 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
552 if (fd < 0)
553 {
554 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
555 return HWNAT_FAIL;
556 }
557
558 if(ioctl(fd, HW_NAT_UB_LIFETIME, opt)<0) {
559 printf("HW_NAT_API: ioctl error\n");
560 close(fd);
561 return HWNAT_FAIL;
562 }
563
564 close(fd);
565 return HWNAT_SUCCESS;
566
567}
568
569int HwNatSetBindLifeTime(struct hwnat_config_args *opt)
570{
571 int fd;
572
573 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
574 if (fd < 0)
575 {
576 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
577 return HWNAT_FAIL;
578 }
579
580 if(ioctl(fd, HW_NAT_BIND_LIFETIME, opt)<0) {
581 printf("HW_NAT_API: ioctl error\n");
582 close(fd);
583 return HWNAT_FAIL;
584 }
585
586 close(fd);
587 return HWNAT_SUCCESS;
588
589}
590
591int HwNatSetVID(struct hwnat_config_args *opt)
592{
593 int fd;
594
595 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
596 if (fd < 0)
597 {
598 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
599 return HWNAT_FAIL;
600 }
601
602 if(ioctl(fd, HW_NAT_VLAN_ID, opt)<0) {
603 printf("HW_NAT_API: ioctl error\n");
604 close(fd);
605 return HWNAT_FAIL;
606 }
607
608 close(fd);
609 return HWNAT_SUCCESS;
610}
611
612int HwNatSetBindDir(struct hwnat_config_args *opt)
613{
614 int fd;
615
616 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
617 if (fd < 0)
618 {
619 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
620 return HWNAT_FAIL;
621 }
622
623 if(ioctl(fd, HW_NAT_BIND_DIRECTION, opt)<0) {
624 printf("HW_NAT_API: ioctl error\n");
625 close(fd);
626 return HWNAT_FAIL;
627 }
628
629 close(fd);
630 return HWNAT_SUCCESS;
631}
632
633int HwNatGetAllEntries(struct hwnat_args *opt)
634{
635 int fd=0;
636
637 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
638 if (fd < 0)
639 {
640 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
641 return HWNAT_FAIL;
642 }
643
644 if(ioctl(fd, HW_NAT_GET_ALL_ENTRIES, opt)<0) {
645 printf("HW_NAT_API: ioctl error\n");
646 close(fd);
647 return HWNAT_FAIL;
648 }
649
650 close(fd);
651
652
653 return HWNAT_SUCCESS;
654
655}
656
657int HwNatDebug(unsigned int debug)
658{
659 struct hwnat_args opt;
660 int fd;
661
662 opt.debug=debug;
663
664 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
665 if (fd < 0)
666 {
667 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
668 return HWNAT_FAIL;
669 }
670
671 if(ioctl(fd, HW_NAT_DEBUG, &opt)<0) {
672 printf("HW_NAT_API: ioctl error\n");
673 close(fd);
674 return HWNAT_FAIL;
675 }
676
677 close(fd);
678 return HWNAT_SUCCESS;
679}
680
681#if defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621)
682int HwNatSwitchDsliteMape(unsigned int swit)
683{
684 struct hwnat_args opt;
685 int fd;
686
687 opt.swit=swit;
688
689 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
690 if (fd < 0)
691 {
692 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
693 return HWNAT_FAIL;
694 }
695
696 if(ioctl(fd, HW_NAT_SWITCH_DSL_MAPE, &opt)<0) {
697 printf("HW_NAT_API: ioctl error\n");
698 close(fd);
699 return HWNAT_FAIL;
700 }
701
702 close(fd);
703 return HWNAT_SUCCESS;
704}
705#endif
706
707#ifdef CONFIG_PPE_MCAST
708int HwNatMcastIns(struct hwnat_mcast_args *opt)
709{
710 int fd;
711
712 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
713 if (fd < 0)
714 {
715 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
716 return HWNAT_FAIL;
717 }
718
719 if(ioctl(fd, HW_NAT_MCAST_INS, opt)<0) {
720 printf("HW_NAT_API: ioctl error\n");
721 close(fd);
722 return HWNAT_FAIL;
723 }
724
725 close(fd);
726 return HWNAT_SUCCESS;
727}
728
729int HwNatMcastDel(struct hwnat_mcast_args *opt)
730{
731 int fd;
732
733 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
734 if (fd < 0)
735 {
736 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
737 return HWNAT_FAIL;
738 }
739
740 if(ioctl(fd, HW_NAT_MCAST_DEL, opt)<0) {
741 printf("HW_NAT_API: ioctl error\n");
742 close(fd);
743 return HWNAT_FAIL;
744 }
745
746 close(fd);
747 return HWNAT_SUCCESS;
748}
749
750int HwNatMcastDump(void)
751{
752 int fd;
753
754 fd = open("/dev/"HW_NAT_DEVNAME, O_RDONLY);
755 if (fd < 0)
756 {
757 printf("Open %s pseudo device failed\n","/dev/"HW_NAT_DEVNAME);
758 return HWNAT_FAIL;
759 }
760
761 if(ioctl(fd, HW_NAT_MCAST_DUMP, NULL)<0) {
762 printf("HW_NAT_API: ioctl error\n");
763 close(fd);
764 return HWNAT_FAIL;
765 }
766
767 close(fd);
768 return HWNAT_SUCCESS;
769}
770#endif