Hi, all.<br><br>I misunderstood the functions defined in rtnl.h. We can check it by looking at the return value. Please, ignore my previous annoying thread. ;-)<br><br>Many thanks.<br><br><div class="gmail_quote">On Tue, Oct 20, 2009 at 3:40 PM, Jong-Hyouk Lee <span dir="ltr"><<a href="mailto:jonghyouk@gmail.com">jonghyouk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi, all.<br>
<br>
UMIP code involves and uses functions defined in rtnl.h in order to<br>
control routing tables. I have a simple question about the functions.<br>
For instance, when we use "route_add()" in order to add a routing<br>
entry, how can we ensure it has been done successfully? I know the<br>
function has a return value to check its operation. However, it is<br>
only true when the root account executes it. I mean if a normal user<br>
executes it, there is no error mechanism as I know. Is there any other<br>
ways to do it?<br>
<br>
I used the following code for test it.<br>
<br>
#include <sys/types.h><br>
#include <sys/socket.h><br>
#include <arpa/inet.h><br>
<br>
#include <stdio.h><br>
#include <string.h><br>
#include <stdlib.h><br>
<br>
#include "libnetlink.c"<br>
#include "debug.c"<br>
#include "rtnl.c"<br>
<br>
int main(void)<br>
{<br>
int result = 0;<br>
char addr[128];<br>
<br>
const struct in6_addr *st_dest;<br>
<br>
memset(addr, 0x00, sizeof(addr));<br>
<br>
inet_pton(AF_INET6, "2010:1:2:3::77", (void *)&addr);<br>
st_dest = (void *)&addr;<br>
<br>
result = route_add(2, RT_TABLE_MAIN, RTPROT_STATIC, 0, 99, NULL,<br>
0, st_dest, 64, NULL);<br>
<br>
if(result)<br>
printf("Done: route_add()\n");<br>
<br>
return(0);<br>
}<br>
<br>
Many thanks.<br>
<font color="#888888"><br>
--<br>
IMARA Team, INRIA, France.<br>
Jong-Hyouk Lee.<br>
<br>
#email: jonghyouk (at) gmail (dot) com || jong-hyouk.lee (at) inria (dot) fr<br>
#webpage: <a href="http://hurryon.googlepages.com/" target="_blank">http://hurryon.googlepages.com/</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>IMARA Team, INRIA, France. <br>Jong-Hyouk Lee.<br><br>#email: jonghyouk (at) gmail (dot) com || jong-hyouk.lee (at) inria (dot) fr<br>#webpage: <a href="http://hurryon.googlepages.com/">http://hurryon.googlepages.com/</a><br>