Linux Kernel Network Subsystem Patching

ted leslie ted.leslie-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Sat Jan 11 01:36:27 UTC 2014


What patch error are you getting?

You can see what the patch is doing, you can just go put the changed two
lines in with editor.
-tl




On Fri, Jan 10, 2014 at 8:05 PM, Aruna Hewapathirane <
aruna.hewapathirane-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:

> Hello Everybody,
>
> I am a total newbie to kernel hacking and I have a question. Am trying to
> patch the Network Subsystem and changing the net_random() to direct calls
> of prandom_u32. Why ? Because it is
> harder to audit / grep and new commits actually use prandom_u32 only am
> told.
>
> u32 prandom_u32(void);    /* defined in include/linux/random.h: */
>
> #define net_random()        prandom_u32() /* defined in
> include/linux/net.h */
>
> Everything works as expected until I get to net/core/neighbour.c and then
> patch fails to apply.
>
> The diff is here:
>
>
> -------------------------------------------------------------------------------------------------------------------------------
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 47d834e..ea97361 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -117,7 +117,7 @@ static void neigh_cleanup_and_release(struct neighbour
> *neig
>
>  unsigned long neigh_rand_reach_time(unsigned long base)
>  {
> -       return base ? (prandom_u32() % base) + (base >> 1) : 0;
> +       return base ? (net_random() % base) + (base >> 1) : 0;
>  }
>  EXPORT_SYMBOL(neigh_rand_reach_time);
>
> @@ -1415,7 +1415,7 @@ void pneigh_enqueue(struct neigh_table *tbl, struct
> neigh_
>                     struct sk_buff *skb)
>  {
>         unsigned long now = jiffies;
> -       unsigned long sched_next = now + (prandom_u32() %
> +       unsigned long sched_next = now + (net_random() %
>                                           NEIGH_VAR(p, PROXY_DELAY));
>
>         if (tbl->proxy_queue.qlen > NEIGH_VAR(p, PROXY_QLEN)) {
>
> -------------------------------------------------------------------------------------------------------------------------------
>
> I can use some help and guidance please, what am I doing wrong ? Or not
> seeing ? It's just this neighbor.c file that is doing this and I am
> stumped.
>
> Thank you.
> Aruna
>
> <https://sites.google.com/site/arunahewapathirane/home/business-card/buisness-card.png?attredirects=0>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20140110/7c8324c8/attachment.html>


More information about the Legacy mailing list