<div dir="ltr"><div><div>Hi,<br><br></div>I am a 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<br>
harder to audit / <span class="">grep</span> and new commits actually use prandom_u32 only am told.<br><br></div><div>u32 prandom_u32(void);    /* defined in include/linux/random.h: */<br><br></div><div>#define net_random()        prandom_u32() /* defined in include/linux/net.h */<br>
<br></div><div>Everything works as expected until I get to net/core/neighbour.c and then patch fails to apply.<br></div><div></div><div><br></div>The diff is here: <br><div><div><div><br>-------------------------------------------------------------------------------------------------------------------------------<br>

diff --git a/net/core/neighbour.c b/net/core/neighbour.c<br>index 47d834e..ea97361 100644<br>--- a/net/core/neighbour.c<br>+++ b/net/core/neighbour.c<br>@@ -117,7 +117,7 @@ static void neigh_cleanup_and_release(struct neighbour *neig<br>
 <br> unsigned long neigh_rand_reach_time(unsigned long base)<br> {<br>-       return base ? (prandom_u32() % base) + (base &gt;&gt; 1) : 0;<br>+       return base ? (net_random() % base) + (base &gt;&gt; 1) : 0;<br> }<br>
 EXPORT_SYMBOL(neigh_rand_reach_time);<br> <br>@@ -1415,7 +1415,7 @@ void pneigh_enqueue(struct neigh_table *tbl, struct neigh_<br>                    struct sk_buff *skb)<br> {<br>        unsigned long now = jiffies;<br>
-       unsigned long sched_next = now + (prandom_u32() %<br>+       unsigned long sched_next = now + (net_random() %<br>                                          NEIGH_VAR(p, PROXY_DELAY));<br> <br>        if (tbl-&gt;proxy_queue.qlen &gt; NEIGH_VAR(p, PROXY_QLEN)) {<br>
-------------------------------------------------------------------------------------------------------------------------------<br>
<br></div><div>I can use some help and guidance please, what am I doing wrong ? Or not seeing ? It&#39;s just this neighbor.c file that is doing this and I am stumped. <br><br></div><div>Thank you.<br></div><div><br></div>
<div>Aruna Hewapathirane<br></div><div><br><div><div><a href="https://sites.google.com/site/arunahewapathirane/home/business-card/buisness-card.png?attredirects=0" target="_blank"><br>
</a>
</div></div></div></div></div></div>