Unsure if this is the correct forum, but nevertheless, hello all!
Sorry for the verbose title; I'm unsure what other way to put it. I'm currently writing a kernel module for a L3 network routing protocol. To allocate a socket object with sk_alloc, create an instance of the net_proto_family struct, or so on, I need to use an address family/protocol family number.
Code:
static const struct net_proto_family family_ops = {
...
.family = foo,
...
}
Code:
sk = sk_alloc(net, foo, GFP_KERNEL, proto, kern);
These are, of course,
hardcoded into the kernel. So I'm wondering what the best way to get around this is.
I could, of course, dream up a random number, but I'm willing to bet this isn't optimal. Adding 1 to the max protocol would break in the future if a new one is merged into the kernel. The best way I can think of is to patch my local kernel source tree and put in a new #define. What's the best way to do this? I'm only recently getting into kernel development, so sorry if this is a stupid question.
Regards,