ÔÚlinuxϲéѯ·ÓÉ
ÔÚlinux²éѯ·Óɵķ½·¨ÓкܶàÖÖ¡£ÏÂÃæ½éÉÜÒ»ÖÖ´Óiproute¿ªÔ´Èí¼þÖÐÌáÈ¡³öÀ´µÄÒ»ÖÖ·½·¨¡£ÔÚubuntu904ϱàÒ룬ÔËÐÐͨ¹ý¡£
±àÒë: gcc -o reqroute iproute_linux.c
ʹÓÃ: ./reqroute 1.2.3.4
½á¹û:source:1.3.4.5
Gateway:192.168.1.3
Dev:eth0
Ô´´úÂëÈçÏ£º
iproute_linux.h
typedef unsigned char __u8;
typedef short __s16;
typedef unsigned int __u32;
typedef struct{
__u8 family;
__u8 bytelen;
__s16 bitlen;
__u32 flags;
__u32 data[8];
} inet_prefix;
static struct{
int tb;
int cloned;
int flushed;
char *flushb;
int flushp;
int flushe;
struct rtnl_handle *rth;
int protocol, protocolmask;
int scope, scopemask;
int type, typemask;
int tos, tosmask;
int iif, iifmask;
int oif, oifmask;
int realm, realmmask;
inet_prefix rprefsrc;
inet_prefix rvia;
inet_prefix rdst;
inet_prefix mdst;
inet_prefix rsrc;
inet_prefix msrc;
} filter;
struct dn_naddr{
unsigned short a_len;
unsigned char a_addr[20];
};
struct ipx_addr {
u_int32_t ipx_net;
u_int8_t ipx_node[6];
};
struct idxmap{
struct idxmap * next;
unsigned index;
int type;
int alen;
unsigned flags;
unsigned char addr[20];
char name[16];
};
struct rtnl_handle{
int fd;
struct sockaddr_nl local;
struct sockaddr_nl peer;
__u32 seq;
__u32 dump;
};
ÁíÒ»¸öÎļþ£º
iproute_linux.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#includ
Ïà¹ØÎĵµ£º
¾ÍÊÇÔÚÒÑÓеÄÊý¾Ý¿âʵÀýÉÏ´´½¨Ò»¸öеÄÕʺţ¬·ÃÎÊһЩеıí
²Ù×÷²½ÖèÈçÏ£º
1¡¢µÇ¼linux£¬ÒÔoracleÓû§µÇ¼£¨Èç¹ûÊÇrootÓû§µÇ¼µÄ£¬µÇ¼ºóÓà su - oracleÃüÁîÇл»³ÉoracleÓû§£©
2¡¢ÒÔsysdba·½Ê½À´´ò¿ªsqlplus£¬ÃüÁîÈçÏ£º sqlplus "/as sysdba"
3¡¢²é¿´ÎÒÃdz£¹æ½«Óû§±í¿Õ¼ä·ÅÖÃλÖà ......
ÒÔϵÄһЩÎÄ×ÖÖ÷ÒªÀ´Ô´ÓÚkhg£¬johnsonmµÄWrite linux device driver£¬Brennan's Guide to Inline Assembly£¬The Linux A-Z£¬»¹ÓÐÇ廪BBSÉϵÄÓйØdevice driverµÄһЩ×ÊÁÏ. ÕâЩ×ÊÁÏÓеÄÒѾ¹ýʱ£¬ÓеĻ¹ÓÐһЩ´íÎó£¬ÎÒÒÀ¾Ý×Ô¼ºµÄÊÔÑé½á¹û½øÐÐÁËÐÞÕý.
Ò»¡¢Linux device driver µÄ¸ÅÄî
ϵͳµ÷ÓÃÊDzÙ× ......
Red Hat Enterprise Linux ÏÂcvs·þÎñÆ÷µÄ°²×°ÓëÅäÖÃ
°²×°ÓëÅäÖÃ
Ê×ÏÈ°²×° cvs £¬Ò»°ã·þÎñÆ÷×Ô´øÁËcvs·þÎñ£¬°æ±¾ËæÒ⣬ûʲô²î±ð
[root@RHEL ~]#rpm –ivh cvs-1.11.22-5.el5.i386.rpm
È»ºó´´½¨Ò»¸öcvsÓû§×飬²¢´´½¨Ò»¸öcvsrootÓû§
[root@RHEL ~]#groupadd cvs
[root@RHEL ~]#useradd –g cv ......
/bin ´æ·Å×î³£ÓõÄÃüÁ´ËĿ¼ÏµÄÃüÁîËùÓÐÓû§¶¼ÓÐÖ´ÐеÄȨÏÞ
/boot LinuxϵͳÒýµ¼Ä¿Â¼£¬´ËĿ¼±£´æϵͳÆô¶¯Ê±µÄÄÚºËÎļþºÍÄÚºËÓ³ÏñÎļþ¼°Æô¶¯Ê±ËùÐèµÄÆäËüÎļþ
/dev É豸Îļþ£¬±£´æËùÓеÄÓ²¼þÉ豸Îļþ£¬ÈçÓ²ÅÌÉ豸Îļþ£¬ÈíÇý¡¢¹âÇýÉ豸ÎļþµÈµÈ
/etc ......