Allocating struct sock from kernel module

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

 



I am trying to send a Raw packet from my kernel module. I found what I hoped was a good example, but it came with the warning that allocating the 'struct sock' was the tricky part, which is where I am now. I want to use sk_alloc, which is defined as:

struct sock *sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot);

I have been looking for how to get to the Raw 'struct proto', but it is buried in at least one list, maybe more, and I haven't been able to find how to get to it directly. The only place I have seen it being accessed is in af_inet.c, which steps thru the 'struct inet_protosw' queue, checking the protocol field (Raw uses the int, IPPROTO_IP). But the inet_protosw queue is not an Exported Symbol. Is there a way to get the Raw 'struct proto', perhaps using the IPPROTO_IP int?

Also, are there any gotchas as far as the 'struct sock' after it has been allocated?

Thanks.

Later . . .   Jim


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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