socket: SIOCADDRT ioctl

This commit is contained in:
Matheus
2024-04-07 21:44:07 -03:00
parent 989621840e
commit bba08c0b3e
3 changed files with 71 additions and 3 deletions
+20 -1
View File
@@ -94,7 +94,7 @@ typedef struct {
typedef struct {
unsigned short type;
char addr[];
char addr[14];
} abisockaddr_t;
typedef struct {
@@ -129,6 +129,7 @@ typedef struct {
#define IFNAMSIZ 16
#define SIOCGIFHWADDR 0x8927
#define SIOCADDRT 0x890b
typedef struct {
char name[IFNAMSIZ];
@@ -137,4 +138,22 @@ typedef struct {
};
} ifreq_t;
typedef struct {
unsigned long int rt_pad1;
abisockaddr_t rt_dst;
abisockaddr_t rt_gateway;
abisockaddr_t rt_genmask;
unsigned short int rt_flags;
short int rt_pad2;
unsigned long int rt_pad3;
unsigned char rt_tos;
unsigned char rt_class;
short int rt_pad4[3];
short int rt_metric;
char *rt_dev;
unsigned long int rt_mtu;
unsigned long int rt_window;
unsigned short int rt_irtt;
} abirtentry_t;
#endif
+1
View File
@@ -82,6 +82,7 @@ int arp_lookup(netdev_t *netdev, uint32_t ip, mac_t *mac);
int udp_sendpacket(void *buffer, size_t packetsize, uint32_t ip, uint16_t srcport, uint16_t dstport, netdev_t *broadcastdev);
int ipv4_sendpacket(void *buffer, size_t packetsize, uint32_t ip, int proto, netdev_t *broadcastdev);
void ipv4_process(netdev_t *netdev, void *nextbuff);
int ipv4_addroute(netdev_t *netdev, uint32_t addr, uint32_t gateway, uint32_t mask, int weight);
int netdev_register(netdev_t *netdev, char *name);
netdev_t *netdev_getdev(char *name);