Linux Kernel Network Subsystem Patching

Aruna Hewapathirane aruna.hewapathirane-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Sat Jan 11 01:53:54 UTC 2014


I ran make defconfig, ran make allyesconfig, then make scripts and finally
make M= net/ to build tehy subsytem alone and this is what it tells me ...

aruna at aruna-desktop:/media/kernel-dev/dev/linux-git$ make M=net/

  WARNING: Symbol version dump
/media/kernel-dev/dev/linux-git/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC      net/socket.o
  CC      net/802/fddi.o
  LD      net/802/built-in.o
  CC      net/core/sock.o
  CC      net/core/request_sock.o
  CC      net/core/skbuff.o
  CC      net/core/iovec.o
  CC      net/core/datagram.o
  CC      net/core/stream.o
  CC      net/core/scm.o
  CC      net/core/gen_stats.o
  CC      net/core/gen_estimator.o
  CC      net/core/net_namespace.o
  CC      net/core/secure_seq.o
  CC      net/core/flow_dissector.o
  CC      net/core/sysctl_net_core.o
  CC      net/core/dev.o
  CC      net/core/ethtool.o
  CC      net/core/dev_addr_lists.o
  CC      net/core/dst.o
  CC      net/core/netevent.o
  CC      net/core/neighbour.o
net/core/neighbour.c: In function ‘pneigh_enqueue’:
net/core/neighbour.c:1396: error: implicit declaration of function
‘NEIGH_VAR’
net/core/neighbour.c:1396: error: ‘PROXY_DELAY’ undeclared (first use in
this function)
net/core/neighbour.c:1396: error: (Each undeclared identifier is reported
only once
net/core/neighbour.c:1396: error: for each function it appears in.)
net/core/neighbour.c:1403: error: ‘PROXY_QLEN’ undeclared (first use in
this function)
net/core/neighbour.c:1423: warning: ISO C90 forbids mixed declarations and
code
net/core/neighbour.c:1423: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:1423: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:1427: error: invalid storage class for function
‘lookup_neigh_parms’
net/core/neighbour.c:1471: error: non-static declaration of
‘neigh_parms_alloc’ follows static declaration
net/core/neighbour.c:1439: note: previous definition of ‘neigh_parms_alloc’
was here
net/core/neighbour.c:1471: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:1471: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:1474: error: invalid storage class for function
‘neigh_rcu_free_parms’
net/core/neighbour.c:1502: error: non-static declaration of
‘neigh_parms_release’ follows static declaration
net/core/neighbour.c:1481: note: previous definition of
‘neigh_parms_release’ was here
net/core/neighbour.c:1502: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:1502: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:1505: error: invalid storage class for function
‘neigh_parms_destroy’
net/core/neighbour.c:1513: error: invalid storage class for function
‘neigh_table_init_no_netlink’
net/core/neighbour.c:1577: error: non-static declaration of
‘neigh_table_init’ follows static declaration
net/core/neighbour.c:1557: note: previous definition of ‘neigh_table_init’
was here
net/core/neighbour.c:1577: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:1577: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:1613: error: non-static declaration of
‘neigh_table_clear’ follows static declaration
net/core/neighbour.c:1579: note: previous definition of ‘neigh_table_clear’
was here
net/core/neighbour.c:1613: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:1613: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:1616: error: invalid storage class for function
‘neigh_delete’
net/core/neighbour.c:1680: error: invalid storage class for function
‘neigh_add’
net/core/neighbour.c:1778: error: invalid storage class for function
‘neightbl_fill_parms’
net/core/neighbour.c:1816: error: invalid storage class for function
‘neightbl_fill_info’
net/core/neighbour.c:1905: error: invalid storage class for function
‘neightbl_fill_param_info’
net/core/neighbour.c:1958: error: invalid storage class for function
‘neightbl_set’
net/core/neighbour.c:2093: error: invalid storage class for function
‘neightbl_dump_info’
net/core/neighbour.c:2143: error: invalid storage class for function
‘neigh_fill_info’
net/core/neighbour.c:2196: error: invalid storage class for function
‘pneigh_fill_info’
net/core/neighbour.c:2224: error: invalid storage class for function
‘neigh_update_notify’
net/core/neighbour.c:2231: error: invalid storage class for function
‘neigh_dump_table’
net/core/neighbour.c:2272: error: invalid storage class for function
‘pneigh_dump_table’
net/core/neighbour.c:2311: error: invalid storage class for function
‘neigh_dump_info’
net/core/neighbour.c:2369: error: non-static declaration of
‘neigh_for_each’ follows static declaration
net/core/neighbour.c:2349: note: previous definition of ‘neigh_for_each’
was here
net/core/neighbour.c:2369: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:2369: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:2404: error: non-static declaration of
‘__neigh_for_each_release’ follows static declaration
net/core/neighbour.c:2372: note: previous definition of
‘__neigh_for_each_release’ was here
net/core/neighbour.c:2404: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:2404: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:2409: error: invalid storage class for function
‘neigh_get_first’
net/core/neighbour.c:2450: error: invalid storage class for function
‘neigh_get_next’
net/core/neighbour.c:2496: error: invalid storage class for function
‘neigh_get_idx’
net/core/neighbour.c:2511: error: invalid storage class for function
‘pneigh_get_first’
net/core/neighbour.c:2534: error: invalid storage class for function
‘pneigh_get_next’
net/core/neighbour.c:2560: error: invalid storage class for function
‘pneigh_get_idx’
net/core/neighbour.c:2575: error: invalid storage class for function
‘neigh_get_idx_any’
net/core/neighbour.c:2601: error: non-static declaration of
‘neigh_seq_start’ follows static declaration
net/core/neighbour.c:2587: note: previous definition of ‘neigh_seq_start’
was here
net/core/neighbour.c:2601: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:2601: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:2628: error: non-static declaration of
‘neigh_seq_next’ follows static declaration
net/core/neighbour.c:2603: note: previous definition of ‘neigh_seq_next’
was here
net/core/neighbour.c:2628: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:2628: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:2635: error: non-static declaration of
‘neigh_seq_stop’ follows static declaration
net/core/neighbour.c:2630: note: previous definition of ‘neigh_seq_stop’
was here
net/core/neighbour.c:2635: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:2635: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:2640: error: invalid storage class for function
‘neigh_stat_seq_start’
net/core/neighbour.c:2657: error: invalid storage class for function
‘neigh_stat_seq_next’
net/core/neighbour.c:2671: error: invalid storage class for function
‘neigh_stat_seq_stop’
net/core/neighbour.c:2676: error: invalid storage class for function
‘neigh_stat_seq_show’
net/core/neighbour.c:2710: error: initializer element is not constant
net/core/neighbour.c:2710: error: (near initialization for
‘neigh_stat_seq_ops.start’)
net/core/neighbour.c:2711: error: initializer element is not constant
net/core/neighbour.c:2711: error: (near initialization for
‘neigh_stat_seq_ops.next’)
net/core/neighbour.c:2712: error: initializer element is not constant
net/core/neighbour.c:2712: error: (near initialization for
‘neigh_stat_seq_ops.stop’)
net/core/neighbour.c:2713: error: initializer element is not constant
net/core/neighbour.c:2713: error: (near initialization for
‘neigh_stat_seq_ops.show’)
net/core/neighbour.c:2717: error: invalid storage class for function
‘neigh_stat_seq_open’
net/core/neighbour.c:2729: error: initializer element is not constant
net/core/neighbour.c:2729: error: (near initialization for
‘neigh_stat_seq_fops.open’)
net/core/neighbour.c:2727: warning: ISO C90 forbids mixed declarations and
code
net/core/neighbour.c:2738: error: invalid storage class for function
‘neigh_nlmsg_size’
net/core/neighbour.c:2747: error: invalid storage class for function
‘__neigh_notify’
net/core/neighbour.c:2774: error: non-static declaration of ‘neigh_app_ns’
follows static declaration
net/core/neighbour.c:2770: note: previous definition of ‘neigh_app_ns’ was
here
net/core/neighbour.c:2774: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:2774: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:2783: error: invalid storage class for function
‘proc_unres_qlen’
net/core/neighbour.c:2879: error: initializer element is not constant
net/core/neighbour.c:2879: error: (near initialization for
‘neigh_sysctl_template.neigh_vars[7].proc_handler’)
net/core/neighbour.c:3035: error: non-static declaration of
‘neigh_sysctl_register’ follows static declaration
net/core/neighbour.c:2960: note: previous definition of
‘neigh_sysctl_register’ was here
net/core/neighbour.c:3035: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:3035: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:3046: error: non-static declaration of
‘neigh_sysctl_unregister’ follows static declaration
net/core/neighbour.c:3037: note: previous definition of
‘neigh_sysctl_unregister’ was here
net/core/neighbour.c:3046: warning: ‘__used__’ attribute ignored
net/core/neighbour.c:3046: error: section attribute cannot be specified for
local variables
net/core/neighbour.c:3051: error: invalid storage class for function
‘neigh_init’
net/core/neighbour.c:3063: error: initializer element is not constant
net/core/neighbour.c:3063: error: expected declaration or statement at end
of input
net/core/neighbour.c:2727: warning: unused variable ‘neigh_stat_seq_fops’
net/core/neighbour.c:1396: warning: unused variable ‘sched_next’
make[2]: *** [net/core/neighbour.o] Error 1
make[1]: *** [net/core] Error 2
make: *** [_module_net] Error 2
aruna at aruna-desktop:/media/kernel-dev/dev/linux-git$



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

> Ted believe me I have tried and tried and finally decided to ask for help.
> The patch errors are below:
>
> aruna at aruna-desktop:/media/kernel-dev/next-net/net-next$ git format-patch
> --subject-prefix="PATCH v1" HEAD^
> 0001-Network-Subsystem-v2.patch
>
> aruna at aruna-desktop:/media/kernel-dev/next-net/net-next$ git apply
> --check 0001-Network-Subsystem-v2.patch
>
> error: patch failed: net/core/neighbour.c:117
>
> error: net/core/neighbour.c: patch does not apply
>
> It makes no sense to me because all the other files compile clean nil
> errors :(
>
> On Fri, Jan 10, 2014 at 8:36 PM, ted leslie <ted.leslie-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
>
>> 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>
>>>
>>
>>
>
>
> --
> *Aruna Hewapathirane*
> Consultant/Trainer
> Phone : 647-709-9269
> Website: <http://goog_1768911931>Open Source Solutions<http://sahanaya.net/aruna/>
>
>
>
>
> <https://sites.google.com/site/arunahewapathirane/home/business-card/buisness-card.png?attredirects=0>
>



-- 
*Aruna Hewapathirane*
Consultant/Trainer
Phone : 647-709-9269
Website: <http://goog_1768911931>Open Source
Solutions<http://sahanaya.net/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/72e587c7/attachment.html>


More information about the Legacy mailing list