Projet

Général

Profil

« Précédent | Suivant » 

Révision dbdfeafa

Ajouté par Ermal il y a presque 10 ans

Correct the Tableaction function to make it actually try to do some work

Voir les différences:

pfPorts/php55-pfSense-module/files/pfSense.c
754 754
	if (action != IP_FW_TABLE_XDEL && action != IP_FW_TABLE_XADD && action != IP_FW_TABLE_XZEROENTRY)
755 755
		RETURN_FALSE;
756 756

  
757
	if ((op3 = emalloc(sizeof(*op3) + sizeof(*xent))) == NULL)
757
	size = sizeof(*op3) + sizeof(*xent);
758

  
759
	if ((op3 = (ip_fw3_opheader *)emalloc(size)) == NULL)
758 760
		RETURN_FALSE;
759 761

  
760
	memset(op3, 0, sizeof(*op3));
762
	memset(op3, 0, size);
761 763
	op3->ctxid = (uint16_t)zone;
762 764
	op3->opcode = action;
763 765
	xent = (ipfw_table_xentry *)(op3 + 1);
764
	memset(xent, 0, sizeof(*xent));
765 766
	xent->tbl = (u_int16_t)table;
766 767

  
767 768
	if (strchr(ip, ':')) {
......
772 773
	} else if (!inet_pton(AF_INET, ip, &xent->k.addr6)) {
773 774
		efree(op3);
774 775
		RETURN_FALSE;
775
	} else {
776
		efree(op3);
777
		RETURN_FALSE;
778 776
	}
779 777

  
780 778
	if (!strchr(ip, ':'))
......
791 789
	if (mac_len > 0) {
792 790
		if (ether_aton_r(mac, (struct ether_addr *)&xent->mac_addr) == NULL) {
793 791
			efree(op3);
792
			php_printf("Failed mac\n");
794 793
			RETURN_FALSE;
795 794
		}
796 795
		//xent->masklen += ETHER_ADDR_LEN;
797 796
	}
798 797

  
799 798
	xent->type = IPFW_TABLE_CIDR;
800
	size = sizeof(*op3) + sizeof(*xent);
801 799
	err = setsockopt(PFSENSE_G(ipfw), IPPROTO_IP, IP_FW3, op3, size);
802 800
	if (err < 0 && err != EEXIST) {
803 801
		efree(op3);
802
		php_printf("Failed setsockopt");
804 803
		RETURN_FALSE;
805 804
	}
806 805
	efree(op3);
......
894 893
	} else if (!inet_pton(AF_INET, ip, &xent->k.addr6)) {
895 894
		efree(op3);
896 895
		RETURN_FALSE;
897
	} else {
898
		efree(op3);
899
		RETURN_FALSE;
900 896
	}
901 897

  
902 898
	if (!strchr(ip, ':'))

Formats disponibles : Unified diff