netfilter hooks: How to compare sk_buff->nh.iph->saddr with a predefined IP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I want to compare the source address of an incoming packet with a list
of IPs such as:

char *deny[2]={"/x7f/x00/x00/x01", NULL } // 127.0.0.1

i've tried comparing the 2 addresses with this:

	[...]
	if(sb->nh.iph->saddr == *(unsigned int *)deny[0]) {
		printk("ignoring packet\n");
		return NF_DROP;
	}
	[...]

but it doesn't work... where i'm mistaking?

Really thanks
Marco..

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux