All of lore.kernel.org
 help / color / mirror / Atom feed
* Kernel Network Subsystem Patching
@ 2014-01-11  0:52 Aruna Hewapathirane
  0 siblings, 0 replies; only message in thread
From: Aruna Hewapathirane @ 2014-01-11  0:52 UTC (permalink / raw)
  To: kernelnewbies

Hi,

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
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 Hewapathirane


<https://sites.google.com/site/arunahewapathirane/home/business-card/buisness-card.png?attredirects=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140110/2c9d9128/attachment-0001.html 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-01-11  0:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-11  0:52 Kernel Network Subsystem Patching Aruna Hewapathirane

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.