#include #include #include #include #include #include int main(int argc, char ** argv){ if(argc < 2){ printf("Usage: %s ip_to_block\n", argv[0]); return 1; } struct in_addr block_address; if(!inet_aton(argv[1], &block_address)){ printf("Could not interpret %s as an IP address\n", argv[1]); return 1; } int fd = open("/proc/blockaddr", O_WRONLY); if(fd < 0){ perror("open"); return 1; } write(fd, &block_address, 4); close(fd); return 0; }